bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug#249177: coreutils: chown is not POSIXLY_CORRECT even when the va


From: Paul Eggert
Subject: Re: Bug#249177: coreutils: chown is not POSIXLY_CORRECT even when the variable is set
Date: Fri, 21 May 2004 00:51:08 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

Here are some more thoughts on coreutils chown etc.  I guess I'm
volunteering to implement these if there's interest...

* Coreutils currently assigns two distinct meanings to the
  "--dereference" option.  In some cases (e.g., chown) it means
  "dereference symlinks when you apply the primitive operation" (i.e.,
  use chown() rather than lchown()).  In other cases (e.g., "du") it
  means "dereference symlinks when you walk through the tree" (i.e.,
  use ftw with FTS_LOGICAL rather than FTS_PHYSICAL).

  This is confusing and needs to be cleaned up.  To be
  backward-compatible, we can't change the meaning of "--dereference".
  But we can add new, cleaner options, as follows:

  For the BSD -H/-L/-P options, which control file tree walking:

    -P = --walk=physical
    -H = --walk=hybrid  (I have no idea what -H originally stood for.)
    -L = --walk=logical

  For the -h option of chown, and its inverse, which control whether
  the chown command uses lchown() or chown():

    -h = --no-follow
         --follow

  The follow and walk options are independent.  Their default settings
  probably depend on the command and other options, e.g., chown -RP
  implies a default of -h.  --dereference and --no-dereference can be
  kept as undocumented aliases for the above options.

* With or without the above change, there's a problem with trying to
  change everything in sight.  Either you use chown -RL (chown
  --recursive --logical-walk) and miss the symbolic links that you
  find, or you use chown -RLh (chown --recursive --logical-walk
  --no-follow) and you miss the targets of the symlinks.  Perhaps this
  isn't worth worrying about, but I thought I'd mention it.

* Minor suggestion: "chown : file" should invoke chown with uid and
  gid both set to -1, so that the file ownership and group doesn't
  change but the setuid/setgid bits are cleared (and perhaps ACLs are
  removed).  This might be useful.

* chmod and touch should add support for -h so that they can use
  lchmod and lutimes, respectively, on hosts that have these system
  calls (e.g., FreeBSD 3.0 and later).

* The coreutils documentation needs to be updated but this can wait
  until the above issues are resolved.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]