-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GetComponents: remove use of $orig_dir to support whitespace in it #2
Conversation
Using $orig_dir in command expansions become very difficult once $orig_dir contains whitespace and single quotes eg "Roland's Documents". There is no real need to do so since it was just path to cwd() anyway. Another reason not to use it is that cwd() returns the actual path which can differ from what the shell shows if cwd() is a symbolic link.
Ticket is here: https://trac.einsteintoolkit.org/ticket/1972 |
@@ -1376,7 +1372,7 @@ sub handle_git { | |||
} | |||
print_checkout_info( $checkout, $url, $target, $name ); | |||
|
|||
run_command("mkdir -p $orig_dir/$ROOT/repos"); | |||
run_command("mkdir -p $ROOT/repos"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If $ROOT is set to cwd(), wouldn't this pose a similar problem with whitespace? Granted, ROOT is usually set to something by the thornlist, but it might not be, and would be cwd() as of line 387.
@@ -385,7 +384,7 @@ sub parse_list { | |||
} | |||
# if $ROOT is undefined, it will be set to the current directory | |||
if ( defined( $DEFINITIONS{ROOT} ) ) { $ROOT = $DEFINITIONS{ROOT} } | |||
else { $ROOT = $orig_dir } | |||
else { $ROOT = cwd() } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this be a problem as well in several places later, if cwd() contains spaces (see also comment below)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. So I should use "." instead of cwd(). I just tested this and indeed with cwd() I get errors if I remove the ROOT define from the ET thornlist but using "." works fine. I amended the pull request.
if ROOT is not defined it would still have been used
Using $orig_dir in command expansions become very difficult once
$orig_dir contains whitespace and single quotes eg "Roland's Documents".
There is no real need to do so since it was just path to cwd() anyway.
Another reason not to use it is that cwd() returns the actual path which
can differ from what the shell shows if cwd() is a symbolic link.