Re: x bit for dirs: misfeature?

Alexander Viro
2001-11-20T17:38:07Z

On Tue, 20 Nov 2001, Mike Castle wrote:

> find /path/to/dir -type d -print0 | xargs -0 chmod a+rx
> find /path/to/dir -type f -print0 | xargs -0 chmod a+r
>
> That way, xargs bunches up the arguments into as many arguments as chmod
> can handle, and calls it fewer times.
>
> The -print0 and -0 are GNU extensions to handle spaces in names.

That's even worse than original. You've got a very wide race here -
think what happens if luser does

cd /path/to/dir/something/writable/to/luser
mkdir bar
mkdir baz
for i in `seq 1 500`; do
mkdir bar/$i
touch bar/$i/shadow
ln -sf /etc baz/$i
done

before you start, then waits for first chmod a+r and does

mv bar quux; mv baz bar

leaving you with very interesting results. It's much wider window than
in the original.