[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug in builtin function abspath (again)
From: |
Boris Kolpackov |
Subject: |
Re: Bug in builtin function abspath (again) |
Date: |
Wed, 31 May 2006 07:48:12 +0000 (UTC) |
User-agent: |
nn/6.6.5+RFC1522 |
Eli Zaretskii <address@hidden> writes:
> > > The realpath function will resolve both absolute and relative paths
> > > and return the absolute pathname corresponding to pathname. All but
> > > the last component of pathname must exist when realpath is called.
I just checked the page for realpath in SUS and I don't see anything
that implies this. My understanding that all components of the path
must exist.
> > It's not immediately clear to me what "all but the last component of
> > pathname" means; presumably it means that the directory containing the
> > last filename in pathname must exist, but that the filename itself does
> > not have to exist.
>
> Yes, that seems to be the meaning. But on platforms where there's no
> realpath, we currently use abspath that doesn't care whether that
> directory exists. Since Joe Random Hacker might not know whether her
> Make was built with or without realpath (and the docs don't even tell
> that realpath falls back on abspath), we should try to emulate
> realpath as close as we can, I think.
>
> I also thought about writing an emulation for realpath by using
> readlink. Unless I'm missing something, that shouldn't be too hard.
Here is the documentation for realpath and abspath from GNU make manual:
`$(realpath NAMES...)'
For each file name in NAMES return the canonical absolute name. A
canonical name does not contain any `.' or `..' components, nor
any repeated path separators (`/') or symlinks. In case of a
failure the empty string is returned. Consult the `realpath(3)'
documentation for a list of possible failure causes.
`$(abspath NAMES...)'
For each file name in NAMES return an absolute name that does not
contain any `.' or `..' components, nor any repeated path
separators (`/'). Note that, in contrast to `realpath' function,
`abspath' does not resolve symlinks and does not require the file
names to refer to an existing file or directory. Use the
`wildcard' function to test for existence.
I guess for platforms without realpath, we can emulate it as
func_wildcard (func_abspath (...)) rather than just func_abspath (...).
hth,
-boris