containers / bubblewrap

Low-level unprivileged sandboxing tool used by Flatpak and similar projects
Other
3.9k stars 238 forks source link

Add --argv0 option #598

Closed quag closed 1 year ago

quag commented 1 year ago

Fixes containers/bubblewrap#91

Add the ability to overwrite argv[0] when starting a process in a container. Using --argv0 to be consistent with ld.so --argv0.

Overwriting argv[0] is useful as some tools change their behavior based on the value of argv[0]. For example, when bash is symlinked to sh it behaves as sh. Similarly, unxz is a symlink to xz and changes the default from compressing to decompressing. An extreme example is on many systems, date, df, cat and so on are all symlinks to the coreutils binary.

Example usage:

bwrap --bind / / --argv0 sh bash

PS: Thank you for the kind advice on my previous pull-request to add a --exec option.