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



## minerow (Nov 17, 2020)

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:

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

```
# wc -c < acl_list
     996
#setfacl -M ./acl_list TEST_DIR
#
```

acl_list(more than 1024 characters)

```
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)

```
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
```


----------



## SirDice (Nov 18, 2020)

minerow said:


> OS version: FreeBSD 12.0


FreeBSD 12.0 has been End-of-Life since February 2020 and is not supported any more. Upgrade to 12.2.

Topics about unsupported FreeBSD versions








						Unsupported FreeBSD Releases
					

FreeBSD is an operating system used to power modern servers, desktops, and embedded platforms.




					www.freebsd.org


----------



## ralphbsz (Nov 18, 2020)

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 (Nov 18, 2020)

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


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


```
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 	        }
```





__





						[base] Contents of /head/bin/setfacl/file.c
					






					svnweb.freebsd.org


----------

