Subject: Solaris /bin/sh severely broken (once again) (was: Re: Making pkgsrc
To: Gilles Dauphin <Gilles.Dauphin@enst.fr>
From: Roland Illig <rillig@NetBSD.org>
List: tech-pkg
Date: 02/07/2006 22:41:45
Gilles Dauphin wrote:
> And please look at pre-build : 
>  if you don't use pkgview you don't have /usr/pkg/vulnerable
>  and the pre-build break at line:
>  
>         if cd "$dbdir" 1>/dev/null 2>&1; then  <--- THIS BREAK THE BULK

Thanks for noting this. By the way, you forgot to mention that this only 
happens on Solaris. With a POSIX shell, this code works perfectly. :)

I fixed it by replacing the code with this:

if (cd "$dbdir" 1>/dev/null 2>&1); then
     cd "$dbdir"

This will make the subshell return an error code, and in case the 
subshell could change the directory, the parent shell is very likely to 
be able to do the same.

Roland