Subject: PR: bin/12138 [Was: sort crashes]
To: None <itojun@iijlab.net>
From: Mark White <mark.white@st-edmund-hall.oxford.ac.uk>
List: current-users
Date: 02/15/2001 17:07:05
itojun@iijlab.net writes:
> 
> >[Sorry, more traffic] In fact, I've just discovered the
> >problem... it crashes when it has no data to sort (first
> >character it reads is EOF).  I'll [maybe fix and] send-pr.
> 
> 	I guess that problem was solved by usr.bin/sort/fsort.c,
> 	revision 1.12.  please try the latest code.

[I was running 1.12] ... ah, I see.  This error now only
occurs for filter mode

  touch /tmp/emptyfile
  cat emptyfile | sort -f

Stace trace follows.

Mark <><

-- snip --

GNU gdb 4.17
Copyright 1998 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 "i386--netbsd"...
Core was generated by `sort'.
Program terminated with signal 10, Bus error.
Reading symbols from /usr/libexec/ld.elf_so...done.
Reading symbols from /usr/lib/libc.so.12...done.
#0  0x804a341 in putline (rec=0xfffffff8, fp=0x480fd300)
    at /usr/src/usr.bin/sort/files.c:332
332             EWRITE(rec->data+rec->offset, 1, rec->length - rec->offset, fp);
(gdb) where
#0  0x804a341 in putline (rec=0xfffffff8, fp=0x480fd300)
    at /usr/src/usr.bin/sort/files.c:332
#1  0x80492e6 in append (keylist=0x8064000, nelem=0, depth=8, fp=0x480fd300, 
    put=0x804a338 <putline>, ftbl=0xbfbfd1f4)
    at /usr/src/usr.bin/sort/append.c:131
#2  0x804a9db in fsort (binno=-1, depth=0, top=0, filelist=0xbfbfd1f0, 
    nfiles=1, outfp=0x480fd300, ftbl=0xbfbfd1f4)
    at /usr/src/usr.bin/sort/fsort.c:212
#3  0x804ca54 in main (argc=3, argv=0xbfbfd3ec)
    at /usr/src/usr.bin/sort/sort.c:268
#4  0x8048d49 in ___start ()
(gdb)