Subject: RE: bug#10305: coreutils-8.14, "rm -r" fails with EBADF

From: "Joachim Schmitz" <[email-masked]>
Date: Sat, 21 Jul 2012 12:42:19 +0200

> From: Paul Eggert [mailto:[email-masked]]
> Sent: Saturday, July 21, 2012 7:38 AM
> To: Joachim Schmitz
> Cc: [email-masked]; [email-masked]; 'Eric Blake'; 'Jim Meyering';
> 'Schmitz, Joachim'; [email-masked]
> Subject: Re: bug#10305: coreutils-8.14, "rm -r" fails with EBADF
> 
> On 07/20/2012 09:17 AM, Joachim Schmitz wrote:
> > The coreutils config.hin in 8.17 no more defines any of RAW_DECL_*
> functions, which were present in 8.15. Can we expect more problems because
> of this?
> Sorry, I've lost context -- there has been a blizzard of emails in this thread and I
> don't know what the current state is any more.
> 
> As I understand it, the idea is that you submit your patches one at a time,
> against the current git master.  Which patch runs afoul of the RAW_DECL_*
> change, and why?

The patch in question here is this:
/usr/local/bin/diff -EBbu ./lib/getcwd.c.orig ./lib/getcwd.c
--- ./lib/getcwd.c.orig	2012-01-06 03:14:31 -0600
+++ ./lib/getcwd.c	2012-07-19 11:34:01 -0500
@@ -135,7 +135,7 @@
   size_t allocated = size;
   size_t used;
 
-#if HAVE_RAW_DECL_GETCWD && HAVE_MINIMALLY_WORKING_GETCWD
+#if (HAVE_RAW_DECL_GETCWD && HAVE_MINIMALLY_WORKING_GETCWD) || __TANDEM
   /* If AT_FDCWD is not defined, the algorithm below is O(N**2) and
      this is much slower than the system getcwd (at least on
      GNU/Linux).  So trust the system getcwd's results unless they

And the fact that somewhere between corutils-8.15 and 8.17 these HAVE_RAW_DECL_* have disappeared from config.hin.
Without the above patch we run into an endless recursion loop: getcwd(), openat(), rpl_open(), get_name(), getcwd() ....
until we hit the max. stack limit and abort.

While the above patch seems to fix this for use, Nagendra's concern is whether there is more to the removal of these HAVE_RAW_DECL_* stuff, whether there are other problems with these

Bye, Jojo