chicken-hackers
[Top][All Lists]
Advanced

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

Re: [Chicken-hackers] [PATCH] handle EOVERFLOW and ENOTDIR gracefully in


From: Alan Post
Subject: Re: [Chicken-hackers] [PATCH] handle EOVERFLOW and ENOTDIR gracefully in file/directory-exists?
Date: Sat, 8 Oct 2011 12:58:29 -0600

On Sat, Oct 08, 2011 at 07:31:12PM +0200, Christian Kellermann wrote:
> Hi Alan!
> 
> * Alan Post <address@hidden> [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 checking for.)
> 
> It is still checking for EOVERFLOW, as it is defined in
> include/sys/errno.h, so it at least will not take a wrong turn,
> despite being useless here for OpenBSD.
> 
> > Will you add a check for ENAMETOOLONG?
> 
> So a ENAMETOOLONG should signal that the files does not exist? IMHO
> this just covers up a potential programming error. The default is
> to hand the result through to scheme where it will raise a sytem
> error if the result is neither #t nor #f.
> 
> Or am I missing your point?
>  

Here is what I was thinking:

  * A particular filesystem might have a maximum path size.
        * This is going to vary from filesystem to filesystem.
        * if you're asking whether something exists on a filesystem,
                you should get the same answer regardless of whether you
                overflowed that filesystem's maximum pathsize: it might
                well succeed on another filesystem.

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
regretable filesystem.

I grant that this may not be sufficient reason to catch and
convert this error, though I would for exactly the use case above.
Thoughts?

-Alan
-- 
.i ma'a lo bradi cu penmi gi'e du



reply via email to

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