Re: chown fails to ignore symbolic links during recursive directory transversals

2005-03-09 Thread Bob Proulx
Mark Brand wrote:
 Moreover, there doesn't seem to be any way of invoking chown so that it
 operates recursively on a directory tree but ignores (doesn't follow)
 symbolic links.

Personally I would use find/xargs.  Like this:

 haydn:~ # mkdir sandbox
 haydn:~ # cd sandbox/
 haydn:~/sandbox # mkdir -p a/aa/aaa
 haydn:~/sandbox # touch foo
 haydn:~/sandbox # mkdir b
 haydn:~/sandbox # cd a/aa/aaa/
 haydn:~/sandbox/a/aa/aaa # ln -s ../../../foo foo
 haydn:~/sandbox/a/aa/aaa # ln -s ../../../b b
 haydn:~/sandbox/a/aa/aaa # cd ../../..
 haydn:~/sandbox # ls -l
 total 2
 drwxr-xr-x   4 root root  120 Mar  9 10:03 .
 drwx--  37 root root 2304 Mar  9 10:02 ..
 drwxr-xr-x   3 root root   72 Mar  9 10:03 a
 drwxr-xr-x   2 root root   48 Mar  9 10:03 b
 -rw-r--r--   1 root root0 Mar  9 10:03 foo
 haydn:~/sandbox # chown -R nobody:users a

  find a -print0 | xargs -r0 chown nobody:users

Does that work as you desire?

Bob


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: chown fails to ignore symbolic links during recursive directory transversals

2005-03-09 Thread Jim Meyering
Mark Brand [EMAIL PROTECTED] wrote:
 [This is a correction of my last e-mail that incorrectly referred to
 chmod instead of chown in a couple of places. This report is about
 chown. Sorry about that.]

 I hope I'm not making a fool of myself, but here we go:

 version: coreutils-5.2.1-3.rpm (from SuSE 9.2). Linux kernel 2.6.11.1.
 reiserfs.

Thanks for the report.
However, I cannot reproduce that behavior with unmodified coreutils-5.2.1
built and run on a Debian/GNU unstable system with Linux kernel 2.6.11.
Here's a small example:

  $ mkdir a b
  $ ln -s ../b a/sub
  $ sudo /bin/chown -R --verbose root a
  changed ownership of `a' to root
  changed ownership of `a/sub' to root
  $ ls -od a b
  drwxr-xr-x  2 root 60 Mar  9 19:36 a
  drwxr-xr-x  2 meyering 40 Mar  9 19:36 b

Maybe SuSE's version has changes that make it work differently?

Or (more likely) SuSE configured/built using a kernel/libc with
different chown/lchown semantics than what you're currently using.
That is one of the risks of using pre-compiled packages
(with configure-time run-tests) on newer versions of an OS.
Recompile it on your current system, and it may well work as
documented.


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: chown fails to ignore symbolic links during recursive directory transversals

2005-03-09 Thread Paul Eggert
I can't reproduce that bug with coreutils 5.3.0 on my Debian stable
box, so I'd guess the problem has been fixed.  Can you please try it
again with coreutils 5.3.0?

ftp://alpha.gnu.org/gnu/coreutils/coreutils-5.3.0.tar.gz

Here's my attempt to reproduce the problem:

penguin:/tmp# mkdir sandbox
penguin:/tmp# cd sandbox/
penguin:/tmp/sandbox# mkdir -p a/aa/aaa
penguin:/tmp/sandbox# touch foo
penguin:/tmp/sandbox# mkdir b
penguin:/tmp/sandbox# cd a/aa/aaa/
penguin:/tmp/sandbox/a/aa/aaa# ln -s ../../../foo foo
penguin:/tmp/sandbox/a/aa/aaa# ln -s ../../../b b
penguin:/tmp/sandbox/a/aa/aaa# cd ../../..
penguin:/tmp/sandbox# ls -l
total 8
drwxr-xr-x  3 root root 4096 Mar  9 14:42 a
drwxr-xr-x  2 root root 4096 Mar  9 14:42 b
-rw-r--r--  1 root root0 Mar  9 14:42 foo
penguin:/tmp/sandbox# chown -R nobody:users a
penguin:/tmp/sandbox# ls -al
total 948
drwxr-xr-x   4 root   root4096 Mar  9 14:42 .
drwxrwxrwt  42 root   root  954368 Mar  9 14:41 ..
drwxr-xr-x   3 nobody users   4096 Mar  9 14:42 a
drwxr-xr-x   2 root   root4096 Mar  9 14:42 b
-rw-r--r--   1 root   root   0 Mar  9 14:42 foo
penguin:/tmp/sandbox# chown --version
chown (GNU coreutils) 5.3.0
Written by David MacKenzie and Jim Meyering.

Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils