On 7/26/25 12:32, Farblos wrote:
Hi list,
not sure whether I'm seeing pink elephants here, or whether this is
already documented somewhere in the autoconf manual.
TL;DR I have on Solaris 10:
# "echo foo" not executed in case of failure?!
$ cd /foo || echo foo
/foo: does not exist
You're not imagining it, /bin/sh on Solaris 10 is an ancient copy of
the Bourne shell (I believe from SVR4, but possibly older, definitely
pre-POSIX.1-1988), and it is known to stop executing commands when cd fails.
A very old bug in the Solaris bug database, originally filed in 1994 against
both SunOS 4.1.3_U1 and Solaris 2.3 claims that this is intentional behavior:
This is the historic behaviour of the Bourne shell if built-in commands
("cd", ".") fail. This was intended to prevent damage in simple-minded
shell scripts:
# simple script
cd /tmp
rm -rf *
In the script above, all data of the current directory will be removed
if the initial "cd" fails. The Bourne shell /bin/sh will not
execute "rm -rf *", but the newer KornShell /bin/ksh will.
and thus it was decided not to change it, and to recommend scripts call
test -d first to protect against it.
Solaris 11 (tested on i86pc, not SPARC, though) behaves as expected
with respect to this.
/bin/sh on Solaris 11 is ksh93, not the Bourne shell.
(The Bourne shell may be installed as /usr/sunos/bin/sh if the admin
installed the optional package containing it.)
--
-Alan Coopersmith- alan.coopersm...@oracle.com
Oracle Solaris Engineering - https://blogs.oracle.com/solaris