Skip to content

chmod accepts invalid mode string #3306

@tavianator

Description

@tavianator
$ touch foo
$ ls -lh foo
-rw-r----- 1 tavianator tavianator 0 Mar 24 21:08 foo
$ ./target/debug/deps/chmod u=rwxg=rx ./foo
$ ls -lh foo
-r-xr----- 1 tavianator tavianator 0 Mar 24 21:08 foo
$ chmod u=rwxg=rx ./foo
chmod: invalid mode: ‘u=rwxg=rx’
Try 'chmod --help' for more information.

Noticed this when writing uutils/findutils#154. chmod shouldn't accept u=rwxg=rx, there needs to be a comma: u=rwx,g=rx. I'm not sure how chmod is interpreting it, but it doesn't act like the comma version.

POSIX gives a grammar for symbolic modes in the chmod docs: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/chmod.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions