Re: /usr/bin/sort may be incorrect

Shigeharu TAKENO <[email protected]>
Newsgroups gmane.os.freebsd.devel.sparc
Message-ID <[email protected]>
shige 03/31 2016
----------------

I wrote:
|   command line "sort -k3n -k1n file" : 
|     FreeBSD/i386    : succeed (output sorted lines) 
|     FreeBSD/sparc64 : failed  (output no line) 
| 
|   command line "sort -k3n file" : 
|     FreeBSD/i386    : succeed (output sorted lines) 
|     FreeBSD/sparc64 : succeed (output sorted lines) 

|   command line 
|    "( echo 2 5 8 ; echo 2 6 5 ) | sort -n +0 -1 +1 -2 +2 -3 -c" :
|     FreeBSD/i386    : return status 0
|     FreeBSD/sparc64 : return status 255


I found the workaround for the problem:

----- From here -----
--- /usr/src/usr.bin/sort/coll.h.ORG	2016-03-31 13:23:24.226753000 +0900
+++ /usr/src/usr.bin/sort/coll.h	2016-03-31 13:24:23.469436000 +0900
@@ -90,7 +90,11 @@
 struct key_value
 {
 	struct bwstring		*k; /* key string */
+#if 0
 	struct key_hint		 hint[0]; /* key sort hint */
+#else
+	struct key_hint		 hint[1]; /* key sort hint */
+#endif
 };
 
 /*
----- To here -----

The k field of key_value may be overwritten by the hint field
in numcoll_impl(), gnumcoll() and monthcoll() (coll.c), and the
pointer value of k may change to incorrect value.

I could build shells/pdksh and x11-themes/fvwm-themes by new sort
command applied the patch above.

+========================================================+
 Shigeharu TAKENO     NIigata Institute of Technology
                       kashiwazaki,Niigata 945-1195 JAPAN
 [email protected]   TEL(&FAX): +81-257-22-8161
+========================================================+
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-sparc64
To unsubscribe, send any mail to "[email protected]"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.