> $ ftp -o- http://junkpile.org/sort-ispell.txt | sort -u -t/ +0f -1 +0

The -u seems unimportant. Using more modern syntax, the following seems to 
have the same effect:

$ ftp http://junkpile.org/sort-ispell.txt && sort -t/ -k1,1 -k1 sort-ispell.txt

>
> The second one I've seen affects at least i386 and amd64. The file
> that triggers it is a database dump and a bit unwieldy. Trimming out
> some lines I can get it to fail on amd64 but not i386, and trimming
> another line or two from the second file it works on both.
>

It's also possible to crash "sort -H" with long lines. The stack trace for 
this crash looks similar to your 2nd crash. Here's how to reproduce 
easily on amd64. I don't know if this will also crash i386.

1) Apply the patch below.
2) Run the sort regression tests
        $ cd /usr/src/regress/usr.bin/sort && make regress
3) Test #40 will segfault.

GNU gdb 6.3
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you 
are
welcome to change it and/or distribute copies of it under certain 
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for 
details.
This GDB was configured as "amd64-unknown-openbsd4.6"...
Core was generated by `sort'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/lib/libc.so.53.1...done.
Loaded symbols for /usr/lib/libc.so.53.1
Reading symbols from /usr/libexec/ld.so...done.
Loaded symbols for /usr/libexec/ld.so
#0  memcpy (dst0=0x206c90000, src0=0x20c29a000, length=0) at 
/usr/src/lib/libc/string/bcopy.c:91
91                              TLOOP1(*dst++ = *src++);
(gdb) bt
#0  memcpy (dst0=0x206c90000, src0=0x20c29a000, length=0) at 
/usr/src/lib/libc/string/bcopy.c:91
#1  0x0000000207ab68ab in __sfvwrite (fp=0x207ef7300, uio=0x7f7ffffc25d0) 
at /usr/src/lib/libc/stdio/fvwrite.c:147
#2  0x0000000207ab669a in fwrite (buf=0x206c90000, size=1, count=71693, 
fp=0x207ef7300) at /usr/src/lib/libc/stdio/fwrite.c:68
#3  0x000000000040396a in putline (rec=0x20c289010, fp=0x207ef7300) at 
files.c:306
#4  0x00000000004057ea in merge (infl0=984, nfiles=15, get=0x403985 
<geteasy>, outfp=0x207ef7300, put=0x403924 <putline>, ftbl=0x20cc6fc00) at 
msort.c:168
#5  0x00000000004054dc in fmerge (binno=0, files={top = 984, names = 
0x3d8}, nfiles=15, get=0x403985 <geteasy>, outfp=0x207ef7300, 
fput=0x403924 <putline>, 
    ftbl=0x20cc6fc00) at msort.c:109
#6  0x000000000040400d in fsort (binno=-1, depth=0, infiles={top = 
-249256, names = 0x7f7ffffc3258}, nfiles=1, outfp=0x207ef7300, 
ftbl=0x20cc6fc00)
    at fsort.c:163
#7  0x000000000040689f in main (argc=4, argv=0x7f7ffffc3240) at sort.c:306



Index: stests
===================================================================
RCS file: /usr/cvs/src/regress/usr.bin/sort/stests,v
retrieving revision 1.4
diff -u -r1.4 stests
--- stests      12 Dec 2008 15:45:51 -0000      1.4
+++ stests      20 Jan 2010 18:21:22 -0000
@@ -72,7 +72,7 @@
 
        X=$1; shift
 
-       if sort "$@" in >xx  &&  sort -c "$@" xx 
+       if sort -H "$@" in >xx  &&  sort -c "$@" xx 
        then 
                if test -f out
                then

Reply via email to