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

From: "Joachim Schmitz" <[email-masked]>
Date: Tue, 26 Jun 2012 18:38:33 +0200

> From: Paul Eggert [mailto:[email-masked]]
> Sent: Sunday, January 15, 2012 7:01 AM
> To: Joachim Schmitz
> Cc: [email-masked]; [email-masked]; 'Eric Blake'; 'Jim Meyering'
> Subject: Re: bug#10305: coreutils-8.14, "rm -r" fails with EBADF
> 
> On 01/14/2012 08:27 AM, Joachim Schmitz wrote:
> >> Oh well, it was a bit of a stab in the dark anyway.
> >> > I guess we'll have to do Eric's suggestion to wrap opendir
> >> > <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10305#68>.
> >> > That should work around the problem, and in some sense it's nicer
> >> > anyway because it causes dirfd to work in the usual way (as required in the
> next POSIX).
> > Any progress on this?
> 
> Not be me, alas.  Is it something you can work on?

It's been a while but we now have something working. 
Attached the patch that made it work for us with tar-1.26, I'll try the equivalent on coreutils-8.17 later this week.

We need an extended check in configure, small additions to dirfd.c, open.c, unistd.in.h and a somewhat larger addition to fchdir.c. Also 2 small fixes for C99 and 2 more, one for gnulib and one for tar, to cope with HP NotStop's superuser having UID 65530 rather than 0. And one fix for tar's test suite on HP NonStop

Let me know what you think and where/how you'd do it differently.

Bye, Jojo