[Top][All Lists]

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

Re: Bug in builtin function abspath

From: Alessandro Vesely
Subject: Re: Bug in builtin function abspath
Date: Thu, 01 Jun 2006 16:02:22 +0200
User-agent: Thunderbird (Windows/20060308)

Earnie Boyd wrote:
Quoting Eli Zaretskii <address@hidden>:

Date: Wed, 31 May 2006 20:05:55 +0200
From: Andreas =?iso-8859-1?Q?B=FCning?= <address@hidden>
CC: grischka <address@hidden>, address@hidden

> Andreas, is there a _getdcwd function on OS/2?

There is an _abspath(char *out, const char *in, int size) function doing
exactly what make's abspath() is supposed to do.

What does _abspath do with "d:foo"?  That was the case we were

IMO, make should not consider d:foo as a valid path even though the OS does. But in reference to your question, I don't find _abspath or abspath documented and Looking in my reference material I found _fullpath which is documented here watch out for the line wrapping.

_fullpath is a wrapper around GetFullPathName: it possibly allocates
the buffer and maps errors to errno. Since _fullpath is not in OS/2
either, I'd use GetFullPathName directly.

I have some notes/questions about abspath in general and in win32:

- abspath does not follow symlinks, thus it does the wrong thing
whith, e.g., ./symlink/../not_in_cwd. However, that way it can be
applied to the names of not yet existing files.

- Windows does not have the equivalent of realpath.

- GetFullPathName does not look at the disk but knows the current
directory in each drive, much like make's abspath implementation.

- There is a GetLongPathName function that nicely recovers the
real filename capitalization. It fails like realpath for missing
components, but does not remove "." nor ".." and does not resolve
NTFS' junctions (symbolic links). Furthermore, GetLongPathName
is missing from older include files and may require NewAPIs.h

- There is also a GetShortPathName that retrieves the 8.3 form
of existing files. Even if it requires that directories exist,
its usage does make sense, because it is quite common that full
paths contain spaces in Windows.

One possibility to cope with the above would use a new function
to determine the last directory component that already exists
and is either out of starting_directory or on a different drive.
Next we apply realpath (on Unix) or GetShortPathName (on Windows)
to the first part of the path and then add further components in
the same way abspath currently does it. Would that break existing
use of abspath?

reply via email to

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