comments with '#' in --files-from

Wayne Davison wayned at
Tue Mar 10 00:50:07 GMT 2009

On Mon, Mar 09, 2009 at 01:36:26AM -0400, Matt McCutchen wrote:
> From the code, it looks like comments (as lines beginning with '#' or
> ';') are supported but are buggy on remote runs (probably what you are
> seeing).

Yeah, the code is supposed to ignore comments unless the data is coming
in via the socket, in which case the remote side will have already
removed them.  A file being read remotely is probably being mis-parsed
as though it was coming in via the socket.

The way to add a file that starts with a '#' or a ';' (that also works
for any file) is to start the filename with a slash, because a '/' means
"the root of the source dir" in a files-from file.  So, a simple rule of
"always start your file paths with '/'" (or even "./") would make adding
comments safe without the risk of misparsing a name.

Your idea to disallow comments if --from0 is specified seems reasonable
to me, since the user is asking for the ability to store even newlines
in a filename, it makes sense that the names should also be pre-filtered
of any comments too.  That should simplify the code, since the client
will have sent the server a --from0 option when it is sending the names
via the socket.


More information about the rsync mailing list