Mercurial > hg > octave-nkf > gnulib-hg
view COPYING @ 15988:cd7ac59d8eb5
fts: close parent dir FD before returning from post-traversal fts_read
The problem: the fts-using "mkdir -p A/B; rm -rf A" would attempt to
unlink A, even though an FD open on A remained. This is suboptimal
(holding a file descriptor open longer than needed), but otherwise not
a problem on Unix-like kernels. However, on Cygwin with certain Novell
file systems, (see http://cygwin.com/ml/cygwin/2011-10/msg00365.html),
that represents a real problem: it causes the removal of A to fail
with e.g., "rm: cannot remove `A': Device or resource busy"
fts visits each directory twice and keeps a cache (fts_fd_ring) of
directory file descriptors. After completing the final, FTS_DP,
visit of a directory, RESTORE_INITIAL_CWD intended to clear the FD
cache, but then proceeded to add a new FD to it via the subsequent
FCHDIR (which calls cwd_advance_fd and i_ring_push). Before, the
final file descriptor would be closed only via fts_close's call to
fd_ring_clear. Now, it is usually closed earlier, via the final
FTS_DP-returning fts_read call.
* lib/fts.c (restore_initial_cwd): New function, converted from
the macro. Call fd_ring_clear *after* FCHDIR, not before it.
Update callers.
Reported by Franz Sirl via the above URL, with analysis by Eric Blake
in http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/28739
author | Jim Meyering <meyering@redhat.com> |
---|---|
date | Sun, 23 Oct 2011 22:42:25 +0200 |
parents | 70e0e23ed97a |
children |
line wrap: on
line source
$Id: COPYING,v 1.3 2006-10-26 16:20:28 eggert Exp $ The files in here are mostly copyright (C) Free Software Foundation, and are under assorted licenses. Mostly, but not entirely, GPL. Many modules are provided dual-license, either GPL or LGPL at your option. The headers of files in the lib directory (e.g., lib/error.c) state GPL for convenience, since the bulk of current gnulib users are GPL'd programs. But the files in the modules directory (e.g., modules/error) state the true license of each file, and when you use 'gnulib-tool --lgpl --import <modules>', gnulib-tool either rewrites the files to have an LGPL header as part of copying them from gnulib to your project directory, or fails because the modules you requested were not licensed under LGPL. Some of the source files in lib/ have different licenses. Also, the copy of maintain.texi in doc/ has a verbatim-copying license, and doc/standards.texi and make-stds.texi are GFDL.