This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] compile: Fix MinGW build [Re: [mingw rfc] Add mkdtemp to gdb/gnulib/]
- From: Kai Tietz <ktietz at redhat dot com>
- To: Eli Zaretskii <eliz at gnu dot org>
- Cc: Jan Kratochvil <jan dot kratochvil at redhat dot com>, brobecker at adacore dot com, yao at codesourcery dot com, gdb-patches at sourceware dot org
- Date: Tue, 16 Dec 2014 04:04:02 -0500 (EST)
- Subject: Re: [patch] compile: Fix MinGW build [Re: [mingw rfc] Add mkdtemp to gdb/gnulib/]
- Authentication-results: sourceware.org; auth=none
- References: <20141214182341 dot GA2908 at host2 dot jankratochvil dot net> <20141215182057 dot GA22226 at host2 dot jankratochvil dot net> <20141215183554 dot GB5457 at adacore dot com> <20141215184014 dot GA22610 at host2 dot jankratochvil dot net> <83y4q8wxk7 dot fsf at gnu dot org> <20141215222801 dot GA28138 at host2 dot jankratochvil dot net> <20141215225551 dot GA28880 at host2 dot jankratochvil dot net> <83tx0ww9dl dot fsf at gnu dot org>
----- UrsprÃngliche Mail -----
> > Date: Mon, 15 Dec 2014 23:55:51 +0100
> > From: Jan Kratochvil <jan.kratochvil@redhat.com>
> > Cc: brobecker@adacore.com, yao@codesourcery.com,
> > gdb-patches@sourceware.org,
> > ktietz@redhat.com
> >
> > On Mon, 15 Dec 2014 23:28:01 +0100, Jan Kratochvil wrote:
> > > The 'compile' project needs a larger port effort to run on MS-Windows.
> >
> > For example there is also
> >
> > compile/compile.c:
> > zap = concat ("rm -rf ", dir, (char *) NULL);
> > system (zap);
>
> Yuck! Do we really allow such atrocities in GDB? What if 'rm' is
> some unrelated or even malicious script?
>
> I think this should be replaced by suitable C function calls. IMO,
> this kind of programming is OK for prototyping, but not for the final
> code.
>
Ouch, to use console is for sure a bad thing. To use POSIX-shell commands is even worse. Why not using here instead an implementation using FTW-API? At least mingw-w64 added this API recently to runtime for gcc's sake, so implementation of an 'rm -rf' should be pretty easy.
Kai