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

From: "Joachim Schmitz" <[email-masked]>
Date: Thu, 22 Dec 2011 09:41:17 +0100

> From: Eric Blake [mailto:[email-masked]]
> Sent: Wednesday, December 21, 2011 6:32 PM
> To: Joachim Schmitz
> Cc: 'Jim Meyering'; [email-masked]; 'Paul Eggert'; bug-
> [email-masked]
> Subject: Re: bug#10305: coreutils-8.14, "rm -r" fails with EBADF
> 
> On 12/21/2011 10:12 AM, Joachim Schmitz wrote:
> >>> Write a small test program that opens say four directories, to get
> >>> one
> >>> DIR* pointer for each.  Then print a table of the DIR member values.
> >>> Maybe you'll see a pattern, i.e., how to derive an FD number from
> >>> those dd1,2,3 fields.
> >
> > Yes, indeed, thanks for that idea (should have been mine):
> > It got to be dd1, only it is not an fd but something called fnum and
> > these a) start counting with 1 rather than 0 and b) have 1 and 2 being
> > root and CPD, followed by 3,4 and 5 being stdin, stdout, stderr... it
> > seems fnum -3 == fd
> 
> Yay - we can implement dirfd() in terms of dd1-3.
> 
> Please try this on coreutils:
> 
> ./configure gl_cv_sys_dir_fd_member_name='dd1-3'

I tried something to a similar effect, I manually changed config.h accordingly (see other email of mine) and rebuilt dirfd.o, rebuilt libcoreutils.a, relinked rm:
Didn't work :-(

In case it matters: I'm using 
./configure --prefix=/usr/local --enable-install-program=arch,hostname --without-gmp CFLAGS="-O0 -g"

Another attempt with adding gl_cv_sys_dir_fd_member_name='dd1-3':
Unfortunatly it doesn't help

Bye, Jojo