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
, it seems like a surprising behavior that when you try to pass these exact same rsync args to timemachine, it results in an error:
# timemachine <source> <dest> -- --filter='dir-merge /.rsync-filter'
unexpected end of filter rule: dir-merge
It appears that timemachine is passing these args on to rsync without any quotes around it at all, the same as this:
# rsync -r <source> <dest> --filter=dir-merge /.rsync-filter
unexpected end of filter rule: dir-merge
I don't know off-hand what the right solution is, but IMHO this is a bug.
Attempts to solve...
I tried changing this line:
- $* \+ \"$*\" \
and in fact it does fix it for the simple example above. However, as soon as you add multiple pass-through args, it fails, because it seems to be sending them through as a single arg:
I suspect this behavior has something to do with the attempt to construct the command to run in a string and then eval it — which is very difficult to do properly and securely and handle all edge cases (see http://mywiki.wooledge.org/BashFAQ/048). Presumably word splitting is happening when we don't want it to be?
Why are we using eval anyway? I see that we were not using eval here in 4740817, for example. And of curiousity, I checked out that commit, and tried my example and it works!
I believe this could be solved fairly easily using an array of args rather than a string (see http://mywiki.wooledge.org/BashFAQ/050). However, it looks like you are using sh rather than bash, so I don't think we can use arrays, right? 😢
As the FAQ above says:
POSIX sh has no arrays, so the closest you can come is to build up a list of elements in the positional parameters.
I'll push up a MR with that approach and see if it works better... See #85.
See also
While you're at it, see if this is related to #82 and whether the same general solution could apply to both...
The text was updated successfully, but these errors were encountered:
TylerRick
added a commit
to TylerRick/linux-timemachine
that referenced
this issue
Sep 27, 2023
Considering that I can pass this option simply like this when using rsync directly...
, it seems like a surprising behavior that when you try to pass these exact same
rsync
args totimemachine
, it results in an error:It appears that
timemachine
is passing these args on torsync
without any quotes around it at all, the same as this:I don't know off-hand what the right solution is, but IMHO this is a bug.
Attempts to solve...
I tried changing this line:
and in fact it does fix it for the simple example above. However, as soon as you add multiple pass-through args, it fails, because it seems to be sending them through as a single arg:
I suspect this behavior has something to do with the attempt to construct the command to run in a string and then
eval
it — which is very difficult to do properly and securely and handle all edge cases (see http://mywiki.wooledge.org/BashFAQ/048). Presumably word splitting is happening when we don't want it to be?Why are we using
eval
anyway? I see that we were not usingeval
here in 4740817, for example. And of curiousity, I checked out that commit, and tried my example and it works!I believe this could be solved fairly easily using an array of args rather than a string (see http://mywiki.wooledge.org/BashFAQ/050). However, it looks like you are using
sh
rather thanbash
, so I don't think we can use arrays, right? 😢As the FAQ above says:
I'll push up a MR with that approach and see if it works better... See #85.
See also
While you're at it, see if this is related to #82 and whether the same general solution could apply to both...
The text was updated successfully, but these errors were encountered: