Skip to content

Commit

Permalink
scripts: bundle-libraries.sh: retain preloaded libraries
Browse files Browse the repository at this point in the history
Since the introduction of fakeroot support, wrapped SDK executables might
be invoked from a shell that has libfakeroot.so preloaded.

Since we're using preloading as well in order to mangle argv[0] when
invoking the shipped ELF interpreter directly, we must take care of
preloading the already preloaded libraries as well, to avoid invoked
programs losing their fakeroot capabilities.

Extend the bundle-libraries.sh script to take any existing $LD_PRELOAD
into account when invoking the target ELF executable with a preloaded
runas.so library.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
  • Loading branch information
jow- committed Sep 10, 2020
1 parent 8b80150 commit 10dbdec
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/bundle-libraries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ for BIN in "$@"; do
#!/usr/bin/env bash
dir="\$(dirname "\$0")"
export RUNAS_ARG0="\$0"
export LD_PRELOAD="\$dir/${REL:+$REL/}runas.so"
export LD_PRELOAD="\${LD_PRELOAD:+\$LD_PRELOAD:}\$dir/${REL:+$REL/}runas.so"
exec "\$dir/${REL:+$REL/}$LDSO" --library-path "\$dir/${REL:+$REL/}" "\$dir/.${BIN##*/}.bin" "\$@"
EOF

Expand Down

0 comments on commit 10dbdec

Please sign in to comment.