Re: [patch] compile: rm -rf -> ftw()+rmdir()+unlink() [Re: [patch] compile: Fix MinGW build]

Pedro Alves
2014-12-17T22:42:11Z

On 12/17/2014 09:01 PM, Jan Kratochvil wrote:
> On Tue, 16 Dec 2014 10:04:02 +0100, Kai Tietz wrote:
>> Why not using here instead an implementation using FTW-API?
>
> Done.
>
>
>> At least mingw-w64 added this API recently to runtime for gcc's sake, so
>> implementation of an 'rm -rf' should be pretty easy.
>
> It has built on Fedora 21 x86_64 mingw64 for both 32-bit and 64-bit targets.
> I am not sure about various other Unices but if the patch gets approved...

Well, if the patch gets approved, what's the plan then? :-)

See https://www.gnu.org/software/gnulib/manual/html_node/ftw.html:

"This function is missing on some platforms: Mac OS X 10.3, FreeBSD 5.2.1, NetBSD 3.0, Minix 3.1.8, mingw, MSVC 9, BeOS. "

Note that's problems _not_ fixed by Gnulib. In reality, there's no real ftw
module in gnulib. But there _is_ an fts module.

So it seems to me that we should use the fts API instead of ftw. And then
we'll either need to import the gnulib module, or start out with an
autoconf check.

>
>
> On Wed, 17 Dec 2014 18:29:51 +0100, Steve Ellcey wrote:
>> /scratch/sellcey/repos/nightly2/src/binutils-gdb/gdb/compile/compile.c:175:10: error: ignoring return value of 'system', declared with attribute warn_unused_result [-Werror=unused-result]
>> cc1: all warnings being treated as errors
>> make[1]: *** [compile.o] Error 1
>
> It should get fixed by this patch.
>
>
> I have briefly tested (on Linux; on MinGW I have only tested the build) it
> really does delete the directory and its files.
>
> OK for check-in?

Thanks,
Pedro Alves