GNU bug report logs - #29788
chown: recursive operation with "-H" flag does not work as documented

Previous Next

Package: coreutils;

Reported by: Michael Orlitzky <michael <at> orlitzky.com>

Date: Wed, 20 Dec 2017 18:31:01 UTC

Severity: normal

Tags: notabug

Done: Bernhard Voelker <mail <at> bernhard-voelker.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Michael Orlitzky <michael <at> orlitzky.com>, 29788 <at> debbugs.gnu.org
Subject: bug#29788: chown: recursive operation with "-H" flag does not work as documented
Date: Thu, 21 Dec 2017 08:58:18 -0800
On 12/20/2017 03:12 PM, Michael Orlitzky wrote:
> This is where I started off, but POSIX doesn't say anything about the
> "--dereference" flag.

Yes, well, a fundamental problem here is that POSIX is confused. The -H, 
-L, and -P options are clearly intended to control whether symlinks are 
followed, and the -h option is also intended to control the same thing, 
and POSIX doesn't say what happens when the two conflict. For example, 
'chown -RHh symlink-to-dir' clearly conflicts (-L means command-line 
symlinks to directories are followed, whereas -h means they are not), 
and POSIX does not say how to resolve the conflict.

The situation is further complicated by the fact that GNU chown treats 
-h as an option that affects all files, not just command-line files as 
POSIX would have it. And that GNU chown has a --dereference option that 
is intended to be the inverse of the -h option.

I think the *intent* of the GNU code is that -h/--dereference controls 
only whether lchown or chown is used, and that -H/-L/-P control only 
whether symlinks to directories are followed in a recursive chown. But 
(a) that's not what the code really does, (b) the intent does not 
conform to POSIX, (c) the code does not conform to POSIX either, and (d) 
as mentioned above, POSIX is broken. It's a true mess.





This bug report was last modified 7 years and 154 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.