This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 1/2] Windows libibery: Don't quote args unnecessarily
- From: Eli Zaretskii <eliz at gnu dot org>
- To: Kai Tietz <ktietz at redhat dot com>
- Cc: mingw dot android at gmail dot com, gcc-patches at gcc dot gnu dot org, ktietz70 at gmail dot com, binutils at sourceware dot org, gdb-patches at sourceware dot org
- Date: Sun, 20 Apr 2014 09:07:23 +0300
- Subject: Re: [PATCH 1/2] Windows libibery: Don't quote args unnecessarily
- Authentication-results: sourceware.org; auth=none
- References: <1397936424-2290-1-git-send-email-mingw dot android at gmail dot com> <1397936424-2290-2-git-send-email-mingw dot android at gmail dot com> <1826621422 dot 9537772 dot 1397939013891 dot JavaMail dot zimbra at redhat dot com>
- Reply-to: Eli Zaretskii <eliz at gnu dot org>
> Date: Sat, 19 Apr 2014 16:23:33 -0400 (EDT)
> From: Kai Tietz <ktietz@redhat.com>
> Cc: gcc-patches@gcc.gnu.org, ktietz70@gmail.com, "binutils@sourceware.org Development" <binutils@sourceware.org>, gdb-patches@sourceware.org
>
> > + /* We only quote arguments that contain spaces, \n \t \v or " characters
> > + to prevent wasting 2 chars per argument of the CreateProcess 32k char
> > + limit We need only escape embedded double-quotes and immediately
> > preceeding backslash characters. A sequence of backslach characters
> > that is not follwed by a double quote character will not be
> > escaped. */
> > + needs_quotes = 0;
> > for (j = 0; argv[i][j]; j++)
> > {
> > + if (argv[i][j] == ' ' || argv[i][j] == '\n' ||
> > + argv[i][j] == '\t' || argv[i][j] == '"' )
> > + {
> Here seems to be an intend issue.
> > + needs_quotes = 1;
> > + }
I think you can omit the \n case, since command arguments on Windows
cannot possibly include newlines. Also, the comment speaks about \v,
but I see no code to handle that (and am not sure you should bother in
that case as well).
> Patch itself makes sense.
Yes, I agree.