Skip to content
Snippets Groups Projects
Commit 40f25512 authored by richardmaw-codethink's avatar richardmaw-codethink Committed by richardmaw-codethink
Browse files

subprocesses: Ensure PWD is set in process environment

Naive getcwd implementations (such as in bash 4.4) can break
when bind-mounts to different paths on the same filesystem are present,
since the algorithm needs to know whether it's a mount-point
to know whether it can trust the inode value from the readdir result
or to use stat on the directory.

Less naive implementations (such as in glibc) iterate again using stat
in the case of not finding the directory because the inode in readdir was wrong,
though a Linux-specific implementation could use name_to_handle_at.

Letting the command know what directory it is in makes it unnecessary
for it to call the faulty getcwd in the first place.
parent 958ef8ef
No related branches found
No related tags found
Loading
Pipeline #29811135 passed
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment