bug-findutils
[Top][All Lists]
Advanced

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

[bug #18466] -execdir {} + broken in new find


From: Eric Blake
Subject: [bug #18466] -execdir {} + broken in new find
Date: Wed, 06 Dec 2006 05:04:32 +0000
User-agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1)

Follow-up Comment #1, bug #18466 (project findutils):

This patch is a quick hack; it won't work on systems like mingw that lack
fchdir (although this is not much of a loss, since gnulib's fts currently
requires fchdir, and will be resolved once someone contributes a gnulib
fchdir module), or where . cannot be returned to (also not much of a loss,
since without FTS_CWDFD, you are already performing chdirs, so it is only
extreme race cases that can cause problems, and this is not adding to the
vulnerability).  Since it is a hack, I did not bother checking for failure;
all the more reason to not accept this patch as-is.  But with this hack
applied, the testcase mentioned in the original report uses the correct
directory.

IMO, a better solution would be to use gnulib's FTS_CWDFD so that the
traversal never changes working directories, then do fchdir inside launch(),
after the fork but before the exec.  But converting ftsfind to use FTS_CWDFD
seemed like a more time-consuming project, not to mention that all callers of
launch would need a change to pass the target working directory fd.

2006-12-05  Eric Blake  <address@hidden>

        Hack - use at your own risk:
        * find/ftsfind.c (consider_visiting): Save and restore
        directories, so that -execdir runs in the correct location.


(file #11460)
    _______________________________________________________

Additional Item Attachment:

File name: findutils.patch2               Size:0 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?18466>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

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