* Re: [PATCH, RFA] Fix basename bug in symtab.c
[not found] <3B0039B5.7060704@cygnus.com>
@ 2001-05-14 23:19 ` Eli Zaretskii
0 siblings, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2001-05-14 23:19 UTC (permalink / raw)
To: Andrew Cagney; +Cc: Mark Kettenis, gdb-patches, jimb, ezannoni
On Mon, 14 May 2001, Andrew Cagney wrote:
> Just to be clear on one thing, the bug occures on FreeBSD. It isn't a
> FreeBSD bug :-). To quote the opengroup standard:
>
> > #include <libgen.h>
> > char *basename(char *path);
>
> ...
>
> > The basename() function may modify the string pointed to by path,
> > and may return a pointer to static storage that may then be
> > overwritten by a subsequent call to basename().
> >
> > This interface need not be reentrant.
Where can I see this standard?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH, RFA] Fix basename bug in symtab.c
@ 2001-05-15 1:31 Michael Elizabeth Chastain
0 siblings, 0 replies; 7+ messages in thread
From: Michael Elizabeth Chastain @ 2001-05-15 1:31 UTC (permalink / raw)
To: ac131313, eliz; +Cc: ezannoni, gdb-patches, jimb, kettenis
The Single Unix Spec is online here:
http://www.opengroup.org/onlinepubs/7908799/
Michael
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH, RFA] Fix basename bug in symtab.c
@ 2001-05-13 13:45 Mark Kettenis
2001-05-13 23:52 ` Eli Zaretskii
2001-05-14 6:41 ` Elena Zannoni
0 siblings, 2 replies; 7+ messages in thread
From: Mark Kettenis @ 2001-05-13 13:45 UTC (permalink / raw)
To: gdb-patches; +Cc: jimb, ezannoni
[Jim, Elena, sorry I keep saying cygnus instead of redhat :-(]
Here is a patch that fixes the problems discussed on the discussion
list. Eli pretty much convinced me that this is the right approach.
We can still discuss the other uses of basename() in GDB, but since
this fixes a rather serious bug on FreeBSD (and I suppose other
systems as well), I'd like to get this in ASAP.
Mark
Index: ChangeLog
from Mark Kettenis <kettenis@gnu.org>
* symtab.c (lookup_symtab_1): Use lbasename (NAME) instead of
basename (NAME). The FreeBSD basename returns a pointer to a
static buffer, even if it's simply returning a string identical to
its argument.
(lookup_partial_symtab): Likewise.
Index: symtab.c
===================================================================
RCS file: /cvs/src/src/gdb/symtab.c,v
retrieving revision 1.37
diff -u -p -r1.37 symtab.c
--- symtab.c 2001/05/11 17:48:31 1.37
+++ symtab.c 2001/05/13 19:37:21
@@ -154,7 +154,7 @@ got_symtab:
/* Now, search for a matching tail (only if name doesn't have any dirs) */
- if (basename (name) == name)
+ if (lbasename (name) == name)
ALL_SYMTABS (objfile, s)
{
if (FILENAME_CMP (basename (s->filename), name) == 0)
@@ -244,7 +244,7 @@ lookup_partial_symtab (char *name)
/* Now, search for a matching tail (only if name doesn't have any dirs) */
- if (basename (name) == name)
+ if (lbasename (name) == name)
ALL_PSYMTABS (objfile, pst)
{
if (FILENAME_CMP (basename (pst->filename), name) == 0)
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH, RFA] Fix basename bug in symtab.c
2001-05-13 13:45 Mark Kettenis
@ 2001-05-13 23:52 ` Eli Zaretskii
2001-05-14 6:41 ` Elena Zannoni
1 sibling, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2001-05-13 23:52 UTC (permalink / raw)
To: Mark Kettenis; +Cc: gdb-patches, jimb, ezannoni
On Sun, 13 May 2001, Mark Kettenis wrote:
> We can still discuss the other uses of basename() in GDB, but since
> this fixes a rather serious bug on FreeBSD (and I suppose other
> systems as well), I'd like to get this in ASAP.
I seconds this.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH, RFA] Fix basename bug in symtab.c
2001-05-13 13:45 Mark Kettenis
2001-05-13 23:52 ` Eli Zaretskii
@ 2001-05-14 6:41 ` Elena Zannoni
2001-05-14 7:02 ` Eli Zaretskii
1 sibling, 1 reply; 7+ messages in thread
From: Elena Zannoni @ 2001-05-14 6:41 UTC (permalink / raw)
To: Mark Kettenis; +Cc: gdb-patches, jimb, ezannoni
Mark Kettenis writes:
> [Jim, Elena, sorry I keep saying cygnus instead of redhat :-(]
>
> Here is a patch that fixes the problems discussed on the discussion
> list. Eli pretty much convinced me that this is the right approach.
> We can still discuss the other uses of basename() in GDB, but since
> this fixes a rather serious bug on FreeBSD (and I suppose other
> systems as well), I'd like to get this in ASAP.
>
> Mark
>
Yes, go ahead. I think this qualifies pretty much as an obvious fix.
Should you include libiberty.h ?
Thanks
Elena
>
> Index: ChangeLog
> from Mark Kettenis <kettenis@gnu.org>
>
> * symtab.c (lookup_symtab_1): Use lbasename (NAME) instead of
> basename (NAME). The FreeBSD basename returns a pointer to a
> static buffer, even if it's simply returning a string identical to
> its argument.
> (lookup_partial_symtab): Likewise.
>
> Index: symtab.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/symtab.c,v
> retrieving revision 1.37
> diff -u -p -r1.37 symtab.c
> --- symtab.c 2001/05/11 17:48:31 1.37
> +++ symtab.c 2001/05/13 19:37:21
> @@ -154,7 +154,7 @@ got_symtab:
>
> /* Now, search for a matching tail (only if name doesn't have any dirs) */
>
> - if (basename (name) == name)
> + if (lbasename (name) == name)
> ALL_SYMTABS (objfile, s)
> {
> if (FILENAME_CMP (basename (s->filename), name) == 0)
> @@ -244,7 +244,7 @@ lookup_partial_symtab (char *name)
>
> /* Now, search for a matching tail (only if name doesn't have any dirs) */
>
> - if (basename (name) == name)
> + if (lbasename (name) == name)
> ALL_PSYMTABS (objfile, pst)
> {
> if (FILENAME_CMP (basename (pst->filename), name) == 0)
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2001-05-15 1:31 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <3B0039B5.7060704@cygnus.com>
2001-05-14 23:19 ` [PATCH, RFA] Fix basename bug in symtab.c Eli Zaretskii
2001-05-15 1:31 Michael Elizabeth Chastain
-- strict thread matches above, loose matches on Subject: below --
2001-05-13 13:45 Mark Kettenis
2001-05-13 23:52 ` Eli Zaretskii
2001-05-14 6:41 ` Elena Zannoni
2001-05-14 7:02 ` Eli Zaretskii
2001-05-14 7:09 ` Elena Zannoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox