4.3BSD sort(1) broken for records with embedded nulls

John P. Linderman jpl at allegra.UUCP
Fri Aug 22 01:07:59 AEST 1986


In article <491 at carina.noao.UUCP> grandi at noao.UUCP (Steve Grandi) writes:
  >Description:
  >	For 4.3BSD, sort(1) was modified (for efficiency) to use fgets/fputs to
  >read and write data records instead of getc/putc.  This change breaks sort
  >for data records that have embedded nulls; they will generate spurious error 
  >messages "missing newline before EOF" and the data will be totally scrambled.
Sort has never tolerated nulls gracefully.  The way the -u (unique) option
suppresses duplicates is by clobbering the first byte of the record with a
null, and, if you look at line 363 of the 4.3 sort, you'll see that ANY line
that starts with a null will not be written out.  This ``feature'' was
removed in the sort Terry Crowley and I worked over, so I presume it is
also true of recent Sys V sorts.
  >Repeat-By:
  >	Read the code.
I wouldn't wish that on my worst enemy.

John P. Linderman  Department of Marginal Merges and Sordid Sorts  allegra!jpl



More information about the Comp.unix.wizards mailing list