Fix exec of script when script launched by name#96
Merged
Conversation
When a script is launched by name, to be found in $PATH, the kernel implementation of exec substitutes the absolute path to the script as the argument to the interpreter, but Spindle did not replicate this behavior, leaving argv[0] as is. This is fixed by replacing argv[0] with orig_path if argv[0] is not a path. Adds test to verify fix.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes a bug in Spindle found in the
tau-cudatest of the E4S testsuite. When a script is executed, the kernel implementation replaces the originalargv[0]with a string that is the absolute path to the script ifargv[0]was not already a path. Thus, a case like:where
interpreter_test_perlis ininterpreter_test_dirwould fail with Spindle because the argument to the interpreter would beinterpreter_test_perlrather than the path, so that the interpreter could not find the input script.Fixed by mimicking kernel behavior: if already a path, use original
argv[0]as is; otherwise substitute with the absolute path.Also adds a test which fails without this fix:
and which passes with the fix:
I have rerun the E4S testsuite and verified that this both fixes the
tau-cudatest failure and does not introduce any new failures.