[systemd-devel] [PATCH 2/4] Allow systemd-tmpfiles to set the file/directory attributes

Lennart Poettering lennart at poettering.net
Mon Apr 13 02:31:07 PDT 2015


On Sun, 12.04.15 22:19, Goffredo Baroncelli (kreijack at libero.it) wrote:

> However the original code catch also the case where the file is a soft-link.
> The same check is performed also by chattr(1); I suggest to leave the original
> behavior, changing
> 
>         fd = open(path, O_RDONLY|O_NONBLOCK|O_CLOEXEC);
> in
> 	fd = open(path, O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_NOFOLLOW);
> 
> and checking if the errno is ELOOP. In this case a further check is performed to 
> verify if the file is a link or the error is due to a too many symbolic link.
> Then an appropriate message error is printed.
> 
> What do you think ?

We should probably either follow symlinks for all of tmpfiles'
operations or for none. 

While I generally believe that we probably shouldn't follow symlinks,
it's really difficult to implement given that fchmodat() currenlty
doesn't work with AT_SYMLINK_FOLLOW (according to the man page at
least), and acl_set_file doesn't allow not following symlinks either... :-(

Hmm, I can't say I like this I must say.

ideas?

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list