|
From: | Alessandro Vesely |
Subject: | Re: Bug in builtin function abspath |
Date: | Mon, 29 May 2006 09:50:03 +0200 |
User-agent: | Thunderbird 1.5.0.2 (Windows/20060308) |
Eli Zaretskii wrote:
. It handles the d:foo case by converting it to d:./fooJust a short comment: the abspath description says that it returns "an absolute name that does not contain any `.' or `..' components".That's true, but we cannot do any better in this case.Why shouldn't we use _getdcwd() to get the default path?Because there's no way of knowing whether that is what the user meant. _getdcwd will fetch the current directory _at_the_moment_ _of_the_call_, whereas the user _could_ have wanted the current directory when the result of $abspath is _used_, which could be an entirely different place, since it is not uncommon for a Makefile to chdir a lot. The patch I suggested leaves the semantics in the user's hands: they get what they wrote.
I though that, as $abspath is a function, it could be used much like pwd, i.e. get the path which is current at the time of the call so that one can refer to that frozen value even after changing directory. You mentioned $abspath is also useful to get uniform slashing, fine. (IMHO a $function giving the other slashing would be more useful for passing arguments to commands that only accept backslashes, but that's another story.) In general, all functions return a result computed at the time of the call: it won't change unless it is in turn a symbol. I can't grasp what you mean by _value at the time the result is used_.
[Prev in Thread] | Current Thread | [Next in Thread] |