Subject: Re: Solaris /bin/sh severely broken (once again) (was: Re: Making pkgsrc more robust)
To: None <Gilles.Dauphin@enst.fr, rillig@NetBSD.org>
From: Gilles Dauphin <Gilles.Dauphin@enst.fr>
List: tech-pkg
Date: 02/08/2006 11:06:55
> From: Roland Illig <rillig@NetBSD.org>
>
>
> 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"
OR
if [ -d "$dbdir" ]; 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