[Bug 10051] New: Improved long file-name handling

samba-bugs at samba.org samba-bugs at samba.org
Sat Jul 27 12:14:32 MDT 2013


           Summary: Improved long file-name handling
           Product: rsync
           Version: 3.1.0
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P5
         Component: core
        AssignedTo: wayned at samba.org
        ReportedBy: me at haravikk.com
         QAContact: rsync-qa at samba.org

One of the issues with rsync between two different systems is the possibility
of file-systems with stricter limitations on the length of a file name or even
file path. Now, the latter I'm not sure can be resolved easily, but long names
cause two main errors:

rsync: recv_generator: failed to stat "/foo/really_long_name": File name too
long (36)
rsync: mkstemp "/foo/" failed: No such file or directory (2)

Basically any attempt to stat an existing file on the receiving end will fail
(it probably isn't there anyway). mkstemp then later fails presumably because
the temporary name is too long so no file is actually created, it then creates
the strange second error which will report the target root as not existing,
even though it does.

What I would like to propose is a new feature for handling long file-names, by
adding something like the following:

--long-hash (md5|sha1|sha2|none)
--long-hash-ext .rsync.hashed

Quite simply, if a file-name is encountered that is too long for the target
file-system, then it is run through the specified hashing algorithm, with the
resulting hash being used as the name instead when transferring the file (or
looking for an existing file).

The default setting of none would throw an rsync error instead, with the
assumption being that renaming the file could introduce errors. For example if
you were rsyncing an application bundle but something was renamed then the
cloned application may not be functional, so an error would be preferable.
However, if you're using rsync for a backup then you may be okay with renaming
the file to ensure that it is at least copied.

A possible to addition to this feature would be:

--long-hash-namefile *.rsync.name

Basically this lets you choose a format for a name-file; any file that has to
have its named hashed would have a name-file created alongside it using the
specified format. If rsync is sending a hashed file with a matching name-file
then it can open this in order to restore the original file-name.

For example:

I want to rsync the filename "hugefilename.txt", with the md5 algorithm set
rsync will send this as "520b0999cd97ae3af36744e0f9cb1839.rsync.hashed" and
create alongside it a file named "520b0999cd97ae3af36744e0f9cb1839.rsync.name"
containing the original filename of "huge filename".

Of course naming of the parameters is entirely for example purposes, but
hopefully you get the idea. Basically a file with long filename has the name
hashed and a suitable extension added, if rsync encounters a file with that
extension then it can look for a name-file to expand. When syncing to a folder,
if a file has a long file-name then rsync can hash that file-name and look for
a .rsync.hashed file to run its usual checks against.

Configure bugmail: https://bugzilla.samba.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

More information about the rsync mailing list