[Unison-hackers] [PATCH] Unison with eCryptfs

Irányossy Knoblauch Artúr ikartur at gmail.com
Thu Oct 24 09:13:38 EDT 2013


Hi Everyone!

Currently Unison will fail to sync files with more than 64 character
long file names on systems using eCryptfs.

Unison still has some trouble creating proper temporary file names on
certain file systems which has some limitations on the maximum allowed
file name length: for example, eCryptfs has a limitation of 143
characters long file names [1].
eCryptfs is widely used: for example the default Ubuntu installer
offers you to encrypt your home folder using eCryptfs.

If someone wants to use Unison on a system using encrypted home
folders, Unison will highly likely fail to create temporary files.
You can find users complaining about this in various places over the
Internet ([2] [3] [4] [5]).

A very similar problem related to temporary file name lengths was
fixed in the past (where Unison tried to create temporary files with
more than 256 characters long names).
The approach was to crop file names to 64 characters and add an MD5
digest of the original file name to the temporary name. Using this
method, if you have a file with 65 'a' characters Unison will fail to
create a 148 characters long temporary file:

.unison.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac743a45e0d2e6a95cb859adae0248435.0e30133d04f8d05f6556aa7ddc20ef74.unison.tmp

I have created a patch that fixes this problem by ensuring that all
temporary file names will be limited to exactly 143 characters. (The
limit can be easily and safely modified). Please review it.

Thank you very much, and have a nice day! ;-)



References:

[1] eCryptfs maximum file length:
https://bugs.launchpad.net/ecryptfs/+bug/344878

[2] Unison fails to synchronize some git repositories:
http://superuser.com/questions/629558/unison-fails-to-synchronize-some-git-repositories

[3] Has Unison error on “File name too long”:
http://askubuntu.com/questions/232322/has-unison-error-on-file-name-too-long

[4] File name too long (ecryptfs):
http://groups.yahoo.com/neo/groups/unison-users/conversations/messages/10756

[5] long file names:
http://groups.yahoo.com/neo/groups/unison-users/conversations/messages/10880
-------------- next part --------------
A non-text attachment was scrubbed...
Name: limit_temp_file_names_to_be_compatible_with_eCryptfs.patch
Type: text/x-patch
Size: 1495 bytes
Desc: not available
URL: <http://lists.seas.upenn.edu/pipermail/unison-hackers/attachments/20131024/c758c98b/attachment-0001.patch>


More information about the Unison-hackers mailing list