mirror of
https://github.com/troglobit/finit.git
synced 2026-11-23 20:11:44 +00:00
tmpfiles: no warning for a d entry on a link to a directory
A d entry for a path that is a link to a directory warned that mode
and owner could not be set:
d /var/lock 0755
Here /var/lock is a link to /run/lock. The link is not followed, on
purpose, and the open fails.
That is not an error, leave the directory alone without a warning.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
3 files changed
+11
-3
No files matched your search
@@ -33,8 +33,6 @@ Missing options: `--root`, `--replace`, `--dry-run`, `--purge`,
|
|||||||
in `/etc` should run before `50-y.conf` in `/usr/lib`
|
in `/etc` should run before `50-y.conf` in `/usr/lib`
|
||||||
* `a` and `A` handle an ACL of at most 32 entries, a path with more is
|
* `a` and `A` handle an ACL of at most 32 entries, a path with more is
|
||||||
left as it is, with a warning
|
left as it is, with a warning
|
||||||
* A `d` or `e` entry for a path that is a link to a directory warns
|
|
||||||
that mode and owner could not be set
|
|
||||||
* An `x` or `X` entry with an age should have what it names cleaned
|
* An `x` or `X` entry with an age should have what it names cleaned
|
||||||
by that age, the age is not read
|
by that age, the age is not read
|
||||||
* The `%T` and `%V` specifiers are always `/tmp` and `/var/tmp`, they
|
* The `%T` and `%V` specifiers are always `/tmp` and `/var/tmp`, they
|
||||||
|
|||||||
+3
-1
@@ -1603,7 +1603,9 @@ static void tmpfiles(char *line)
|
|||||||
mkparent(path, 0755);
|
mkparent(path, 0755);
|
||||||
omask = umask(0);
|
omask = umask(0);
|
||||||
rc = makedir(path, perm.mode ?: 0755);
|
rc = makedir(path, perm.mode ?: 0755);
|
||||||
if (!rc && perm_path(path, &perm, strc, O_RDONLY | O_DIRECTORY))
|
/* A link to a directory is not followed, and nothing to warn about */
|
||||||
|
if (!rc && perm_path(path, &perm, strc, O_RDONLY | O_DIRECTORY) &&
|
||||||
|
!(errno == ENOTDIR && !lstat(path, &ast) && S_ISLNK(ast.st_mode)))
|
||||||
warn("Failed setting mode/owner on %s", path);
|
warn("Failed setting mode/owner on %s", path);
|
||||||
umask(omask);
|
umask(omask);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -120,3 +120,11 @@ sep
|
|||||||
say 'A new file without a mode is 0644, whatever the umask'
|
say 'A new file without a mode is 0644, whatever the umask'
|
||||||
run "echo 'f $DIR/default' > $CONF; umask 077; /libexec/finit/tmpfiles --create $CONF"
|
run "echo 'f $DIR/default' > $CONF; umask 077; /libexec/finit/tmpfiles --create $CONF"
|
||||||
assert "Default mode" "$(texec stat -c '%a' $DIR/default)" = "644"
|
assert "Default mode" "$(texec stat -c '%a' $DIR/default)" = "644"
|
||||||
|
|
||||||
|
sep
|
||||||
|
say 'A link to a directory is left alone, without complaints'
|
||||||
|
run "mkdir $DIR/real; chmod 700 $DIR/real; ln -s real $DIR/link"
|
||||||
|
run "printf 'd $DIR/link 0755\ne $DIR/link 0755\n' > $CONF"
|
||||||
|
msg=$(texec sh -c "/libexec/finit/tmpfiles --create $CONF 2>&1")
|
||||||
|
assert "No warning" "$msg" = ""
|
||||||
|
assert "Directory as it was" "$(texec stat -c '%a' $DIR/real)" = "700"
|
||||||
Reference in new issue
Block a user