Article View: gnu.gdb.bug
Article #2182segfaults on i386-gnu
From: Marcus Brinkmann
Date: Mon, 29 Apr 2002 20:45
Date: Mon, 29 Apr 2002 20:45
43 lines
2845 bytes
2845 bytes
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 <rth@redhat.com>
* 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
Technical Details
Message-ID:
<20020429204544.GI10812@gnu.org>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!nycmny1-snh1.gtei.net!news.gtei.net!news-out.visi.com!hermes.visi.com!nntp5.savvis.net!uunet!dfw.uu.net!ash.uu.net!spool0901.news.uu.net!wendy-fate.uu.net!bug-gdbShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f5053,5ef7e926cad251d5,start X-Google-Attributes: gidf5053,public X-Google-ArrivalTime: 2002-04-29 13:45:49 PST x-uunet-gateway: mr1.ash.ops.us.uu.net from bug-gdb to gnu.gdb.bug; Mon, 29 Apr 2002 20:45:47 GMT Date: Mon, 29 Apr 2002 16:45:44 -0400 From: marcus@gnu.org (Marcus Brinkmann) Subject: segfaults on i386-gnu Message-ID: <20020429204544.GI10812@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.25i Approved: bug-gdb-request@mail.gnu.org Newsgroups: gnu.gdb.bug Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!nycmny1-snh1.gtei.net!news.gtei.net!news-out.visi.com!hermes.visi.com!nntp5.savvis.net!uunet!dfw.uu.net!ash.uu.net!spool0901.news.uu.net!wendy-fate.uu.net!bug-gdb Sender: bug-gdb-request@mail.gnu.org Lines: 45