From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7879 invoked by alias); 13 Aug 2011 20:42:54 -0000 Received: (qmail 7871 invoked by uid 22791); 13 Aug 2011 20:42:54 -0000 X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL,BAYES_00,MSGID_MULTIPLE_AT X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.152) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 13 Aug 2011 20:42:28 +0000 Received: from md1.u-strasbg.fr (md1.u-strasbg.fr [IPv6:2001:660:2402::186]) by mailhost.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id p7DKgKxw017222 ; Sat, 13 Aug 2011 22:42:20 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from mailserver.u-strasbg.fr (ms7.u-strasbg.fr [130.79.204.16]) by md1.u-strasbg.fr (8.14.4/jtpda-5.5pre1) with ESMTP id p7DKgJfG093438 ; Sat, 13 Aug 2011 22:42:19 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from E6510Muller (lec67-4-82-230-53-140.fbx.proxad.net [82.230.53.140]) (user=mullerp mech=LOGIN) by mailserver.u-strasbg.fr (8.14.4/jtpda-5.5pre1) with ESMTP id p7DKgGFg040362 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) ; Sat, 13 Aug 2011 22:42:17 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) From: "Pierre Muller" To: "'Eli Zaretskii'" Cc: , References: <004901cc5907$85006320$8f012960$%muller@ics-cnrs.unistra.fr> <83vcu2wnvj.fsf@gnu.org> <83sjp6wmhb.fsf@gnu.org> <003c01cc59a1$49cc1520$dd643f60$%muller@ics-cnrs.unistra.fr> <83ei0pwpol.fsf@gnu.org> In-Reply-To: <83ei0pwpol.fsf@gnu.org> Subject: RE: [RFC] Fix problems related to Mingw/DJGPP file names containing colons Date: Sat, 13 Aug 2011 20:42:00 -0000 Message-ID: <005101cc59f9$7e87a790$7b96f6b0$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-08/txt/msg00276.txt.bz2 > -----Message d'origine----- > De=A0: gdb-patches-owner@sourceware.org [mailto:gdb-patches- > owner@sourceware.org] De la part de Eli Zaretskii > Envoy=E9=A0: samedi 13 ao=FBt 2011 12:51 > =C0=A0: Pierre Muller > Cc=A0: tromey@redhat.com; gdb-patches@sourceware.org > Objet=A0: Re: [RFC] Fix problems related to Mingw/DJGPP file names containing > colons >=20 > > From: "Pierre Muller" > > Cc: > > Date: Sat, 13 Aug 2011 12:10:53 +0200 > > > > > It's ugly and fragile, because the original name could be quoted. > > > > + /* Quote filenames containing ':' characters to avoid problems. */ > > + if (strchr (filename, ':') !=3D NULL && filename[0] !=3D '"') > > + sprintf (canonical_name, "\"%s\":%d", filename, sal->line); > > > > The second condition already takes care of not > > quoting already quoted file names. >=20 > What if the original name already includes quote characters? That can > happen on Posix platforms. You are right, but we are saved by the fact that colons are not allow on those platforms, isn't it? (otherwise all lists of directories like in the PATH environment variable would have a problem...) But there might be some 'exotic' file systems that allow both double-quotes and colons as valid characters in their filenames. In those cases, we would be in trouble... The main reason for now is that the code is acting directly on=20 addr_string pchar and should not modify it, otherwise, we could simply call a more complete quoting function that would escape internal colons (but of course we should then also look for and handle those escaped colons...) I am wondering how spaces within filenames are handled=20 inside GDB on mingw32... I just tested... No very well :( If you have "test space with name.exe" and "test.exe" executables within the same directory, GDB seems to load the correct file but runs the false one because no quoting is added to CreateProcess call.... Pierre