Bug 11978 - mkstemp failed: File name too long (36) when filename is under the limit
mkstemp failed: File name too long (36) when filename is under the limit
Status: NEW
Product: rsync
Classification: Unclassified
Component: core
All All
: P5 normal
: ---
Assigned To: Wayne Davison
Rsync QA Contact
Depends on:
  Show dependency treegraph
Reported: 2016-06-15 20:16 UTC by Syr
Modified: 2016-06-15 20:36 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Syr 2016-06-15 20:16:15 UTC
Using mkstemp adds on 7 characters to the filename, which creates a problem when the filename is below, but close to, the limit of the filesystem.

You can see this when rsync'ing from one ecryptfs filesystem to another, which will fail even though both have the exact same 143-byte filename limit, if a filename consists of more than 136 bytes.

Is there any reason the .XXXXXX in the argument to mkstemp can't *replace* the last 7 characters in the filename, instead of being appended to it?
Comment 1 Syr 2016-06-15 20:27:11 UTC

Wait, it actually adds 8 characters to it in total, there's a dot prepended at the beginning to.
Comment 2 Syr 2016-06-15 20:36:10 UTC
Triple post. Shouldn't it also use e.g. f_namelen from statfs() at runtime instead of a compile-time constant?

And MAXPATHLEN doesn't even seem to reflect reality, since it's not actually limited to that on Linux.