bug-coreutils
[Top][All Lists]
Advanced

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

Re: fchdir() stub


From: Jim Meyering
Subject: Re: fchdir() stub
Date: Sun, 07 Aug 2005 09:37:41 +0200

Bert Deknuydt <address@hidden> wrote:
> Coreutils 5.3.? (and 5.2.?) use fts_read() etc. in a few tools (like chmod).
> fts_read() uses fchdir(), when available on the system, otherwise its
> fchdir-stub (which does nothing but return an error).
>
> Ultrix does not have an fchdir() (which is detected by configure)...
> So the stub is called and all chmod's result in a 'fts_read failed:
> Function not implemented'
>
> So should the stub be replaced by an implementation of fchdir(), or should
> a workaround in fts_read() be a better solution?

Thank you for the report.

AFAIK, it is not possible to simulate fchdir at the application level,
but if your system has a way to map from an open file descriptor to a
corresponding file name, it may be possible.  I suspect it would be very
hard to rewrite fts.c not to use fchdir at all.  You might be able to
replace the few non-FCHDIR uses with save_cwd/restore_cwd and then use
it only in FTS_NOCHDIR mode, but even that seems like it'd be tricky,
and without fchdir, you lose most of the benefit provided by fts.
Besides, fchdir has been required by POSIX for so long that I'm wondering
if your Ultrix system is more of a museum piece than a viable portability
target.

At least for the 4 or 5 tools that use fts, you should be able to get
by with an older version of coreutils that predates the conversion to
use fts.  I think the one you want is coreutils-5.0.91.

Jim




reply via email to

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