bug-textutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug in Linux /bin/sort (textutils-2.0e-8, RedHat 7.0)


From: Brent Thompson
Subject: bug in Linux /bin/sort (textutils-2.0e-8, RedHat 7.0)
Date: Wed, 25 Apr 2001 11:13:50 -0700

I have a file with several instances of same pair of slightly different
lines, e.g.:

'^string-ends-with-alpha'
'^string-ends-with-alpha '
'^string-ends-with-alpha'
'^string-ends-with-alpha '
'^string-ends-with-alpha'
'^string-ends-with-alpha '
'^string-ends-with-alpha'
'^string-ends-with-alpha '

On a RedHat 7.0 system with textutils-2.0e-8 installed:

'sort file' returns unchanged list, despite many out-of-order lines.
'sort -u file' returns unchanged list, despite many identical duplicate lines.

Shouldn't 'sort file' return something like this?:

'^string-ends-with-alpha '
'^string-ends-with-alpha '
'^string-ends-with-alpha '
'^string-ends-with-alpha '
'^string-ends-with-alpha'
'^string-ends-with-alpha'
'^string-ends-with-alpha'
'^string-ends-with-alpha'

and 'sort -u file' return something like this?:

'^string-ends-with-alpha '
'^string-ends-with-alpha'

Manually editing the data file to move a single line before/after adjacent
line causes Linux 'sort file' and 'sort -u file' to do the expected, i.e.
give output different than input, but each changes/removes only 1 duplicate
line, leaving all the other duplicates in original mis-ordered state
(presuming only one of the many duplicate lines in the data file was
manually re-ordered).

Data file contents and particulars to identify the version of sort are
below.
 ---   Brent

######### begin data file #########
more /var/log/messages
tail -f messages
tail -f messages 
tail -f messages
tail -f messages 
tail -f messages
tail -f messages 
tail -f messages
tail -f messages 
tail -f messages
tail -f messages 
tail -f messages
tail -f messages 
tail -f messages
tail -f messages 
tail -f messages
tail -f messages 
tail -f messages
tail -f messages 
tail -f messages
tail -f messages 
tail -f messages
tail -f messages 
tail -f messages
tail -f messages 
tail -f messages
tail -f messages 
tail -f messages
tail -f messages 
tail -f messages
tail -f messages 
tail -f /var/log/messages
tail messages
tail messages 
tail /var/log/messages
######### end data file #########

######### begin identify /bin/sort #########
# ll /bin/sort
-rwxr-xr-x    1 root     root        26972 Aug 30  2000 /bin/sort

# rpm -qi textutils
Name        : textutils                    Relocations: (not relocateable)
Version     : 2.0e                              Vendor: Red Hat, Inc.
Release     : 8                             Build Date: Wed 30 Aug 2000 02:35:33
 PM PDT
Install date: Mon 16 Apr 2001 11:51:04 AM PDT      Build Host: porky.devel.redha
t.com
Group       : Applications/Text             Source RPM: textutils-2.0e-8.src.rpm

Size        : 1776429                          License: GPL
Packager    : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
Summary     : A set of GNU text file modifying utilities.
Description :
A set of GNU utilities for modifying the contents of files, including
programs for splitting, joining, comparing and modifying files.

# strings /bin/sort
/lib/ld-linux.so.2
__gmon_start__
librt.so.1
libc.so.6
textdomain
printf
__strtod_internal
stdout
sigemptyset
fdopen
memmove
getopt_long
pathconf
__ctype_b
getenv
getpid
qsort
memcpy
puts
__cxa_finalize
feof
malloc
opterr
fflush
__ctype_toupper
localeconv
calloc
fprintf
kill
dcgettext
__deregister_frame_info
nl_langinfo
optind
memchr
stdin
ferror
strcoll
strncmp
unlink
realloc
sigaction
fread
__xstat64
clearerr
open64
__assert_fail
strcmp
sprintf
fclose
setlocale
stderr
error
fwrite
__errno_location
exit
bindtextdomain
_IO_putc
_IO_stdin_used
__libc_start_main
strlen
fputs
__register_frame_info
__fxstat64
free
fopen64
GLIBC_2.1.3
GLIBC_2.2
GLIBC_2.1
GLIBC_2.0
PTRh,
QVh 
XZh!
u+Sh
u,Sh
0ZVj
[^_]
tAVj
[^_]
[^_]
[^_]
t<;V
[^_]
[^_]
[^_]
[^_]
Y[^_]
[^_]
[^_]
[^_]
[^_]
XZSW
s(;}
t>;u
s];}
s2;}
XZWS
[^_]
[^_]
XZQS
[^_]
VQRP
[^_]
[^_]
FC;]
[^_]
PVSQ
[^_]
WSQV
[^_]
Y[h(
0<ct`
<ktQ<m
>.uc
WSVQ
RSPW
[^_]
PSQR
[^_]
PQRh
ZYSj
XZSj
Try `%s --help' for more information.
Usage: %s [OPTION]... [FILE]...
/tmp
Write sorted concatenation of all FILE(s) to standard output.
  +POS1 [-POS2]    start a key at POS1, end it *before* POS2 (obsolescent)
                     field numbers and character offsets are numbered
                     starting with zero (contrast with the -k option)
  -b               ignore leading blanks in sort fields or keys
  -c               check if given files already sorted, do not sort
  -d               consider only [a-zA-Z0-9 ] characters in keys
  -f               fold lower case to upper case characters in keys
  -g               compare according to general numerical value, imply -b
  -i               consider only [\040-\0176] characters in keys
  -k POS1[,POS2]   start a key at POS1, end it *at* POS2
                     field numbers and character offsets are numbered
                     starting with one (contrast with zero-based +POS form)
  -m               merge already sorted files, do not sort
  -M               compare (unknown) < `JAN' < ... < `DEC', imply -b
  -n               compare according to string numerical value, imply -b
  -o FILE          write result on FILE instead of standard output
  -r               reverse the result of comparisons
  -s               stabilize sort by disabling last resort comparison
  -t SEP           use SEParator instead of non- to whitespace transition
  -T DIRECTORY     use DIRECTORY for temporary files, not $TMPDIR or %s
  -u               with -c, check for strict ordering;
                   with -m, only output the first of an equal sequence
  -z               end lines with 0 byte, not newline, for find -print0
      --help       display this help and exit
      --version    output version information and exit
POS is F[.C][OPTS], where F is the field number and C the character position
in the field, both counted from one with -k, from zero with the obsolescent
form.  OPTS is made up of one or more of Mbdfinr; this effectively disables
global -Mbdfinr settings for that key.  If no key is given, use the entire
line as the key.  With no FILE, or when FILE is -, read standard input.
Report bugs to <address@hidden>.
usage
sort.c
status == 0 || status == 2
flushing file
error closing file
%s: write error
%s%ssort%5.5d%5.5d
%s%ss%5.5d%2.2d.%3.3d
read error
%s: %s:%d: disorder: 
standard error
invalid field specification `%s'
/usr/share/locale
textutils
Mike Haertel
2.0e
GNU textutils
sort
TMPDIR
when using the old-style +POS and -POS key specifiers,
the +POS specifier must come first
option `-k' requires an argument
the starting field number argument to the `-k' option must be positive
starting field spec has `.' but lacks following character offset
starting field character offset argument to the `-k' option
must be positive
field specification has `,' but lacks following field spec
ending field number argument to the `-k' option must be positive
ending field spec has `.' but lacks following character offset
option `-o' requires an argument
option `-t' requires an argument
option `-T' requires an argument
%s: unrecognized option `-%c'
POSIX
version
help
Copyright (C) 1999 Free Software Foundation, Inc.
%s (%s) %s
%s %s
Written by %s.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Memory exhausted
write error
######### end strings /bin/sort #########




reply via email to

[Prev in Thread] Current Thread [Next in Thread]