bug-gdb
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

segfaults on i386-gnu


From: Marcus Brinkmann
Subject: segfaults on i386-gnu
Date: Mon, 29 Apr 2002 16:45:44 -0400
User-agent: Mutt/1.3.25i

Hi,

the CVS version from 20020401 (actually, the version that Debian
packages currently), has the following change to gdb_realpath:

2002-03-14  Richard Henderson  <address@hidden>

        * configure.in: Detect declaration for canonicalize_file_name.
        * utils.c (canonicalize_file_name): Declare, if needed.
        (gdb_realpath): Prefer realpath if available and
        usable.
        * config.in, configure: Rebuild.

However, the code doesn't check correctly if realpath is usable.
On the GNU/Hurd, realpath exists but it is _not_ usable, because there
is no limit to filenames, and neither PATH_MAX nor MAXHOSTNAMELEN is
defined, and pathconf on _PC_PATH_MAX returns -1.

# elif defined (HAVE_UNISTD_H) && defined(HAVE_ALLOCA)
  char *buf = alloca ((size_t)pathconf ("/", _PC_PATH_MAX));
#  define USE_REALPATH

alloca(-1) fails of course, and this leads to 0 being returned.

I see no reason to prefer realpath over canonicalize_path_name, its
interface is horrible broken (and not fixable, there is always the
possibility of a buffer overflow when using realpath on the Hurd)

I see no reason to prefer realpath over canonicalize_path_name, its
interface is horrible broken (and not fixable, eg there is no way
to use it "properly" on the Hurd, as its behaviour is not well
defined if PATH_MAX is not available.)  There is no rationale in the
ChangeLog, my suggestion is to revert the change and prefer
canonicalize_file_name if it is available, unless there is a reason
not to do so I don't know about.  But in any case, on the *-*-gnu*
platform, canonicalize_file_name must be used.  (That is the platform
I care about, but the current code is obviously broken on all
systems where _PC_PATH_MAX on / returns -1.  As I said, there is no
real portable fix for a system that does this and doesn't have
canonicalize_file_name, because realpath is quite broken).

Thanks,
Marcus





reply via email to

[Prev in Thread] Current Thread [Next in Thread]