Subject: Re: pkg/36257 (games/wesnoth has msgfmt problems (plurals) [NetBSD 3.0])
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: Joerg Sonnenberger <joerg@britannica.bec.de>
List: pkgsrc-bugs
Date: 05/09/2007 16:20:04
The following reply was made to PR pkg/36257; it has been noted by GNATS.

From: Joerg Sonnenberger <joerg@britannica.bec.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/36257 (games/wesnoth has msgfmt problems (plurals) [NetBSD 3.0])
Date: Wed, 9 May 2007 18:16:57 +0200

 On Wed, May 09, 2007 at 04:10:04PM +0000, Robert Elz wrote:
 >  That is, in a test like
 >  
 >  	if test "$pofile" != "-"
 >  
 >  if the value of $pofile just happens to be "-e" or something like
 >  that, bad things happen (ie: nothing works the way you want, and
 >  usually the result is a bunch of strange error messages.)
 
 Are you sure?
 
 % test "-e" != "-" && echo ok
 ok
 
 >  The usual fix is to protect at least the leading edge of the variable value,
 >  so it cannot possibly accidentally become a test operator, I like
 >  to do it like ...
 >  
 >  	if test "%${pofile}%" != "%-%"
 
 Read the specification for test. The operator order is far from trivial,
 but most cases of using prefix values serve the purpose of hacking
 around Solaris /bin/sh bugs with empty arguments and the like.
 
 >  To avoid that kind of problem, and especially these days with test being
 >  a built in command in every (Bourne type) shell worth mentioning, it is
 >  generally easier to use shell logical operators (&& and ||) and simply
 >  run multiple test commands.
 
 Avoiding -a and -o is a good thing, yes. That's different from this
 though.
 
 Joerg