can you run the script with all
        pwd
changed to
        pwd -P

if pwd -P works then the installation script assumes semantics
of pwd(1) not guaranteed by the standard (and -P provides
the assumed semantics)

On Sun, 14 Mar 2010 17:45:37 +0100 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

Reply via email to