diff --git a/src/basic/fs-util.c b/src/basic/fs-util.c index 59383c52d2..ac97c803d0 100644 --- a/src/basic/fs-util.c +++ b/src/basic/fs-util.c @@ -659,6 +659,19 @@ static int log_unsafe_transition(int a, int b, const char *path, unsigned flags) n1, special_glyph(ARROW), n2, path); } +static int log_autofs_mount_point(int fd, const char *path, unsigned flags) { + _cleanup_free_ char *n1 = NULL; + + if (!FLAGS_SET(flags, CHASE_WARN)) + return -EREMOTE; + + (void) fd_get_path(fd, &n1); + + return log_warning_errno(SYNTHETIC_ERRNO(EREMOTE), + "Detected autofs mount point %s during canonicalization of %s.", + n1, path); +} + int chase_symlinks(const char *path, const char *original_root, unsigned flags, char **ret) { _cleanup_free_ char *buffer = NULL, *done = NULL, *root = NULL; _cleanup_close_ int fd = -1; @@ -723,6 +736,10 @@ int chase_symlinks(const char *path, const char *original_root, unsigned flags, * unprivileged to privileged files or directories. In such cases the return value is -ENOLINK. If * CHASE_WARN is also set a warning describing the unsafe transition is emitted. * + * 5. With CHASE_NO_AUTOFS: in this case if an autofs mount point is encountered, the path normalization is + * aborted and -EREMOTE is returned. If CHASE_WARN is also set a warning showing the path of the mount point + * is emitted. + * * */ /* A root directory of "/" or "" is identical to none */ @@ -885,7 +902,7 @@ int chase_symlinks(const char *path, const char *original_root, unsigned flags, if ((flags & CHASE_NO_AUTOFS) && fd_is_fs_type(child, AUTOFS_SUPER_MAGIC) > 0) - return -EREMOTE; + return log_autofs_mount_point(child, path, flags); if (S_ISLNK(st.st_mode) && !((flags & CHASE_NOFOLLOW) && isempty(todo))) { char *joined; diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index d4e4f0c535..810b03567e 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -2261,11 +2261,12 @@ static int process_item(Item *i, OperationMask operation) { i->done |= operation; - r = chase_symlinks(i->path, NULL, CHASE_NO_AUTOFS, NULL); + r = chase_symlinks(i->path, NULL, CHASE_NO_AUTOFS|CHASE_WARN, NULL); if (r == -EREMOTE) { - log_debug_errno(r, "Item '%s' is below autofs, skipping.", i->path); + log_notice_errno(r, "Skipping %s", i->path); return 0; - } else if (r < 0) + } + if (r < 0) log_debug_errno(r, "Failed to determine whether '%s' is below autofs, ignoring: %m", i->path); r = FLAGS_SET(operation, OPERATION_CREATE) ? create_item(i) : 0;