Date: Thu, 27 Sep 2001 10:59:11 +0200 From: "Eli Zaretskii" Sender: halo1 AT zahav DOT net DOT il To: sandmann AT clio DOT rice DOT edu Message-Id: <1438-Thu27Sep2001105911+0300-eliz@is.elta.co.il> X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.9 CC: djgpp-workers AT delorie DOT com In-reply-to: <10109270556.AA13368@clio.rice.edu> (sandmann@clio.rice.edu) Subject: Re: fixpath patch (rev 2) References: <10109270556 DOT AA13368 AT clio DOT rice DOT edu> Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > 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.