env.sh: Don't add trailing colons to paths

If $LD_LIBRARY_PATH is originally empty, then it becomes "$pfx/lib:" - but the trailing colon adds the current directory to the path.

This breaks horribly if you try to run r2 from a directory that also happens to have a `libc.so.6` in it :P
This commit is contained in:
Brandon Lin 2024-05-23 02:14:20 -07:00 committed by pancake
parent 6843b21435
commit c3c3b16cd2

10
env.sh
View File

@ -25,11 +25,11 @@ fi
new_env='
R2_ENV_IS_SET=1
R2_LIBR_PLUGINS=${pfx}/lib/radare2
PATH=$pfx/bin:${PATH}
LIBRARY_PATH=$pfx/lib:$LIBRARY_PATH
LD_LIBRARY_PATH=$pfx/lib:$LD_LIBRARY_PATH
DYLD_LIBRARY_PATH=$pfx/lib:$DYLD_LIBRARY_PATH
PKG_CONFIG_PATH=$pfx/lib/pkgconfig:$PKG_CONFIG_PATH
PATH=$pfx/bin${PATH:+:${PATH}}
LIBRARY_PATH=$pfx/lib${LIBRARY_PATH:+:${LIBRARY_PATH}}
LD_LIBRARY_PATH=$pfx/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
DYLD_LIBRARY_PATH=$pfx/lib${DYLD_LIBRARY_PATH:+:${DYLD_LIBRARY_PATH}}
PKG_CONFIG_PATH=$pfx/lib/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}}
'
shift