An error will occur if the acl file exceeds 1024 characters in setfacl.

minerow

New Member


Messages: 1

OS version: FreeBSD 12.0

I'm posting for the first time, so I'm sorry if I'm rude.

I investigated the following events, but I didn't know if they were specifications, so I will post a question.

<Problem>
When the acl file exceeds 1024 characters, it looks like "line too long ...".

Example1:
Code:
# wc -c < acl_list
1027
# setfacl -M ./acl_list TEST_DIR
setfacl: line too long in ./acl_list
#


#Example2
Code:
# wc -c < acl_list
     996
#setfacl -M ./acl_list TEST_DIR
#


acl_list(more than 1024 characters)
Code:
u:user1:rwxp--a-R-c---::allow
u:user:rwxp--a-R-c---::allow
u:usera:rwxp--a-R-c---::allow
u:userb:rwxp--a-R-c---::allow
u:userc:rwxp--a-R-c---::allow
u:userd:rwxp--a-R-c---::allow
u:usere:rwxp--a-R-c---::allow
u:userf:rwxp--a-R-c---::allow
u:userg:rwxp--a-R-c---::allow
u:userh:rwxp--a-R-c---::allow
u:useri:rwxp--a-R-c---::allow
u:userj:rwxp--a-R-c---::allow
u:userk:rwxp--a-R-c---::allow
u:userl:rwxp--a-R-c---::allow
u:userm:rwxp--a-R-c---::allow
u:usero:rwxp--a-R-c---::allow
u:userp:rwxp--a-R-c---::allow
u:userq:rwxp--a-R-c---::allow
u:userr:rwxp--a-R-c---::allow
u:users:rwxp--a-R-c---::allow
u:usert:rwxp--a-R-c---::allow
u:useru:rwxp--a-R-c---::allow
u:userv:rwxp--a-R-c---::allow
u:userw:rwxp--a-R-c---::allow
u:usery:rwxp--a-R-c---::allow
u:userz:rwxp--a-R-c---::allow
u:userab:rwxp--a-R-c---::allow
u:userac:rwxp--a-R-c---::allow
u:userad:rwxp--a-R-c---::allow
u:userae:rwxp--a-R-c---::allow
u:useraf:rwxp--a-R-c---::allow
u:userag:rwxp--a-R-c---::allow
u:userah:rwxp--a-R-c---::allow
u:userai:rwxp--a-R-c---::allow


acl_list(less than 1024 characters)
Code:
u:user1:rwxp--a-R-c---::allow
u:user:rwxp--a-R-c---::allow
u:usera:rwxp--a-R-c---::allow
u:userb:rwxp--a-R-c---::allow
u:userc:rwxp--a-R-c---::allow
u:userd:rwxp--a-R-c---::allow
u:usere:rwxp--a-R-c---::allow
u:userf:rwxp--a-R-c---::allow
u:userg:rwxp--a-R-c---::allow
u:userh:rwxp--a-R-c---::allow
u:useri:rwxp--a-R-c---::allow
u:userj:rwxp--a-R-c---::allow
u:userk:rwxp--a-R-c---::allow
u:userl:rwxp--a-R-c---::allow
u:userm:rwxp--a-R-c---::allow
u:usero:rwxp--a-R-c---::allow
u:userp:rwxp--a-R-c---::allow
u:userq:rwxp--a-R-c---::allow
u:userr:rwxp--a-R-c---::allow
u:users:rwxp--a-R-c---::allow
u:usert:rwxp--a-R-c---::allow
u:useru:rwxp--a-R-c---::allow
u:userv:rwxp--a-R-c---::allow
u:userw:rwxp--a-R-c---::allow
u:usery:rwxp--a-R-c---::allow
u:userz:rwxp--a-R-c---::allow
u:userab:rwxp--a-R-c---::allow
u:userac:rwxp--a-R-c---::allow
u:userad:rwxp--a-R-c---::allow
u:userae:rwxp--a-R-c---::allow
u:useraf:rwxp--a-R-c---::allow
u:userag:rwxp--a-R-c---::allow
u:userah:rwxp--a-R-c---::allow
 
Last edited by a moderator:

ralphbsz

Son of Beastie

Reaction score: 1,717
Messages: 2,675

Sadly, upgrading to 12.2 does't solve the problem; the maximum length of the input file seems to still be 1024. I just tried it, and 1020 characters worked, 1050 failed with the same error message.

I think the OP needs to split his input file into multiple files. As far as I know, they should be additive, but I'm not an expert on ACLs (I hate them, they are way too complicated, I've had to implement ACLs in file systems before, so I try to avoid using them). Just split the file every dozen lines or so, then run multiple setfacl commands.

I think theoretically there should be no limit in setfacl. If someone feels like it, they should open a bug report. I'm busy with real world problems. Did I mention that I don't like ACLs?
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 9,512
Messages: 34,309

It's limited by BUFSIZ, which is defined in stdio.h.

Code:
$ grep BUFSIZ /usr/include/stdio.h
#define BUFSIZ  1024            /* size of buffer used by setbuf */


Code:
63 	        len = fread(buf, (size_t)1, sizeof(buf) - 1, file);
64 	        buf[len] = '\0';
65 	        if (ferror(file) != 0) {
66 	                fclose(file);
67 	                err(1, "error reading from %s", filename);
68 	        } else if (feof(file) == 0) {
69 	                fclose(file);
70 	                errx(1, "line too long in %s", filename);
71 	        }

 
Top