Date: Mon, 28 Oct 2002 23:52:07 +0200 From: Laurynas Biveinis X-Mailer: The Bat! (v1.61) Personal X-Priority: 3 (Normal) Message-ID: <8942416321.20021028235207@softhome.net> To: Andrew Cottrell CC: DJGPP Workers Subject: Findutils 4.1.7 port bugs & fix MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 28 Oct 2002 21:49:31.0595 (UTC) FILETIME=[E5A371B0:01C27ECB] Reply-To: djgpp-workers AT delorie DOT com Hello, There are two problems with find which can be seen during GCC bootstrap on 2K: c:/devel/djgpp/bin/find.exe: error waiting for rm: No child processes (ECHILD) c:/devel/djgpp/bin/find.exe: c:/devel/djgpp/gnu/build.gcc/gcc/include/.. changed during execution of c:/devel/djgpp/bin/find.exe 'error waiting for rm' is caused by bitrot in DJGPP port - find 4.1 upstream uses wait(), 4.1.7 uses waitpid(). DJGPP port used to provide its own version of wait() which does DTRT instead of stock lib version. I've updated it to provide special waitpid() instead, that solves the first problem. Patch (and ChangeLog, in the case you'd like to forward it upstream) are at the end. The second problem is that find stats directories during their traversal and caches their inodes and in the end we receive error that inode of some directory has changed. Is it possible that our stat() implementation returns different inode for the same directory? If yes, what could we do about it? If no, I'd like to know if this bug is 2K specific or not. I'd appreciate if someone downloads find-4.1.7 from 2.04 test build page, does something like (this is from GCC): $ touch Done $ find . -name '[Dd][Oo][Nn][Ee]' -exec rm -f '{}' ';' and reports any error messages on Win98/DOS, maybe on XP and other platforms too. 2002-10-28 Laurynas Biveinis * find/pred.c (wait): removed. (wait_pid): new function. (DOS_PID): new macro. --- pred.c.old 2001-11-19 12:17:22.000000000 +0000 +++ pred.c 2002-10-28 22:54:44.000000000 +0000 @@ -1267,14 +1267,19 @@ static void dos_signal_catcher (int sig) } } -/* Replacement for the `wait' library function that doesn't +#define DOS_PID ((pid_t)42) + +/* Replacement for the `waitpid' library function that doesn't merely fail. */ -pid_t wait (int *status) +pid_t waitpid (pid_t pid, int *status, int options __attribute__((unused))) { - if (child_running) + if ((child_running) || (pid != DOS_PID)) + { + errno = ECHILD; return (pid_t)(-1); + } *status = proc_status; - return (pid_t)42; + return DOS_PID; } /* The macros we need with `wait'. */ @@ -1357,7 +1362,7 @@ launch (struct predicate *pred_ptr) _exit (1); } - child_pid = (pid_t)42; + child_pid = DOS_PID; } #else /* not __MSDOS__ */