chicken-hackers
[Top][All Lists]
Advanced

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

Re: [Chicken-hackers] [PATCH] Two minor file-related patches


From: Evan Hanson
Subject: Re: [Chicken-hackers] [PATCH] Two minor file-related patches
Date: Tue, 26 Sep 2017 11:36:05 +1300

Hi Peter,

On 2017-09-25 20:53, Peter Bex wrote:
On Fri, Sep 15, 2017 at 10:07:18PM +1200, Evan Hanson wrote:
I tested with the "regular" MingW with MSYS (for some reason csi just
hangs on MSYS2...) and I see the following:

#;1> (use (chicken file))
#;2> (directory-exists? "c:/cygwin")
"c:/cygwin"
#;3> (directory-exists? "c:/cygwin/")
#f

Hmmm, this isn't the behaviour I'm seeing. On all of Cygwin, MinGW, and
MinGW with MSYS2, the pathname is returned in both of those cases while
a double trailing slash returns false. This is on Windows 7, with the
patch:

   #;1> (import (chicken file))
   #;2> (directory-exists? "c:/Windows")
   "c:/Windows"
   #;3> (directory-exists? "c:/Windows/")
   "c:/Windows/"
   #;4> (directory-exists? "c:/Windows//")
   #f

And without the patch:

   #;1> (import (chicken file))
   #;2> (directory-exists? "c:/Windows")
   "c:/Windows"
   #;3> (directory-exists? "c:/Windows/")
   "c:/Windows/"
   #;4> (directory-exists? "c:/Windows//")
   "c:/Windows//"
   #;5> (directory-exists? "c:/Windows///")
   #f

How to explain this difference in behaviour? Perhaps it's only "version
1" of MSYS that exhibits this problem with a single slash? I'll check
that hypothesis and report back. Either way, I think we should either
drop this code or make it handle any number of slashes, and I would
definitely prefer the first option if we can determine that current
releases of MSYS aren't broken in this particular way.

By the way, you can run csi under MSYS2 by using "winpty", which someone
has mercifully documented on the wiki at http://wiki.call-cc.org/msys2
(thanks, 69.172.145.198!).

Your points about the second patch are all good. I had been considering
the primary purpose of the procedure as a convenience -- "try but don't
throw" rather than "maybe try and maybe throw" -- so I wanted to remove
the potential for it to blow out. As you say, though, there are actually
three conceptual results to consider here (existed, didn't exist, still
exists), so a boolean return value isn't sufficient if it isn't going to
signal an error. I'll have another think and possibly rework the patch.

Cheers,

Evan



reply via email to

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