On Thu, Sep 13, 2018 at 8:17 PM Nan Xiao <[email protected]> wrote:

> The following patch fixes an error in chmod.1, and very sorry if I am
> wrong, thanks!
>
...

> --- chmod.1     7 Jun 2017 09:41:57 -0000       1.42
> +++ chmod.1     14 Sep 2018 05:10:44 -0000
> @@ -243,7 +243,7 @@ If no value is supplied for
>  each permission bit specified in
>  .Ar perm ,
>  for which the corresponding bit in the file mode creation mask
> -is clear, is cleared.
> +is set, is cleared.
>  Otherwise, the mode bits represented by the specified
>  .Ar who
>  and
>

The current documentation matches both the POSIX specification and the
utility behavior.  Consider:

$ touch file
$ chmod 666 file
$ mkdir -m 777 dir
$ ls -l
total 2
drwxrwxrwx  2 guenther  wheel  512 Sep 13 22:24 dir
-rw-rw-rw-  1 guenther  wheel    0 Sep 13 22:24 file
$ umask
002
$ chmod -rw *
$ ls -l
total 2
d--x--x-wx  2 guenther  wheel  512 Sep 13 22:24 dir
--------w-  1 guenther  wheel    0 Sep 13 22:24 file
$

The other-write bit was set in my file mode creation mask, so the "-rw" was
treated like "ug-rw,o-r" and did not change the other-write permission on
the file or directory.


Philip Guenther

Reply via email to