Skip to content
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

Merged
merged 2 commits into from
Nov 7, 2016

Conversation

rhaas80
Copy link
Collaborator

@rhaas80 rhaas80 commented Oct 9, 2016

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.

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.
@rhaas80
Copy link
Collaborator Author

rhaas80 commented Oct 9, 2016

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");
Copy link
Collaborator

@knarrff knarrff Oct 10, 2016

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() }
Copy link
Collaborator

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)?

Copy link
Collaborator Author

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
@knarrff knarrff merged commit c0ad2e8 into master Nov 7, 2016
@knarrff knarrff deleted the rhaas/whitespace_in_paths branch November 7, 2016 15:27
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.

2 participants