[Top][All Lists]

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

Re: making fts thread-safe (no more fchdir)

From: Eric Blake
Subject: Re: making fts thread-safe (no more fchdir)
Date: Thu, 19 Jan 2006 06:34:54 -0700
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

Hash: SHA1

According to Jim Meyering on 1/19/2006 3:39 AM:
> As I said, I'm reluctant to add this complexity,
> without some evidence that it will be used.

How about a simpler patch to gnulib: define FTS_CWDFD, then make gnulib
fts_open() fail unless FTS_CWDFD or FTS_NOCHDIR is set.  In other words,
make existing uses of gnulib's fts_open() fail if the existing use would
rely on chdir/fchdir in glibc or FreeBSD semantics, forcing people to use
the new FTS_CWDFD flag (and in the process, pick up the benefits of the
*at functions).  That way, gnulib would force people to use the new flag
to get fts to work (since gnulib is supposed to promote safe coding
practices, after all), while native distros are then free to add the new
flag while remaining backwards compatible to old source code.  It is then
an ABI change (additional field in the fts struct), but no longer an
incompatible API change.  This also frees you from the burden of
maintaining this full patch of chdir capability, until such time as we do
encounter an application switching from native to gnulib fts where the
conversion to FTS_CWDFD is problematic (hopefully, that will never be the

Along the lines of your earlier mention of how easy it was to patch the
various utilities that used fts, it would be an additional one-line patch
to specify the FTS_CWDFD flag to fts_open, along with the changes of
converting "func (ent->fts_accpath)" to "funcat (fts->fts_cwd_fd,

- --
Life is short - so eat dessert first!

Eric Blake             address@hidden
Version: GnuPG v1.4.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org


reply via email to

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