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

Re: promised statfs patch



On Thu, 21 May 1998 03:22:00 +0200, Guido Flohr wrote:

GF>On Sun, May 17, 1998 at 05:56:29PM +0100, Petr Stehlik wrote:
GF>> Problem: both chdir("./") and statfs("./", &x) fail under TOS when the
GF>> CWD is root of a drive. chdir() reports -1, while statfs() goes crazy
GF>
GF>I've heard that many GEMDOS routines for normalizing pathnames are
GF>buggy.  Maybe this is only one out of many.

Yes, I think so as well. Just the GEMDOS function used in statfs() is
the most broken one, so must be fixed ASAP.

GF>strcmp() is overkill.  Besides, you should check $UNIXMODE before
GF>accepting a slash as a directory separator.

The unixmode stuff seems to be strange, anyway. For example with DJGPP
(DOS env for easy porting of Unix programs) you can mix both / and \ in
filenames and it always works fine (IIRC).

GF>As I said before, I think there are more bugs in GEMDOS concerning
GF>path names.  You should make it over to the safe side and
GF>normalize the pathnames yourself, i.e. eliminate all superfluos
GF>dots:
GF>
GF>  "./foo/../bar/./../bar/baz" ==> "bar/baz"
GF>  "/foo/../../bar" ==> Return an error, impossible.
GF>
GF>This is a nice programming task.  You'll have fun with it. ;-)

It might be a good idea to write a general function for normalizing
pathnames and either include it into unx2dos/dos2unx or call it in every
library function right before the GEMDOS gets called.

Petr
--
E-mail: stehlik@cas3.zlin.vutbr.cz                        PARCP developer
   WWW: http://cas3.zlin.vutbr.cz/~stehlik/              MiNTOS/Linux user
mirror: http://users.zln.cz/~pstehlik/                 Atari 800XL emulation
mirror: http://www.stehlik.cyberstrider.org/              Atari Falcon040