Skip to content
This repository has been archived by the owner on Mar 19, 2022. It is now read-only.

Quote rsync paths to avoid problems with spaces in dir names #286

Merged
merged 2 commits into from
Sep 22, 2013

Conversation

tmatilai
Copy link
Collaborator

Fixes #281

@@ -245,7 +245,7 @@ def write(content, dest)
def rsync(source_path, target_path, extra_opts = '--delete')
cmd = %Q{rsync -rl #{rsync_debug} #{rsync_permissions} --rsh="ssh #{ssh_args}" #{extra_opts}}
cmd << rsync_excludes.map { |ignore| " --exclude '#{ignore}'" }.join
cmd << %Q{ #{adjust_rsync_path_on_client(source_path)} :#{adjust_rsync_path_on_node(target_path)}}
cmd << %Q{ '#{adjust_rsync_path_on_client(source_path)}' ':#{adjust_rsync_path_on_node(target_path)}'}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this probably works, I wonder if we should maybe build a command array to pass to system and let Kernel.system do the quoting (where we can anyway, --rsh could be tricky).

Is there a reason we can't do that?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would hopefully also clean up the method. It's honestly quite messy now.

@matthewgovaere
Copy link

Any chance this will get added in soon? :) 👍

@tmatilai
Copy link
Collaborator Author

I'll try to get the refactoring done tonight. But I don't think we have any schedule for the next release.

@tmatilai
Copy link
Collaborator Author

@matschaffer something like this? Unfortunately it doesn't look any cleaner to me, but should for sure handle quotes and spaces better.

@matschaffer
Copy link
Owner

Exactly. Wasn't really hoping for any beauty just safety.

@tmatilai
Copy link
Collaborator Author

Rebased onto master. I tested manually and seemed to work as expected. Didn't run integration tests though.

matschaffer added a commit that referenced this pull request Sep 22, 2013
Quote rsync paths to avoid problems with spaces in dir names
@matschaffer matschaffer merged commit 3be7d96 into matschaffer:master Sep 22, 2013
@matschaffer
Copy link
Owner

I'll give em a kick.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

spaces in local directory name causes rsync to fail
3 participants