Skip to content

chmod: errors with -R flag on dangling link but shouldn't #7214

@jfinkels

Description

@jfinkels

Environment: Ubuntu 24.04, uutils main branch (git commit 2430e2a), GNU coreutils v9.6.8-fbfd88-dirty

Steps to reproduce: Create a link to a file that doesn't exist and then try to change the link's permissions with the -R flag:

mkdir dir
ln -s target dangling-link  # target doesn't exist
chmod 755 --no-dereference -R -P dangling-link

What happens now: uutils chmod terminates with an error message

chmod: cannot operate on dangling symlink 'dangling-link'

What I expected to happen: GNU chmod succeeds with no output.

Notes: With both uutils and GNU, the permissions of the link itself are not actually changed, but I think that's expected for symbolic links:

$ ls -l dangling-link
lrwxrwxrwx 1 jeffrey jeffrey 6 Jan 26 10:51 dangling-link -> target

Also, the -R flag I think has no other effect in this test case, as there is no directory here to recurse into.

This is causing a failure in the GNU test file tests/chmod/symlinks.sh.

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