Subject: Re: toolchain/30842: build.sh fails with mksh
To: None <toolchain-manager@netbsd.org, gnats-admin@netbsd.org,>
From: Alan Barrett <apb@cequrux.com>
List: netbsd-bugs
Date: 07/27/2005 07:20:02
The following reply was made to PR toolchain/30842; it has been noted by GNATS.

From: Alan Barrett <apb@cequrux.com>
To: gnats-bugs@NetBSD.org, netbsd-bugs@NetBSD.org
Cc: 
Subject: Re: toolchain/30842: build.sh fails with mksh
Date: Wed, 27 Jul 2005 09:16:41 +0200

 On Wed, 27 Jul 2005, Martin Husemann wrote:
 > On Tue, Jul 26, 2005 at 10:13:31PM +0200, Alan Barrett wrote:
 > > Can we solve this problem without adding more special cases to build.sh
 > > by just adding backslashes in appropriate places, so it doesn't matter
 > > whether or not the shell does brace expansion?
 > 
 > Doesn't this mean this shell is broken from a posix point of view
 
 Yes, I think so, but I thought we could work around it.  I was wrong.
 
 > and with your change build.sh should fail on a strictly confirming
 > shell?
 
 I don't know what POSIX says, but all the shells I tested failed.
 
 > IIUC in this case the rules for double quotes apply:
 > 
 >   The backslash shall retain its special meaning as an escape character [..]
 >   only when followed by one of the following characters when considered
 >   special:
 > 
 >        $   `   "   \   <newline>
 
 The sh(1) man page says
 
      the text is subjected to parameter expansion, command substitution,
      and arithmetic expansion (as described in the section on
      ``Expansions'').
 
 without mentioning anything about backslashes.  But testing several shells
 available to me shows that they all treat \{ literally.  So my idea won't
 work in practice, regardless of what POSIX says.
 
 --apb (Alan Barrett)