Skip to content

Commit

Permalink
DIRECTORY_COPY_COMMAND_FOR_UNIX_DEFAULT now uses tar -C option to spe…
Browse files Browse the repository at this point in the history
…cify target dir instead of doing an unchecked cd.
  • Loading branch information
bastiaanb committed Nov 24, 2014
1 parent 668d719 commit 4b62819
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public class ConnectionOptions {
/**
* See <a href="https://github.com/xebialabs/overthere/blob/master/README.md#directoryCopyCommandForUnix">the online documentation</a>
*/
public static final String DIRECTORY_COPY_COMMAND_FOR_UNIX_DEFAULT = "cd {1} ; tar -cf - -C {0} . | tar xpf -";
public static final String DIRECTORY_COPY_COMMAND_FOR_UNIX_DEFAULT = "tar -cf - -C {0} . | tar xpf - -C {1}";

/**
* See <a href="https://github.com/xebialabs/overthere/blob/master/README.md#fileCopyCommandForWindows">the online documentation</a>
Expand Down

2 comments on commit 4b62819

@vpartington
Copy link

Choose a reason for hiding this comment

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

@bastiaanb, thank you for your pull request.

However, we cannot accept it as it would break the functionality on AIX. In fact, when we introduced the remote copy shortcircuit functionality, we used the -C flag to tar but that didn't work on AIX, see xebialabs#116. We fixed that in commit a756fc93

But that still doesn't solve the issue you're facing. I can think of two solutions:

  1. Change the ; in the original command to &&: cd {1} && tar -cf - -C {0} . | tar xpf -
  2. Check for the existence of the target directory in the code of Overthere before invoking this command.

The first is prettier, but I wonder if && works for all shells. Hmm...

Regards, Vincent.

@bastiaanb
Copy link
Owner Author

@bastiaanb bastiaanb commented on 4b62819 Nov 25, 2014 via email

Choose a reason for hiding this comment

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

Please sign in to comment.