From owner-freebsd-sparc64@freebsd.org Thu Mar 31 04:46:31 2016 Return-Path: Delivered-To: freebsd-sparc64@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4D3CAAE4131 for ; Thu, 31 Mar 2016 04:46:31 +0000 (UTC) (envelope-from shige@iee.niit.ac.jp) Received: from nolm01.iee.niit.ac.jp (nolm01.iee.niit.ac.jp [202.243.124.21]) by mx1.freebsd.org (Postfix) with ESMTP id E8CA91EA6 for ; Thu, 31 Mar 2016 04:46:29 +0000 (UTC) (envelope-from shige@iee.niit.ac.jp) Received: from pc98tak.iee.niit.ac.jp (pc98tak.iee.niit.ac.jp [202.243.124.33]) by nolm01.iee.niit.ac.jp (8.15.2/8.15.2) with ESMTP id u2V4kLis022177; Thu, 31 Mar 2016 13:46:21 +0900 (JST) Received: (from shige@localhost) by pc98tak.iee.niit.ac.jp (8.15.2/8.15.2/Submit) id u2V4kLGM003303; Thu, 31 Mar 2016 13:46:21 +0900 (JST) (envelope-from shige@iee.niit.ac.jp) Date: Thu, 31 Mar 2016 13:46:21 +0900 (JST) Message-Id: <201603310446.u2V4kLGM003303@pc98tak.iee.niit.ac.jp> X-Authentication-Warning: pc98tak.iee.niit.ac.jp: shige set sender to shige@iee.niit.ac.jp using -f From: Shigeharu TAKENO To: freebsd-sparc64@freebsd.org Subject: Re: /usr/bin/sort may be incorrect In-Reply-To: <201603250229.u2P2TVLp003567@pc98tak.iee.niit.ac.jp> References: <201603250229.u2P2TVLp003567@pc98tak.iee.niit.ac.jp> User-Agent: SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL/10.8 Emacs/20.7 (i386-unknown-freebsd10.2) MULE/4.0 (HANANOEN) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Mar 2016 04:46:31 -0000 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 +========================================================+