From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31281 invoked by alias); 18 Jan 2013 20:16:21 -0000 Received: (qmail 31264 invoked by uid 22791); 18 Jan 2013 20:16:18 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 18 Jan 2013 20:16:13 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r0IKG9F5021291 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 18 Jan 2013 15:16:12 -0500 Received: from host2.jankratochvil.net (ovpn-116-19.ams2.redhat.com [10.36.116.19]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r0IJYwpj010256 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Fri, 18 Jan 2013 14:35:00 -0500 Date: Fri, 18 Jan 2013 20:16:00 -0000 From: Jan Kratochvil To: Eli Zaretskii Cc: gdb-patches@sourceware.org Subject: Re: [patch 2/9] Code cleanup: Drop IS_ABSOLUTE_PATH checks Message-ID: <20130118193457.GA4369@host2.jankratochvil.net> References: <20130117215846.GC16249@host2.jankratochvil.net> <83fw1z6j5i.fsf@gnu.org> <20130118183938.GA1255@host2.jankratochvil.net> <83r4li5mdj.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <83r4li5mdj.fsf@gnu.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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: 2013-01/txt/msg00454.txt.bz2 On Fri, 18 Jan 2013 20:20:24 +0100, Eli Zaretskii wrote: > > Date: Fri, 18 Jan 2013 19:39:38 +0100 > > From: Jan Kratochvil > > Cc: gdb-patches@sourceware.org > > > > On Fri, 18 Jan 2013 08:32:25 +0100, Eli Zaretskii wrote: > > > > int > > > > compare_filenames_for_search (const char *filename, const char *search_name) > > > > @@ -171,7 +171,8 @@ compare_filenames_for_search (const char *filename, const char *search_name) > > > > to put the "c:file.c" name into debug info. Such compatibility > > > > works only on GDB built for DOS host. */ > > > > return (len == search_len > > > > - || IS_DIR_SEPARATOR (filename[len - search_len - 1]) > > > > + || (!IS_ABSOLUTE_PATH (search_name) > > > > + && IS_DIR_SEPARATOR (filename[len - search_len - 1])) > > > > || (HAS_DRIVE_SPEC (filename) > > > > && STRIP_DRIVE_SPEC (filename) == &filename[len - search_len])); > > > > } > > > > > > I don't understand why the "match up to a slash" rule is now limited > > > to non-absolute file names. > > > > FILENAME may contain for example: /path/to//file.c > > Then we may request to put a breakpoint to: /file.c:main > > And without > > the '!IS_ABSOLUTE_PATH (search_name) &&' part it would falsely match. > > Thanks for explaining. However, IMO i's wrong to test for double > slash with IS_ABSOLUTE_PATH, because the same could happen with > foo//bar.c, right? So why not explicitly test for consecutive > slashes instead? I do not understand much what do you suggest. Remaining problem is that /path/to//file.c does not match /path/to/file.c or that /path/file.c does not match /path/to/../file.c and so on. I find these bugs outside of the scope of this patchset, this patchset only tried to handle correctly /path/to/file.c matching, which was big enough IMO to post it and upstream. This specific patch is "Code cleanup" so it should have no visible changes, it is only simplification of the caller-callee implementation so it mimics in the callee (compare_filenames_for_search) what every of the callers was doing. Thanks, Jan