Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch 2/9] Code cleanup: Drop IS_ABSOLUTE_PATH checks
Date: Fri, 18 Jan 2013 20:16:00 -0000	[thread overview]
Message-ID: <20130118193457.GA4369@host2.jankratochvil.net> (raw)
In-Reply-To: <83r4li5mdj.fsf@gnu.org>

On Fri, 18 Jan 2013 20:20:24 +0100, Eli Zaretskii wrote:
> > Date: Fri, 18 Jan 2013 19:39:38 +0100
> > From: Jan Kratochvil <jan.kratochvil@redhat.com>
> > 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


  reply	other threads:[~2013-01-18 20:16 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-17 21:59 Jan Kratochvil
2013-01-18  7:32 ` Eli Zaretskii
2013-01-18 18:39   ` Jan Kratochvil
2013-01-18 19:20     ` Eli Zaretskii
2013-01-18 20:16       ` Jan Kratochvil [this message]
2013-01-18 20:40         ` Eli Zaretskii
2013-01-18 21:53           ` Jan Kratochvil
2013-01-19  6:50             ` Eli Zaretskii
2013-01-19 14:09               ` Jan Kratochvil
2013-01-19 15:18                 ` Eli Zaretskii
2013-01-19 15:27                   ` Jan Kratochvil
2013-01-19 16:02                     ` Eli Zaretskii
2013-01-21 17:06                     ` Jan Kratochvil
2013-01-21 18:46                       ` Tom Tromey
2013-01-21 19:43                         ` Jan Kratochvil
2013-01-21 20:48                           ` Tom Tromey
2013-01-18 21:11     ` [patch 2/9] Code cleanup: Drop IS_ABSOLUTE_PATH checks [resent] Jan Kratochvil

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=20130118193457.GA4369@host2.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    /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