From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1LtkpU-00056t-51 for mharc-grub-devel@gnu.org; Tue, 14 Apr 2009 11:45:44 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LtkpS-00056I-6c for grub-devel@gnu.org; Tue, 14 Apr 2009 11:45:42 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LtkpQ-00055Y-JY for grub-devel@gnu.org; Tue, 14 Apr 2009 11:45:41 -0400 Received: from [199.232.76.173] (port=47252 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LtkpQ-00055V-GB for grub-devel@gnu.org; Tue, 14 Apr 2009 11:45:40 -0400 Received: from mail.nexedi.com ([91.121.25.85]:36919 helo=nexedi.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LtkpQ-00035M-11 for grub-devel@gnu.org; Tue, 14 Apr 2009 11:45:40 -0400 Received: from [10.8.0.46] (unknown [10.8.0.46]) by nexedi.com (Postfix) with ESMTP id AE98E3DE2E for ; Tue, 14 Apr 2009 17:45:37 +0200 (CEST) From: "Yoshinori K. Okuji" Organization: enbug.org To: The development of GRUB 2 Date: Wed, 15 Apr 2009 00:45:45 +0900 User-Agent: KMail/1.9.10 References: <20090411005826.oahebrl8ys0w0o0k-cebfxv@webmail.spamcop.net> <200904111919.22519.okuji@enbug.org> <20090411091658.bv4254n00sk00000-cebfxv@webmail.spamcop.net> In-Reply-To: <20090411091658.bv4254n00sk00000-cebfxv@webmail.spamcop.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200904150045.46154.okuji@enbug.org> X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: Re: [PATCH] Fix target tool check logic X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Apr 2009 15:45:42 -0000 On Saturday 11 April 2009 22:16:58 Pavel Roskin wrote: > Quoting "Yoshinori K. Okuji" : > > "test -n" should be avoided. Maybe this is not necessary nowadays, but my > > old lesson was to use "test x$target_alias != x" instead for portability. > > Well, "!=" was not very portable, either, maybe. > > I believe both "-n" and "!=" are found in Autoconf sources that are > turned into configure scripts. Anyway, I'll use the syntax you want. Even if this looks obsolete, I think it is better to follow the chapter "Limitations of Builtins" in the autoconf manual: `test' (strings) Posix says that `test "STRING"' succeeds if STRING is not null, but this usage is not portable to traditional platforms like Solaris 10 `/bin/sh', which mishandle strings like `!' and `-n'. Posix also says that `test ! "STRING"', `test -n "STRING"' and `test -z "STRING"' work with any string, but many shells (such as Solaris, AIX 3.2, UNICOS 10.0.0.6, Digital Unix 4, etc.) get confused if STRING looks like an operator: $ test -n = test: argument expected $ test ! -n test: argument expected Similarly, Posix says that both `test "STRING1" = "STRING2"' and `test "STRING1" != "STRING2"' work for any pairs of strings, but in practice this is not true for troublesome strings that look like operators or parentheses, or that begin with `-'. It is best to protect such strings with a leading `X', e.g., `test "XSTRING" != X' rather than `test -n "STRING"' or `test ! "STRING"'. Regards, Okuji