Discussion:
Hitting up against max filename length in aufs
OmegaPhil
2016-07-16 12:58:57 UTC
Permalink
Just throwing this out so that people can search on it:

I now have an example file with a filename length of 100 characters,
however most will be wide characters since its mainly Japanese - in python:

=================================

len(file_name)
100

len(bytes(file_name.encode()))
246

=================================

So in UTF-8, its more than double the length! Presumably a character
won't be more than 2 bytes long, so hidden characters??

Interacting with this in aufs is causing 'File name too long' errors
(rsync reports error code 36).

Reading the manpage, I think this is covered with:

=====================================================================

The whiteout prefix (.wh.) is reserved on all branches. Users
should not handle the filename
begins with this prefix. In order to future whiteout, the
maximum filename length is limited
by the longest value - 4 * 2 - 1 - 4 = 242. It means you
cannot handle such long name in
aufs, even if it surely exists on the underlying branch fs. The
readdir(3)/getdents(2) call
show you such name, but the d_type is set to DT_UNKNOWN. It may
be a violation of POSIX.

=====================================================================

246 is pretty close to the extfs/btrfs max of 255B, so I doubt its going
to get 'solved' any time soon.

The name is stupidly long anyway, wide characters or not.
s***@users.sourceforge.net
2016-07-16 13:24:20 UTC
Permalink
Hello OmegaPhil,
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
The whiteout prefix (.wh.) is reserved on all branches. Users
should not handle the filename
begins with this prefix. In order to future whiteout, the
maximum filename length is limited
by the longest value - 4 * 2 - 1 - 4 =3D 242. It means you
cannot handle such long name in
aufs, even if it surely exists on the underlying branch fs. The
readdir(3)/getdents(2) call
show you such name, but the d_type is set to DT_UNKNOWN. It may
be a violation of POSIX.
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
246 is pretty close to the extfs/btrfs max of 255B, so I doubt its going
to get 'solved' any time soon.
I am glad that you already referred aufs manual.
If you read include/uapi/linux/aufs_type.h, you would find this macro
too.

/* a limit for rmdir/rename a dir and copyup */
#define AUFS_MAX_NAMELEN (NAME_MAX \
- AUFS_WH_PFX_LEN * 2 /* doubly whiteouted */\
- 1 /* dot */\
- AUFS_WH_TMP_LEN) /* hex */

NAME_MAX is defined as 255 which comes from POSIX.

Obviously your 246 is longer than aufs' 242 limit, and aufs reports the
error expectedly.


J. R. Okajima

Loading...