This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PING][PATCH] testsuite: Escape a loose '[' character inside a regexp.
- From: Doug Evans <dje at google dot com>
- To: Yao Qi <qiyaoltc at gmail dot com>
- Cc: Martin Galvan <martin dot galvan at tallertechnologies dot com>, gdb-patches <gdb-patches at sourceware dot org>
- Date: Tue, 23 Jun 2015 11:08:58 -0500
- Subject: Re: [PING][PATCH] testsuite: Escape a loose '[' character inside a regexp.
- Authentication-results: sourceware.org; auth=none
- References: <1434775646-2625-1-git-send-email-martin dot galvan at tallertechnologies dot com> <86bng8rtva dot fsf at gmail dot com> <CADPb22TQonBn5rJrxyv-QL0OzgzXsH2-fLvkrnWBsAi5SDVk-A at mail dot gmail dot com>
On Tue, Jun 23, 2015 at 10:50 AM, Doug Evans <dje@google.com> wrote:
> 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.
Actually, this is arguably s.o.p. Bleah.
Otherwise \r\n inside {} won't get expanded as CR,LF.
E.g. compare
set foo {a\r\nb}
vs
set foo "a\r\nb"
That \[ gets expanded as [ is no different than \z getting expanded as z.
% set foo "a\zb\[c"
azb[c
%
Still a bit confusing since \[ vs [ different in most contexts in Tcl.
So I'd still advocate for a comment.