fakechroot icon indicating copy to clipboard operation
fakechroot copied to clipboard

substitution logic is broken?

Open galaxy4public opened this issue 3 years ago • 0 comments

Currently, fakechroot does a command substitution only if the FAKECHROOT_CMD_ORIG is not set and once the substitution is performed, fakechroot sets the environment variable. I think this logic is broken.

Let's imagine that we want to substitute /bin/sh=/some/path/to/shell and /bin/tool=/some/path/to/tool and we have a binary inside our faked chroot that calls /bin/tool via /bin/sh. That binary won't be able to execute /bin/tool under fakechroot in this case.

fakechroot will substitute /bin/sh with /some/path/to/shell since FAKECHROOT_CMD_ORIG is not set, and then will set it. Now, fakechroot gets a call to execve() /bin/tool and is not going to do the substitution since the FAKECHROOT_CMD_ORIG was set.

galaxy4public avatar Jan 18 '23 05:01 galaxy4public