Skip to content

chmod: -c reports changes even on no-op #6009

@BenWiederhake

Description

@BenWiederhake

Example:

$ chmod -c --reference README.md README.md  # GNU
$ cargo run --all-features chmod -c --reference README.md README.md
mode of 'README.md' changed from 0644 (rw-r--r--) to 100644 (rw-r--r--)
$ cargo run --all-features chmod -c --reference README.md README.md
mode of 'README.md' changed from 0644 (rw-r--r--) to 100644 (rw-r--r--)
$ chmod -c --reference README.md README.md  # GNU
$ cargo run --all-features chmod -c --reference README.md README.md
mode of 'README.md' changed from 0644 (rw-r--r--) to 100644 (rw-r--r--)
$ cargo run --all-features chmod -c --reference README.md README.md
mode of 'README.md' changed from 0644 (rw-r--r--) to 100644 (rw-r--r--)

Expected behavior: By definition, chmod --reference README.md README.md should not change any permissions. By definition of -c, this flag should be like verbose but report only when a change is made. Since no change was made, no change should be reported.

Actual behavior: It looks like chmod attempts to change permissions (buggy), and also reports them (buggy).

I'm not sure whether that's one or two bugs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions