Re: [Chicken-hackers] [PATCH] handle EOVERFLOW and ENOTDIR gracefully in file/directory-exists?

2011-10-10 Thread John Cowan
Christian Kellermann scripsit: John, how do other schemes handle this situation? Racket, Gauche, Gambit, Bigloo, Kawa, SISC, Chibi, Chez, SCM, Larceny, Ypsilon, Mosh, IronScheme, Scheme 9, Elk, VX return #f. MIT, scsh, Ikarus throw an exception. Scheme48, KSi, SigScheme, Scheme 7, UMB,

Re: [Chicken-hackers] [PATCH] handle EOVERFLOW and ENOTDIR gracefully in file/directory-exists?

2011-10-10 Thread Christian Kellermann
* John Cowan co...@mercury.ccil.org [111010 08:30]: Christian Kellermann scripsit: John, how do other schemes handle this situation? Racket, Gauche, Gambit, Bigloo, Kawa, SISC, Chibi, Chez, SCM, Larceny, Ypsilon, Mosh, IronScheme, Scheme 9, Elk, VX return #f. MIT, scsh, Ikarus throw an

Re: [Chicken-hackers] [PATCH] handle EOVERFLOW and ENOTDIR gracefully in file/directory-exists?

2011-10-10 Thread John Cowan
Christian Kellermann scripsit: Thanks for your research! Are you doing this manually btw or have you scripted it? Mostly manually. I have a trivial script called runallschemes that executes all 28 Schemes in turn. I put the code in the X selection, and then I can enter and execute it in each

Re: [Chicken-hackers] [PATCH] handle EOVERFLOW and ENOTDIR gracefully in file/directory-exists?

2011-10-09 Thread Peter Bex
On Sat, Oct 08, 2011 at 04:30:12PM -0400, John Cowan wrote: Here's my argument: file-exists? should return #t if the file definitely exists and #f if it definitely doesn't, and should throw an exception if the implementation cannot tell. In the case of ENAMETOOLONG, the file *cannot* exist,

Re: [Chicken-hackers] [PATCH] handle EOVERFLOW and ENOTDIR gracefully in file/directory-exists?

2011-10-09 Thread Felix
I think just returning #f on ENAMETOOLONG is asking for trouble. Simply punting on the issue by throwing an error is probably safer. I agree with this. cheers, felix ___ Chicken-hackers mailing list Chicken-hackers@nongnu.org

Re: [Chicken-hackers] [PATCH] handle EOVERFLOW and ENOTDIR gracefully in file/directory-exists?

2011-10-09 Thread John Cowan
Peter Bex scripsit: I think just returning #f on ENAMETOOLONG is asking for trouble. Simply punting on the issue by throwing an error is probably safer. Based on your evidence, I have to agree. ENAMETOOLONG should throw an error. -- A witness cannot give evidence of his John Cowan

[Chicken-hackers] [PATCH] handle EOVERFLOW and ENOTDIR gracefully in file/directory-exists?

2011-10-08 Thread Felix
This patches avoids an error when [file|directory]-exists? gets EOVERFLOW or ENOTDIR, which indicate an existing or no-existing file, respectively. cheers, felix commit 473edf9428a7bc38fc033e86d0bbcb362f1cd2d8 Author: felix fe...@call-with-current-continuation.org Date: Sat Oct 8 15:09:42

Re: [Chicken-hackers] [PATCH] handle EOVERFLOW and ENOTDIR gracefully in file/directory-exists?

2011-10-08 Thread Christian Kellermann
Hi Alan! * Alan Post alanp...@sunflowerriver.org [111008 18:48]: On OpenBSD, I think you'd like to handle ENAMETOOLONG by returning C_SCHEME_FALSE too. On that platform, EOVERFLOW is not returned from stat. (And I'm not sure what it is signalling, so I don't know what this if statement is

Re: [Chicken-hackers] [PATCH] handle EOVERFLOW and ENOTDIR gracefully in file/directory-exists?

2011-10-08 Thread Alan Post
On Sat, Oct 08, 2011 at 07:31:12PM +0200, Christian Kellermann wrote: Hi Alan! * Alan Post alanp...@sunflowerriver.org [111008 18:48]: On OpenBSD, I think you'd like to handle ENAMETOOLONG by returning C_SCHEME_FALSE too. On that platform, EOVERFLOW is not returned from stat. (And I'm

Re: [Chicken-hackers] [PATCH] handle EOVERFLOW and ENOTDIR gracefully in file/directory-exists?

2011-10-08 Thread Christian Kellermann
* Alan Post alanp...@sunflowerriver.org [111008 20:58]: Here would be the sort of pseudocode I mean: file = 'really-long-file-path' for-each dir in /mnt/* path = dir + file file-exists? path Who knows what a user has mounted inside /mnt. It might a

Re: [Chicken-hackers] [PATCH] handle EOVERFLOW and ENOTDIR gracefully in file/directory-exists?

2011-10-08 Thread Alan Post
On Sat, Oct 08, 2011 at 09:09:26PM +0200, Christian Kellermann wrote: * Alan Post alanp...@sunflowerriver.org [111008 20:58]: Here would be the sort of pseudocode I mean: file = 'really-long-file-path' for-each dir in /mnt/* path = dir + file

Re: [Chicken-hackers] [PATCH] handle EOVERFLOW and ENOTDIR gracefully in file/directory-exists?

2011-10-08 Thread John Cowan
Christian Kellermann scripsit: Wouldn't the right answer be in this case We don't know whether this file exists, because some Bad Thing(tm) happened while trying to find out instead of yes or no? No. If ENAMETOOLONG is returned, the file can't possibly exist (because the filesystem has no

Re: [Chicken-hackers] [PATCH] handle EOVERFLOW and ENOTDIR gracefully in file/directory-exists?

2011-10-08 Thread Alan Post
On Sat, Oct 08, 2011 at 09:43:17PM +0200, Christian Kellermann wrote: * Alan Post alanp...@sunflowerriver.org [111008 21:37]: Here is my new proposal: Do not check for ENAMETOOLONG (I withdraw that proposal) and wait for a user to encounter a problem in real life for which adding an

Re: [Chicken-hackers] [PATCH] handle EOVERFLOW and ENOTDIR gracefully in file/directory-exists?

2011-10-08 Thread Alan Post
On Sat, Oct 08, 2011 at 04:11:47PM -0400, John Cowan wrote: Christian Kellermann scripsit: Wouldn't the right answer be in this case We don't know whether this file exists, because some Bad Thing(tm) happened while trying to find out instead of yes or no? No. If ENAMETOOLONG is

Re: [Chicken-hackers] [PATCH] handle EOVERFLOW and ENOTDIR gracefully in file/directory-exists?

2011-10-08 Thread Alan Post
On Sat, Oct 08, 2011 at 04:11:47PM -0400, John Cowan wrote: Christian Kellermann scripsit: Wouldn't the right answer be in this case We don't know whether this file exists, because some Bad Thing(tm) happened while trying to find out instead of yes or no? No. If ENAMETOOLONG is

Re: [Chicken-hackers] [PATCH] handle EOVERFLOW and ENOTDIR gracefully in file/directory-exists?

2011-10-08 Thread John Cowan
Alan Post scripsit: No. If ENAMETOOLONG is returned, the file can't possibly exist (because the filesystem has no way to represent it), so it's always correct to return #f in that case. (I'm sorry this got divided into three messages! I'm typing faster than I'm thinking...) Slow down

Re: [Chicken-hackers] [PATCH] handle EOVERFLOW and ENOTDIR gracefully in file/directory-exists?

2011-10-08 Thread Christian Kellermann
Hi Alan! * Alan Post alanp...@sunflowerriver.org [111008 22:23]: I'm sorry that I don't seem to be communicating well today: I'm only in and out at my computer trying to do other things and it seems to be affecting my ability to be articulate. Thanks for bearing with me, I think I have

Re: [Chicken-hackers] [PATCH] handle EOVERFLOW and ENOTDIR gracefully in file/directory-exists?

2011-10-08 Thread Christian Kellermann
* John Cowan co...@mercury.ccil.org [111008 22:30]: Here's my argument: file-exists? should return #t if the file definitely exists and #f if it definitely doesn't, and should throw an exception if the implementation cannot tell. In the case of ENAMETOOLONG, the file *cannot* exist, so

Re: [Chicken-hackers] [PATCH] handle EOVERFLOW and ENOTDIR gracefully in file/directory-exists?

2011-10-08 Thread John Cowan
Christian Kellermann scripsit: I personally prefer to get yelled at when I provide nonsense input to a function but that may be irrellevant if everyone else would expect to get different things. It's not really nonsense. For example, if your current directory is on a FAT (not VFAT) file