Mail Archives: djgpp-workers/2001/09/27/05:01:03
> From: sandmann AT clio DOT rice DOT edu (Charles Sandmann)
> Date: Thu, 27 Sep 2001 00:56:32 -0500 (CDT)
>
> New version. Use getcwd. But if it fails, or returns root path and NT-like,
> or is on limit and short name, try the truename.
Thanks.
This version is fine with me, but if we do call truename, its result
should be verified that it begins with a drive letter, not with the
UNC-style \\SERVER\SHARE\ thingy. If we return the latter, things
will begin falling apart, because some library functions which call
_fixpath rely on it to return a d:/foo/bar style string. `stat' is
one place which relies on that. I also think that Fileutils rely on
that, but I'm not sure anymore (it was too long ago that I took a good
look at the Fileutils sources).
You could use the idea I sent yesterday to convert UNCs into drive
letters, couldn't you?
> This version seems to behave better with lfn=n on win95 and long paths,
> and also works with Windows 2000 on long paths and short paths. This is
> because chdir calls fixpath which calls getcwd without checking the
> return code, converted relative paths to incorrect absolute "root" path.
getcwd has only one documented error code: 0Fh, which means ``invalid
drive''. Returning the root directory in that case is The Right
Thing, I think: that's what DOS stores in its CDS structure for
invalid drives.
Btw, it would be interesting to see what error code do we get from W2K
for directories longer than 64 characters; perhaps that would allow us
to be smarter about the problem.
Also, RBIL says that you should set the carry flag before calling
214700h and 217147h, to make sure it is set on return if the call
fails (evidently, some versions of DOS only _clear_ carry if
successful, but don't _set_ it if not). Maybe we should do that as
well, if we are touching _fixpath.
Finally, IIRC, some library functions call _fixpath to support the
/dev/c/foo and /dev/env/FOO magic. So the modified _fixpath should be
tested against those file names, to make sure we don't break anything.
- Raw text -