From: Eric Sandeen Date: Mon, 9 Feb 2009 01:02:38 +0100 Subject: [PATCH] acl: fix setfacl for long utf8 filenames Resolved Red Hat bugs: rh#183181 - Bad: utf8 long filenames - invalid argument rh#287701 - PATH_MAX patch seems incomplete From: Andrey From: Thomas Woerner Signed-off-by: Eric Sandeen Signed-off-by: Andreas Gruenbacher Acked-by: Brandon Philips --- setfacl/parse.c | 8 +++++++- test/utf8-filenames.test | 14 ++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) Index: acl-2.2.47/setfacl/parse.c =================================================================== --- acl-2.2.47.orig/setfacl/parse.c +++ acl-2.2.47/setfacl/parse.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -412,7 +413,12 @@ read_acl_comments( gid_t *gid_p) { int c; - char linebuf[1024]; + /* + Max PATH_MAX bytes even for UTF-8 path names and additional 9 + bytes for "# file: ". Not a good solution but for now it is the + best I can do without too much impact on the code. [tw] + */ + char linebuf[(4*PATH_MAX)+9]; char *cp; char *p; int comments_read = 0; Index: acl-2.2.47/test/utf8-filenames.test =================================================================== --- /dev/null +++ acl-2.2.47/test/utf8-filenames.test @@ -0,0 +1,14 @@ ++Test the setfacl --restore with utf8 paths. ++Regression test: https://bugzilla.redhat.com/show_bug.cgi?id=183181 + +The utf string UPATH is 250 bytes long and is repeated 4 times to create the +path that setfacl will use. This size should work on systems with a small 255 +NAME_MAX. + + $ export UPATH="官官話官話官話官話官話官話官話官話官話官話官話官話官話官話官話官話官話官話官話官話官話官話官話官話官話官話官話官話官話官話官話官話官話官話話官話官話官話>官話官話話官話官" + $ mkdir -p $UPATH/$UPATH/$UPATH + $ touch $UPATH/$UPATH/$UPATH/$UPATH + $ getfacl $UPATH/$UPATH/$UPATH/$UPATH > utf8-filenames.acl + $ setfacl --restore=utf8-filenames.acl + $ rm -R $UPATH + $ rm utf8-filenames.acl