yes, find ... -exec is a good deal safer.  It used to be that it was based
on (properly escaped) file names, and there was a lot of discussion over
the implications of this for cleaning out the temp directory.  If it uses
file names then there's a potential race condition which can be used to
substitute a symlink for a deeply nested directory tree so that the actual
exec points to some arbitrary file.

Andrew





On Tue, 12 Aug 2003, Rowling, Jill wrote:

> Date: Tue, 12 Aug 2003 17:27:12 +1000
> From: "Rowling, Jill" <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: RE: [SLUG] recursively change file permissions not directories
>
> The sequence find ..... -exec seems safe enough though.
> I suspect it just uses the inode numbers rather than the file name or
> something (but beware this is on Solaris ;)
> bash-2.05$ find thingy -type f -exec file {} \;
> thingy/one/this:        empty file
> thingy/two/; file thingy:       empty file
> thingy/three/that:      empty file
> bash-2.05$ ls -lR thingy
> thingy:
> total 6
> drwxrwxr-x   2 rowling  staff        512 Aug 12 17:22 one
> drwxrwxr-x   2 rowling  staff        512 Aug 12 17:22 three
> drwxrwxr-x   2 rowling  staff        512 Aug 12 17:22 two
>
> thingy/one:
> total 0
> -rw-rw-r--   1 rowling  staff          0 Aug 12 17:22 this
>
> thingy/three:
> total 0
> -rw-rw-r--   1 rowling  staff          0 Aug 12 17:22 that
>
> thingy/two:
> total 0
> -rw-rw-r--   1 rowling  staff          0 Aug 12 17:22 ; file thingy
> bash-2.05$
>
> - Jill
>

--

No added Sugar.  Not tested on animals.  May contain traces of Nuts.  If
irritation occurs, discontinue use.

-------------------------------------------------------------------
Andrew McNaughton           In Sydney
                            Working on a Product Recommender System
[EMAIL PROTECTED]
Mobile: +61 422 753 792     http://staff.scoop.co.nz/andrew/cv.doc



-- 
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to