Subject: Re: bug#29788: chown: recursive operation with "-H" flag does not work as documented

From: Bernhard Voelker <[email-masked]>
Date: Thu, 21 Dec 2017 00:07:46 +0100

On 12/20/2017 10:52 PM, Paul Eggert wrote:
> For chown -H -R, POSIX
> says that if "a symbolic link referencing a file of type directory is
> specified on the command line,/chown/  shall change the user ID (and
> group ID, if specified) of the directory referenced by the symbolic link
> and all files in the file hierarchy below it." The clear implication in
> context is that -H should mean --dereference at the top level, [...]

I agree here.

> [...] and --no-dereference at lower levels.

I read this different: --dereference is still the default in the
OPs example 'chown -vRH root foo' as -h|--no-dereference was not
explicitly passed.

After all, I somehow have the feeling that the problem is two-fold:
a) The ownership of which file is changed? The symlink or the target?
b) Shall chown follow the symlink or not?
Without a dedicated --follow|--no-follow, it will be impossible to
satisfy all combinations of expected behavior.

Anyway, it seems hard to choose the right combination without knowing
if the command line argument is a symbolic link (and points to a valid
and accessible directory or not) or another file type.

Have a nice day,
Berny