Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 31 Mar 2016 13:46:21 +0900 (JST)
From:      Shigeharu TAKENO <shige@iee.niit.ac.jp>
To:        freebsd-sparc64@freebsd.org
Subject:   Re: /usr/bin/sort may be incorrect
Message-ID:  <201603310446.u2V4kLGM003303@pc98tak.iee.niit.ac.jp>
In-Reply-To: <201603250229.u2P2TVLp003567@pc98tak.iee.niit.ac.jp>
References:  <201603250229.u2P2TVLp003567@pc98tak.iee.niit.ac.jp>

next in thread | previous in thread | raw e-mail | index | archive | help
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
 shige@iee.niit.ac.jp   TEL(&FAX): +81-257-22-8161
+========================================================+



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201603310446.u2V4kLGM003303>