On Tue, Dec 17, 2002 at 06:51:00PM +0000, [EMAIL PROTECTED] wrote:
> On a machine I administrate I recently discovered an entry in
> /etc/profile.d/oracle.sh:
>
> export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/oracle/OraHome1/lib
>
> I noticed today that this leaves the value of LD_LIBRARY_PATH as:
>
> :/home/oracle/OraHome1/lib
[ ... ]
> If the desired effect is really to have shared libraries loaded from
> whatever the current directory is, then the administrator should add
> the single dot . to LD_LIBRARY_PATH.
But isn't a . in LD_LIBRARY_PATH the same as an empty entry.
Or anyway, just as insecure?
What the original script should do is append to LD_LIBRARY_PATH
only if it is already defined. It's quite a common mistake I fear.
Scripts should do:
LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}$ORACLE_HOME/lib
Which is the same as
if [ -n "$LD_LIBRARY_PATH" ]
then
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/lib
else
LD_LIBRARY_PATH=$ORACLE_HOME/lib
fi
Even Oracle's own oraenv script gets it wrong, but at least it
leaves the empty entry at the end.
Matt