Skip to content

tail: exists precheck masks permission errors #10323

@sylvestre

Description

@sylvestre

Component

tail

Description

uutils checks path.exists() before opening the file. Path::exists() returns false on metadata errors (including EACCES), so a permission error is reported as “No such file or directory” and the open is never attempted. GNU tail attempts the open and reports the real errno.

Test / Reproduction Steps

# As root:
mkdir /tmp/noexec
echo secret > /tmp/noexec/file
chmod 000 /tmp/noexec

# As unprivileged user:
tail -n 1 /tmp/noexec/file
# GNU: "tail: cannot open '/tmp/noexec/file' for reading: Permission denied"
# uutils: "tail: cannot open '/tmp/noexec/file' for reading: No such file or directory"

Impact

Incorrect diagnostics and follow/retry behavior can break scripts that rely on accurate error reporting.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions