You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OK, here is the issue. Rsync is a very sensitive program with lots of gotchas. If I try the following, it copies all the files except the ones that I excluded:
So, in such a use case that trailing slash is required, otherwise, the command is the same as a simple cp command. Now, I try to reproduce the first command in go using the following program:
But, it behaves like the second command which ignores the exclusion list. I realized os.exec() tries to be smart and removes those trailing slashes. This is a terrible idea! How do I know? I change these two lines from:
@NuLL3rr0r I'm not sure if this is the issue, but putting quotes around parameters is a shell thing. Since you are directly invoking rsync you should not include them. Otherwise rsync itself will see them, and may be interpreting it as a path starting with " (which doesn't exist). Try changing it to:
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
OK, here is the issue. Rsync is a very sensitive program with lots of gotchas. If I try the following, it copies all the files except the ones that I excluded:
Now, if I remove the trailing slashes from the last two parameters, it copies everything and ignores all the exclusion list:
So, in such a use case that trailing slash is required, otherwise, the command is the same as a simple cp command. Now, I try to reproduce the first command in go using the following program:
But, it behaves like the second command which ignores the exclusion list. I realized os.exec() tries to be smart and removes those trailing slashes. This is a terrible idea! How do I know? I change these two lines from:
To
And when I run the program it fails with the following error from Rsync, which proves go removes those trailing slashes:
rsync: [sender] change_dir "/tmp/Plugin-Unreal/Repo/5.1\" failed: No such file or directory (2)
Wondering how can I keep those trailing slashes?
What did you expect to see?
The rsync command should work just like the command line.
What did you see instead?
Go removes those trailing slashes in the arg list.
The text was updated successfully, but these errors were encountered: