[Shipwright] more problems with shipwright-*-wrapper on solaris

Andrew Cobaugh phalenor at gmail.com
Wed Jun 30 15:50:37 EDT 2010


On Wed, Jun 30, 2010 at 3:34 PM, Andy Cobaugh <phalenor at gmail.com> wrote:
>
> 2 problems:
>
> 1) This line doesn't populate LINK as expected:
>
>    test -h $0 && LINK=`ls -l $0 | awk -F\>  '{print $NF}'
>
> it ends up with a space in fron, like this
>
>    " ../etc/shipwright-script-wrapper"
>
> which of course breaks things further down. To fix this, I've done something
> like this:
>
>    test -h $0 && LINK=`ls -l $0 | awk -F\>  '{print $NF}' | sed -e 's/^ //'`
>
> What I did when we originally saw this on our current installation was use
> the readlink provided with in /opt/sfw, but we can't rely on /opt/sfw
> (provided by the Solaris Companion CD) to exist in the general case.
>
> 2) With 'real' /bin/sh, variables must be export'd in order for
> sub-processes to see them, so something like this won't work on solaris:
>
>    PERL5LIB=foo ./myProgram.pl
>
> As a result, solaris doesn't get the correct PERL5LIB set up for it, among
> other things. To fix this, I've made the env variable declarations on
> separate lines, with a final export line, like this:
>
>    export PATH PERL5LIB LD_LIBRARY_PATH DYLD_LIBRARY_PATH
>
> followed by the exec line.

Actually, I misspoke. The problem is the exec builtin. /bin/sh's exec
on solaris must create a completely new environment, whereas bash
probably copies the environment from the calling process. Either way,
the fix is simply to export those variables.

--andy


More information about the Shipwright mailing list