[gambit-list] Error with iOS 5.0

Adam King akingcoder at gmail.com
Wed Jun 15 10:06:41 EDT 2011

You nailed it!  I'm most impressed :)  As I had updated to the latest gambit
git source last night trying to solve things, I went ahead and just
recompiled the lib with '--enable-debug' first (which I'll keep enabled till
end of beta) and got the following:

[1308145045.216022][USER]: [init] DATA ROOT:
fd=6 kind=31 direction=1
*** OS ERROR AT "os_io.c"@6073.1 -- errno=1 (Operation not permitted)

It was, indeed, setting it to non-blocking that was generating it.  After
adding your suggested mod, it now works again.  I was also able to replicate
the error in your iOS Gambit REPL App with:

>  (open-input-file "~~/Info.plist")
*** ERROR IN (console)@1.1 -- Operation not permitted

I'll do up a sample native ObjC version of setting the file to non-blocking
and submit it as a bug report to Apple.  Note: the same error occurs even
for app created files placed in 'Documents'. Thanks!


On Wed, Jun 15, 2011 at 7:44 AM, Marc Feeley <feeley at iro.umontreal.ca>wrote:

> On 2011-06-14, at 10:54 PM, Adam King wrote:
> >  Alright - that might very well be true - and it probably did say that in
> the 60 or more pages of legalese that I doubt most devs have time to read
> through.  I know... that's not a valid excuse  :)
> >
> >  So, let me reframe the question: in what circumstances could
> 'with-input-from-file' and 'load' generate an 'Operation not permitted'
> error on a unix type system even when the file is readable?  I tried tracing
> both funcs in the gambit lib, but soon got lost.  Maybe the lib is doing
> more than just fopen/fread?  I thought Marc might have an idea.
> >
> On Mac OS X (and Unix) the path to the file is opened with a call to
> "open", and then the file descriptor is set to non-blocking mode with a call
> to set_fd_blocking_mode (defined in os_io.c) which calls fcntl(fd,F_GETFL,
> 0) and fcntl(fd,F_SETFL, ...).  You might want to change the call to
> set_fd_blocking_mode on line 6072 of os_io.c
>      if (set_fd_blocking_mode (fd, 0) != 0) /* set nonblocking mode */
>        return err_code_from_errno ();
> to
>      if (kind != ___FILE_DEVICE_KIND)
>        if (set_fd_blocking_mode (fd, 0) != 0) /* set nonblocking mode */
>          return err_code_from_errno ();
> and see if that eliminates the problem.  Of course this makes I/O to files
> blocking, so the thread multiplexing will not work when doing I/O to files.
> Have you tried compiling the Gambit library with the --enable-debug
> configuration flag?  It will output traces for all the system calls which
> return errors, with the name of the source file and line number where the
> error was detected.
> Marc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20110615/6a461010/attachment.htm>

More information about the Gambit-list mailing list