Date: Sat, 10 Oct 2020 20:08:48 -0400 From: Rich Felker <dalias@...c.org> To: musl@...ts.openwall.com Subject: Re: [PATCH 2/2] configure: improve portability of test command On Sat, Oct 10, 2020 at 06:51:10PM +0000, Issam E. Maghni wrote: > > The two commands: > > test "$1" > > test ! "$1" > > could not be used reliably on some historical systems. Unexpected results > > would occur if such a string expression were used and $1 expanded to '!', '(', > > or a known unary primary. Better constructs are: > > test -n "$1" > > test -z "$1" > > respectively. > > Historical systems have also been unreliable given the common construct: > > test "$response" = "expected string" > > One of the following is a more reliable form: > > test "X$response" = "Xexpected string" > > test "expected string" = "$response" > https://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html#tag_20_128_16 The text you've quoted is about non-conforming, pre-POSIX systems. Is there an actual system where you're encoutering this problem? It's always been the intent to assume a POSIX-conforming shell and utilities for configure, and to require the user to upgrade to one if they don't have one, because supporting non-conforming shell/utilities is an endless game of whack-a-mole. Rich
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.