From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 127278 invoked by alias); 23 Jun 2015 15:50:54 -0000 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 Received: (qmail 127264 invoked by uid 89); 23 Jun 2015 15:50:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ob0-f171.google.com Received: from mail-ob0-f171.google.com (HELO mail-ob0-f171.google.com) (209.85.214.171) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 23 Jun 2015 15:50:53 +0000 Received: by obctg8 with SMTP id tg8so8936373obc.3 for ; Tue, 23 Jun 2015 08:50:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=03HFC4QduHaKzI/euUHQCjrKkmIATQ794E633KGev/E=; b=F94kNj2OSiCDE1FRFz6PxLzBtFITI13yOKhkO9Q7TiRTgU5vp4ACF3+hXwqQyle0u6 6zNWpBSIz6JDORGndx+nnohn9Rl8D8PEfNqYr8LCbsUTk0+YjFbMPQQjILhS3CoXqfMy OeJlDpoFJvhskiRx1B6IsKEi0YmES4Yn9rxRLtVi2yBHIr1qTUe2LlyIm6rOQ6mj596s BzYseUNXomJjuiwSxY5X3SW0LozZpBddR53SgrxF95rrHSTvGgG6rqFeeyOHT6KBUP9/ z8S9EtsZHYpTw/MG4dJoCcmvU2AeDKs1gUPwbK4RCqvV+X6jq6qujHLnIcUpBmwdO85G 2cMg== X-Gm-Message-State: ALoCoQnazbPPOGsJa7aSGTgKFyuBpeIQeOpL2eb0XpCJx4ghXQ0ZfJxztC51RR9JRjaRpmWjsDW/ MIME-Version: 1.0 X-Received: by 10.202.80.204 with SMTP id e195mr28863490oib.116.1435074651337; Tue, 23 Jun 2015 08:50:51 -0700 (PDT) Received: by 10.182.89.99 with HTTP; Tue, 23 Jun 2015 08:50:51 -0700 (PDT) In-Reply-To: <86bng8rtva.fsf@gmail.com> References: <1434775646-2625-1-git-send-email-martin.galvan@tallertechnologies.com> <86bng8rtva.fsf@gmail.com> Date: Tue, 23 Jun 2015 15:50:00 -0000 Message-ID: Subject: Re: [PING][PATCH] testsuite: Escape a loose '[' character inside a regexp. From: Doug Evans To: Yao Qi Cc: Martin Galvan , gdb-patches Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-06/txt/msg00478.txt.bz2 On Mon, Jun 22, 2015 at 4:10 AM, Yao Qi wrote: > Martin Galvan 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?