[Bug 11656] Escaping broken with --files-from

samba-bugs at samba.org samba-bugs at samba.org
Sun Oct 8 16:48:50 UTC 2017


https://bugzilla.samba.org/show_bug.cgi?id=11656

Wayne Davison <wayned at samba.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WORKSFORME

--- Comment #10 from Wayne Davison <wayned at samba.org> ---
The consistent and documented escaping is that some characters get ouput with a
backslash+hash+3-digit octal number. This includes control chars, some
backslashes, and (without -B) high-bit chars.  From the man page:

"The escape idiom that started in 2.6.7 is to output a literal backslash (\)
and a hash (#), followed by exactly 3 octal digits.  For example, a newline
would output as "\#012".  A literal backslash that is in a filename is not
escaped unless it is followed by a hash and 3 digits (0-9)."

One easy way to unescape is thus to filter names through something like this:

    perl -pe 's/\\#(\d\d\d)/chr(oct($1))/eg'

(...after any necessary parsing of the output to find the names or twiddle
newlines into nulls).  You'll note that this only matches exactly 3-digits, as
rsync will leave something like "\#5" alone in the output, since it cannot be
confused with an actual escaped char.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.



More information about the rsync mailing list