This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Better realpath
On Sun, Jun 15, 2008 at 08:58:29PM +0300, Eli Zaretskii wrote:
> I don't mind doing so, although libiberty has other customers, which
> could make it harder for us to do what we think is right (if it
> happens to be different from what lrealpath does now). Note that
> right now, lrealpath does not behave consistently with realpath (if
> the latter is unavailable), so it cannot be regarded as a portable
> version of realpath, at least not entirely so.
I assume that it is simply an oversight when Windows support was
added, not any deliberate divergence, and the libiberty maintainers
would be receptive to improvement.
> Not just for GDB, in general as well: it doesn't seem right to me to
> expand a file name and check for its existence in the same primitive,
> not to mention refuse to produce an expansion if the file does not
> exist. These are two separate tests, so they should be kept separate.
> (I actually suspect that realpath was used because it's more
> convenient -- no messy memory allocation issues -- but I have no facts
> to back this up.)
On the other hand, it seems perfectly reasonable to me; we can't know
where the file would really be if it existed, unless it exists, since
we don't know whether it would be a symlink.
--
Daniel Jacobowitz
CodeSourcery