On 2020-10-08 10:28, Tomás Fernandes wrote:
Hello,

I've recently come across chmod's man page as someone who is not very
experienced (1st year CS undergrad), and found that the definition of the
letter X in the man page a bit unclear, more specifically this part (in
bold):

On the topic of chmod documentation, it could use a clarification in the
following matter.

chmod supports a = operator for copying permissions. For instance
u=g means "make the u permissions be like g".

chmod also supports multiple operations, like

  u=g,g=o

The behavior of GNU Coreutils chmod is that the = operator samples the
most *new* value of the permissions (everything to the left has already
taken place). This is true even without the comma separation, when =
is combined in one clause with other operators, as in:

  o+x=o

Here, the o+x will apply the x permission to o. Then this effect is settled
and the =o assignment therefore has no effect; it's the same as:

  o+x,o=o

Or something like that; I've not looked at this stuff in a while,
but it was one of the issues I ran into when making a chmod implementation.

It would be good if the documentation spelled it out that = references
the new permissions which result from everything to the left of =
having been processed.



Reply via email to