From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
To: "'Tom Tromey'" <tromey@redhat.com>
Cc: <gdb-patches@sourceware.org>
Subject: RE: [RFA] Avoid calling stat with empty name in relocate_gdb_directory
Date: Fri, 14 Dec 2012 08:17:00 -0000 [thread overview]
Message-ID: <000601cdd9d3$5e3c7640$1ab562c0$@muller@ics-cnrs.unistra.fr> (raw)
In-Reply-To: <87d2ynxc6t.fsf@fleche.redhat.com>
> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Tom Tromey
> Envoyé : jeudi 6 décembre 2012 19:34
> À : Pierre Muller
> Cc : gdb-patches@sourceware.org
> Objet : Re: [RFA] Avoid calling stat with empty name in
> relocate_gdb_directory
>
> >>>>> "Pierre" == Pierre Muller <pierre.muller@ics-cnrs.unistra.fr>
writes:
>
> Pierre> Apparently it isn't used elsewhere...
> Pierre> Should we modify the default value to NULL instead of ""?
> Pierre> I do not master complicated autoconf things like
> Pierre> GDB_AC_DEFINE_RELOCATABLE well enough to know if this is
> Pierre> without problems...
>
> Pierre> Tell me if you think we should modify it at configury level or
> Pierre> if I should commit my patch, whatever you prefer!
>
> Maybe we should just skip computing gdb_sysroot if TARGET_SYSTEM_ROOT is
> "". What do you think?
I looked at the different calls to relocate_gdb_directory:
$ find . -iname "*.[chy]" |xargs grep -n gdb_directory
./charset.c:816: char *iconv_dir = relocate_gdb_directory (ICONV_BIN,
./defs.h:275:extern char *relocate_gdb_directory (const char *initial, int
flag);
./jit.c:1402: jit_reader_dir = relocate_gdb_directory (JIT_READER_DIR,
./main.c:120:relocate_gdb_directory (const char *initial, int flag)
./main.c:391: gdb_sysroot = relocate_gdb_directory (TARGET_SYSTEM_ROOT,
./main.c:394: debug_file_directory = relocate_gdb_directory (DEBUGDIR,
./main.c:397: gdb_datadir = relocate_gdb_directory (GDB_DATADIR,
./main.c:405: python_libdir = relocate_gdb_directory (tmp,
PYTHON_PATH_RELOCATABLE);
Are we sure all other calls have non-empty first argument?
Another problem is that currently the returned string is
always allocated, which means that we should at least
also use xstrdup ("") ...
I still think that the approach of testing if *dir == '\0'
is safer...
Pierre
next prev parent reply other threads:[~2012-12-14 8:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <29503.7594777115$1354726985@news.gmane.org>
2012-12-05 18:03 ` Tom Tromey
2012-12-05 23:45 ` Pierre Muller
[not found] ` <434.327257289802$1354751122@news.gmane.org>
2012-12-06 18:33 ` Tom Tromey
2012-12-14 8:17 ` Pierre Muller [this message]
[not found] ` <26262.2907328934$1355473042@news.gmane.org>
2013-01-03 20:59 ` Tom Tromey
2013-01-03 22:19 ` Pierre Muller
2012-12-05 17:02 Pierre Muller
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='000601cdd9d3$5e3c7640$1ab562c0$@muller@ics-cnrs.unistra.fr' \
--to=pierre.muller@ics-cnrs.unistra.fr \
--cc=gdb-patches@sourceware.org \
--cc=tromey@redhat.com \
/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