Skip to content

Fix working_dir handling for os.process_start() on linux and posix - #7373

Open
BunterSchatten wants to merge 2 commits into
odin-lang:masterfrom
BunterSchatten:fix-process-workdir
Open

Fix working_dir handling for os.process_start() on linux and posix#7373
BunterSchatten wants to merge 2 commits into
odin-lang:masterfrom
BunterSchatten:fix-process-workdir

Conversation

@BunterSchatten

Copy link
Copy Markdown
Contributor

On linux and posix the Process_Desc.working_dir for os.process_start() does not do what it should: As I understand it, the executable file should be searched in the current process working dir if it is not absolute, then the working dir of the spawned process should be changed to Process_Desc.working_dir.
Currently, the checks are run correctly against the current (parent) working dir, but the execveat call uses the newly set Process_Desc.working_dir (if given) to resolve a relative exe path.

I fixed that by always prefixing the executable name with the current (parent) working dir if it is not already absolute. This also makes the execveat call on linux needless, so I replaced it with execve.
On posix I also converted the string builder to a cstring before forking the process (like it is already done on linux).

This will break code that relies on the previous behaviour of searching the executable in the Process_Desc.working_dir.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant