On Mon, 31 Jul 2000, Kris Kennaway wrote:
> The following no longer seems to work on any of my 5.0 boxes:
>
> ls -l | sort -n -k 5
>
> which should sort numerically by the size column (instead it seems to do
> the same thing as sort -n). It works correctly on 3.x and 4.x boxes.
>
> Anyone have ideas?
Sure:
{"/home/green"}$ ls -l | MALLOC_OPTIONS=AJ sort -nk5 | tail -10 | head -5
drwxr-xr-x 13 green green 512 Jun 7 1999 saint-1.4
drwxr-xr-x 16 green green 512 Aug 5 1999 stress
drwxr-xr-x 17 green green 512 Feb 14 23:27 ioccc
drwxr-xr-x 17 green www 1536 Jul 30 18:39 public_html
drwxr-xr-x 21 green green 1024 Feb 7 1999 descent
{"/home/green"}$ ls -l | MALLOC_OPTIONS=aj sort -nk5 | tail -10 | head -5
-rwx------ 1 green green 31017984 Jan 19 2000 quake1.tar.gz
-rw-r--r-- 1 green green 32642085 Jun 25 00:31 mail.tar.gz
-rw-rw-rw- 1 green green 47845836 Jun 26 18:52 ccs12.rm
-rw-r--r-- 1 green green 52525668 Jun 5 21:30 SaberMarionetteJ-ep04.rm
-rw-r--r-- 1 green green 53822026 Jul 11 07:53 SaberMarionetteJ-ep02.rm
To fix this particular bug, the patch is:
Index: sort.c
===================================================================
RCS file: /usr2/ncvs/src/gnu/usr.bin/sort/sort.c,v
retrieving revision 1.15
diff -u -r1.15 sort.c
--- sort.c 1999/04/25 22:14:05 1.15
+++ sort.c 2000/07/31 11:26:33
@@ -1860,6 +1860,7 @@
insertkey (key);
key = (struct keyfield *)
xmalloc (sizeof (struct keyfield));
+ bzero(key, sizeof(*key));
key->eword = -1;
key->ignore = NULL;
key->translate = NULL;
I'm doubtful it's the only one of it's kind in GNU sort(1). Time for BSD
sort(1)?
> Kris
>
> --
> In God we Trust -- all others must submit an X.509 certificate.
> -- Charles Forsythe <[EMAIL PROTECTED]>
--
Brian Fundakowski Feldman \ FreeBSD: The Power to Serve! /
[EMAIL PROTECTED] `------------------------------'
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message