To make this even simpler:
joshi{blu}237:; uname -a
SunOS joshi 5.11 snv_122 sun4u sparc SUNW,Sun-Fire-280R
joshi{blu}245:; ksh
$ cd /bin
$ cd ../lib/firefox
ksh: ../lib/firefox: not found
$ ls -ld ../lib/firefox
drwxr-xr-x 13 root bin 34 Aug 28 2009 ../lib/firefox
$ pwd
/bin
$ /bin/pwd
/usr/bin
$
So the problem is that ksh and ksh93 keep track of the "user" view of
the cwd, and so ../lib means /lib and not /usr/lib as you would suppose.
On 03/14/10 12:45, Juergen Keil wrote:
> Hi,
>
> [ From: http://defect.opensolaris.org/bz/show_bug.cgi?id=15179 ]
>
>
> I tried to install Acrobat Reader 9.3.1 on OpenSolaris dev build 134,
> but it fails in the middle of adobe's install script.
>
> Adobes install script enters an endless recursion with ksh93,
> but works ok with /usr/has/bin/sh.
>
>
> The following script reproduces the problem; it fails with ksh93,
> but works with bourne shell:
>
> % cat /tmp/acro.sh
> GetAbsoluteFileName()
> {
> if [ -h "$1" ]
> then
> CURRENT_PATH=`pwd`
> cd `dirname $1`
> COMPLETE_PATH=`ls -l $1 | awk '{ print $NF }'`
> COMPLETE_PATH_DIR=`dirname $COMPLETE_PATH`
> COMPLETE_PATH_FILE=`basename $COMPLETE_PATH`
> cd $COMPLETE_PATH_DIR
> COMPLETE_PATH_DIR=`pwd`
> cd "$CURRENT_PATH"
> GetAbsoluteFileName ${COMPLETE_PATH_DIR}/${COMPLETE_PATH_FILE}
> else
> echo "$1"
> return 0
> fi
> }
>
> GetAbsoluteFileName /bin/firefox
>
> % /usr/has/bin/sh /tmp/acro.sh
> /usr/lib/firefox/firefox
>
>
> Ok.
>
>
> But with ksh93 this ends in an endless recursion and core dumps ksh93.
>
> % /bin/sh -x /tmp/acro.sh |& more
> + GetAbsoluteFileName /bin/firefox
> + [ -h /bin/firefox ]
> + pwd
> + CURRENT_PATH=/tmp
> + dirname /bin/firefox
> + cd /bin<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> + ls -l /bin/firefox
> + awk '{ print $NF }'
> + COMPLETE_PATH=../lib/firefox/firefox
> + dirname ../lib/firefox/firefox
> + COMPLETE_PATH_DIR=../lib/firefox
> + basename ../lib/firefox/firefox
> + COMPLETE_PATH_FILE=firefox
> + cd ../lib/firefox<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> /tmp/acro.sh[10]: cd: ../lib/firefox: [No such file or directory]
> + pwd
> + COMPLETE_PATH_DIR=/bin
> + cd /tmp
> + GetAbsoluteFileName /bin/firefox
> ....
>
>
> So, the question is: why doesn't "cd ../lib/firefox" work
> with ksh93 from the "/bin" directory?
>
>
> % truss -t chdir /bin/sh /tmp/acro.sh
> Received signal #18, SIGCLD, in waitid() [caught]
> siginfo: SIGCLD CLD_EXITED pid=7545 status=0x0000
> chdir("/bin") = 0
> Received signal #18, SIGCLD, in waitid() [caught]
> siginfo: SIGCLD CLD_EXITED pid=7546 status=0x0000
> Received signal #18, SIGCLD [caught]
> siginfo: SIGCLD CLD_EXITED pid=7549 status=0x0000
> Received signal #18, SIGCLD [caught]
> siginfo: SIGCLD CLD_EXITED pid=7550 status=0x0000
> chdir("/lib/firefox") Err#2 ENOENT
> /tmp/acro.sh[13]: cd: ../lib/firefox: [No such file or directory]
>
>
> Why does ksh93 use a chdir to "/lib/firefox", and not "../lib/firefox" ?
> _______________________________________________
> shell-discuss mailing list
> shell-discuss at opensolaris.org
> http://mail.opensolaris.org/mailman/listinfo/shell-discuss
--
blu
It's bad civic hygiene to build technologies that could someday be
used to facilitate a police state. - Bruce Schneier
----------------------------------------------------------------------
Brian Utterback - Solaris RPE, Oracle Corporation.
Ph:877-259-7345, Em:brian.utterback at oracle.com