From: Doug Evans <dje@google.com>
To: Yao Qi <qiyaoltc@gmail.com>
Cc: Martin Galvan <martin.galvan@tallertechnologies.com>,
gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PING][PATCH] testsuite: Escape a loose '[' character inside a regexp.
Date: Tue, 23 Jun 2015 15:50:00 -0000 [thread overview]
Message-ID: <CADPb22TQonBn5rJrxyv-QL0OzgzXsH2-fLvkrnWBsAi5SDVk-A@mail.gmail.com> (raw)
In-Reply-To: <86bng8rtva.fsf@gmail.com>
On Mon, Jun 22, 2015 at 4:10 AM, Yao Qi <qiyaoltc@gmail.com> wrote:
> Martin Galvan <martin.galvan@tallertechnologies.com> writes:
>
>> Seems like an obvious fix to me, but I wanted to check just in case.
>> Ok to commit?
>
> Looks the code works well without this patch. Do we really need to
> escape '[' (and ']')?
In that case there's still something wrong, or at least still
something requiring patching.
When code isn't consistent readers start wondering if there's a problem,
and may decide to look into it.
And if there isn't a problem then it's just wasted time.
Here the inconsistency happens because it turns out that
in this context [ and \[ have the same effect.
[I added some printfs to gdb_test to find this out.]
I think that's a bug but I don't know what would be involved
in fixing it. OTOH, we should at least make the code consistent.
Generally [ is escaped to avoid Tcl treating it as a subexpression to evaluate.
But the escaping isn't needed if the string is wrapped in {} braces
which is the case here. Thus to me it feels like it's all the other
escaped brackets that need to be fixed (by changing \[ \] to [ ]).
OTOH, if one carried that through to completion it would
involve a *lot* of changes. help.exp is replete with them.
So for now I think the thing to do is apply this patch,
*and* add a comment somewhere (the function comment
for gdb_test?) documenting that [ == \[.
Thoughts?
next prev parent reply other threads:[~2015-06-23 15:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-20 4:47 Martin Galvan
2015-06-22 9:10 ` Yao Qi
2015-06-23 15:50 ` Doug Evans [this message]
2015-06-23 15:57 ` Martin Galvan
2015-06-23 16:09 ` Doug Evans
2015-06-23 17:05 ` Andreas Schwab
2015-06-23 17:13 ` Doug Evans
2015-06-23 16:28 ` Yao Qi
2015-06-23 16:43 ` Doug Evans
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CADPb22TQonBn5rJrxyv-QL0OzgzXsH2-fLvkrnWBsAi5SDVk-A@mail.gmail.com \
--to=dje@google.com \
--cc=gdb-patches@sourceware.org \
--cc=martin.galvan@tallertechnologies.com \
--cc=qiyaoltc@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox