From owner-freebsd-sparc64@freebsd.org Wed Mar 30 01:00:24 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 A2283AE2ABA for ; Wed, 30 Mar 2016 01:00:24 +0000 (UTC) (envelope-from akranzel@gmail.com) Received: from mail-pf0-x22e.google.com (mail-pf0-x22e.google.com [IPv6:2607:f8b0:400e:c00::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 767811DDA for ; Wed, 30 Mar 2016 01:00:24 +0000 (UTC) (envelope-from akranzel@gmail.com) Received: by mail-pf0-x22e.google.com with SMTP id n5so28105958pfn.2 for ; Tue, 29 Mar 2016 18:00:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-transfer-encoding:mime-version:subject:message-id:date :to; bh=LElqQBieiCqZbq935LIsngvsCv2on2/c3Rsx7M0sPDc=; b=ik/SseGgHyEHrNMlBaazRbMJvigokYsswiN5Ib7/ywcoyUZyDB8xDGkaC1rUe3scDR yvU/0mtSehS89+tqd2QOOGl0Y/vApLoeE/CHzqnZeavIWCdxZnXm0h43VMvBZNS7uGTu q9Xnf7YSxniO5vFdkdN9S8ku8h7rNugvf+QMQnvOl0VA8JcsZH8aZmENyXaRNA9GDXmr Jsd7cqtz29E50tyXBdExz3BrU6rbV2BHJn/gVVDLjPIqkMhTeRWIvtidRjtozj5euclM NpqK7StRiDG1ooUgoyfZmkK40A44sHeimjqCjSBigF3b0YDstvE2rOAqeKCkI78ysHuZ dBeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:content-transfer-encoding:mime-version :subject:message-id:date:to; bh=LElqQBieiCqZbq935LIsngvsCv2on2/c3Rsx7M0sPDc=; b=XL5aHBpsjsxsy2Ta2hgfnVYQ0tirK0hLv4gKL2s3R2a2RY03ZwUWvQwQ1lGhb/ILzE +wGBbmxkcHqiZpJktQh1bU63bQK+mn7bKhV4osnzcFuNVbBYGXgpaGbnJtllzhr3ol5o uokbDimGvvocbnPYqdvEWAaNR9ODMUtcFP3AHeU/OqQ6SrqVe5dDSqXKBIw0i4f/gPiD z9pHvIwBDZ/Vc3l4B9Y5RcppaESNThWngYIx7RM7dgrwNWfwpXfVpxy2Gs4B/s4yCqc9 tugv5IH9yqwtUBS7mxCZkVSd82OSaamwrSIIagwzc5Npp4ljFIMbSiGvxapVIxiyoq/q jK5g== X-Gm-Message-State: AD7BkJIj6/AMQdujIdR2OHAxB1Y+o6jpiorIwMYllxOoWfE+v61LN6pUSgUsdFrduPHVhQ== X-Received: by 10.98.74.209 with SMTP id c78mr8239552pfj.90.1459299623728; Tue, 29 Mar 2016 18:00:23 -0700 (PDT) Received: from ?IPv6:2600:1010:b11e:4411:9c55:a2d:9639:57aa? ([2600:1010:b11e:4411:9c55:a2d:9639:57aa]) by smtp.gmail.com with ESMTPSA id t78sm1050107pfi.55.2016.03.29.18.00.22 for (version=TLSv1/SSLv3 cipher=OTHER); Tue, 29 Mar 2016 18:00:22 -0700 (PDT) From: Adam Kranzel Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (1.0) Subject: Free E420R server in Oakland, CA. Message-Id: Date: Tue, 29 Mar 2016 18:00:21 -0700 To: freebsd-sparc64@freebsd.org X-Mailer: iPhone Mail (13E233) 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: Wed, 30 Mar 2016 01:00:24 -0000 Hi y'all. I've got a Sun E420R server that I have no use for anymore. The machine has n= o frame buffer or hard drives, but it did work last time I fired it up a few= years ago. Free for the taking, but you'll need to pick it up. I've also got a large Su= n monitor that should work with it if you install a frame buffer. Both the computer and monitor are ridiculously heavy, so you might want to b= ring a friend to help carry them.=20 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 +========================================================+ From owner-freebsd-sparc64@freebsd.org Thu Mar 31 07:23:13 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 450C8AE306F for ; Thu, 31 Mar 2016 07:23:13 +0000 (UTC) (envelope-from j@uriah.heep.sax.de) Received: from uriah.heep.sax.de (uriah.heep.sax.de [IPv6:2a01:170:1047::9]) by mx1.freebsd.org (Postfix) with ESMTP id 0D506128F for ; Thu, 31 Mar 2016 07:23:13 +0000 (UTC) (envelope-from j@uriah.heep.sax.de) Received: by uriah.heep.sax.de (Postfix, from userid 107) id 702D43E71; Thu, 31 Mar 2016 09:23:03 +0200 (CEST) Date: Thu, 31 Mar 2016 09:23:03 +0200 From: Joerg Wunsch To: freebsd-sparc64@freebsd.org Cc: Shigeharu TAKENO Subject: Re: /usr/bin/sort may be incorrect Message-ID: <20160331072303.GP53011@uriah.heep.sax.de> Reply-To: Joerg Wunsch References: <201603250229.u2P2TVLp003567@pc98tak.iee.niit.ac.jp> <201603310446.u2V4kLGM003303@pc98tak.iee.niit.ac.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201603310446.u2V4kLGM003303@pc98tak.iee.niit.ac.jp> X-Phone: +49-351-2012 669 X-PGP-Fingerprint: DC 47 E6 E4 FF A6 E9 8F 93 21 E0 7D F9 12 D6 4E X-GPG-Fingerprint: 5E84 F980 C3CA FD4B B584 1070 F48C A81B 69A8 5873 User-Agent: Mutt/1.5.23 (2014-03-12) 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 07:23:13 -0000 As Shigeharu TAKENO wrote: > 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 > }; Well, depending on how the storage for the elements is reserved, this might allocate too much memory (one struct key_hint too much). Not a big problem though, I guess. Declaring the trailing array member of a struct as 0-sized used to be a private GCC extension. C99 standardized it in a somewhat different way: struct key_value { struct bwstring *k; struct key_hint hint[]; }; If that works for you, too, I think it would be the preferrable way to write it. > 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. Are you saying that something like struct key_value *kw; ... kw->hint[-1] = something; happens? That would certainly be a bug in the code then that ought to be fixed, rather than worked around. -- cheers, Joerg .-.-. --... ...-- -.. . DL8DTL http://www.sax.de/~joerg/ Never trust an operating system you don't have sources for. ;-) From owner-freebsd-sparc64@freebsd.org Thu Mar 31 11:22:29 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 13740AE4F8A for ; Thu, 31 Mar 2016 11:22:29 +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 B373717DD for ; Thu, 31 Mar 2016 11:22:28 +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 u2VBMPgC000717; Thu, 31 Mar 2016 20:22:26 +0900 (JST) Received: (from shige@localhost) by pc98tak.iee.niit.ac.jp (8.15.2/8.15.2/Submit) id u2VBMPam007017; Thu, 31 Mar 2016 20:22:25 +0900 (JST) (envelope-from shige@iee.niit.ac.jp) Date: Thu, 31 Mar 2016 20:22:25 +0900 (JST) Message-Id: <201603311122.u2VBMPam007017@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 Cc: Joerg Wunsch Subject: Re: /usr/bin/sort may be incorrect In-Reply-To: <20160331072303.GP53011@uriah.heep.sax.de> References: <201603250229.u2P2TVLp003567@pc98tak.iee.niit.ac.jp> <201603310446.u2V4kLGM003303@pc98tak.iee.niit.ac.jp> <20160331072303.GP53011@uriah.heep.sax.de> 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 11:22:29 -0000 shige 03/31 2016 ---------------- Thank you for your reply. Joerg Wunsch wrote: | struct key_value | { | struct bwstring *k; | struct key_hint hint[]; | }; | | If that works for you, too, I think it would be the preferrable way to | write it. Unfortunately this does not fix the problem. | > 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. | | Are you saying that something like | | struct key_value *kw; | | ... | | kw->hint[-1] = something; | | happens? That would certainly be a bug in the code then that ought to | be fixed, rather than worked around. I tested under your suggestion "struct key_hint hint[]", which behaves as the same of default sort command. % ( echo 2 5 8 ; echo 2 6 5 ) | sort -n +0 -1 +1 -2 +2 -3 In key_coll(struct keys_array *ps1, struct keys_array *ps2, size_t offset) (in coll.c), initial pointer values are the followings: &(ps1->key[0]) = 0x40c140f8 &(ps1->key[1]) = 0x40c14100 &(ps1->key[2]) = 0x40c14108 &(ps2->key[0]) = 0x40c14088 &(ps2->key[1]) = 0x40c14090 &(ps2->key[2]) = 0x40c14198 (the pointer repeat is only 8 byte.) ps1->key[0].k = 0x40c060e0 ps1->key[1].k = 0x40c060f0 ps1->key[2].k = 0x40c06100 ps2->key[0].k = 0x40c060a0 ps2->key[1].k = 0x40c060b0 ps2->key[2].k = 0x40c060c0 key_coll() calls sm->func() = numcoll(), and it uses numcoll_impl(struct key_value *kv1, struct key_value *kv2) with ps1->key[i] and ps2->key[i]. The function numcoll_impl() uses k field and hint field of struct key_value. For i = 0, the k field pointers of arguments kv1 and kv2 of numcoll_impl() are correct: kv1->k = 0x40c060e0, kv2->k = 0x40c060a0 but the hint field pointers of kv1, kv2 are doughtful: &(kv1->hint) = 0x40c14100, &(kv2->hint) = 0x40c14090 which are the same value of &(ps1->key[1]) and &(ps2->key[1]). And for i = 1, the k field pointers of arguments kv1 and kv2 become incorrect: kv1->k = 0x140c060f0, kv2->k = 0x140c060b0 which are added 0x100000000 to the original pointer value. The sort command stops where it uses the value. If we use the definition "struct key_hint hint[1]", the repeat of pointers of ps1->key[i] becomes 32 byte, and incorrect changes of pointers do not occur. &(ps1->key[0]) = 0x40c08208 &(ps1->key[1]) = 0x40c08228 &(ps1->key[2]) = 0x40c08248 +========================================================+ Shigeharu TAKENO NIigata Institute of Technology kashiwazaki,Niigata 945-1195 JAPAN shige@iee.niit.ac.jp TEL(&FAX): +81-257-22-8161 +========================================================+