Show Ticket

Duplicates of this ticket: 5BBD2405

Status: closed, reported by cswilliams on 2009-08-31 (other)

Errors when executing Ruby on snow leopard

I'm using 1509.  Every time I try to run a Ruby script with command-R I get the following error:
/Applications/TextMate.app/Contents/SharedSupport/Support/lib/tm/process.rb:169:in `fcntl': Inappropriate ioctl for device (Errno::ENOTTY) from /Applications/TextMate.app/Contents/SharedSupport/Support/lib/tm/process.rb:169:in `run' from /Applications/TextMate.app/Contents/SharedSupport/Support/lib/tm/executor.rb:211:in `parse_version' from /Applications/TextMate.app/Contents/SharedSupport/Support/lib/tm/executor.rb:98:in `run' from /Users/me/Library/Application Support/TextMate/Bundles/Ruby.tmbundle/Support/RubyMate/run_script.rb:93

I'm also using the latest Ruby bundle from svn.
Note added by Allan Odgaard on 2009-09-01 04:06:44

I can’t produce that with the version of ruby included with Snow Leopard.

Did you install your own version of ruby? If so, please try without that.

Note added by cswilliams on 2009-09-01 08:03:21

I'm using the stock ruby that comes with snow leopard.  I played around with it more and it looks like the reason is that I'm using the 64-bit kernel.  When I boot into the 32-bit kernel, I don't get the error anymore.   Also, if it helps, commenting out that line seemed to fix everything when I was under the 64-bit kernel, didn't notice any ill side effects.

Hope that helps,
Chris

Note added by Taylor Luk on 2009-09-01 09:05:48

I can confirm the same problem using snow leopard (boot to 64bit kernel) and same error message when executing ruby scripts

http://pastie.org/574198

Since leopard boot to 32bit by default, (press 6 + 4 during boot up if you want to boot to 64bit kernel )

executing rspec has no issues using commont+r

Kind Regards

Taylor Luk

Note added by Allan Odgaard on 2009-09-01 09:26:44

Nice find! I’ll try reproduce when my main system is upgraded to Snow Leopard (capable of using the 64 bit kernel) and submit a bug report to Apple, probably affects the fcntl() BSD call as well (which ruby wraps for).

Note added by Loren Segal on 2009-09-08 05:53:09

I should point out that this is not a bug with the Ruby that Apple ships with. I can reproduce this with all of the Ruby versions I've compiled and installed on the system (I use Ruby 1.9.1p243 almost exclusively).

I can also reproduce this behaviour directly in C code: http://pastie.org/609258

Unless I'm doing something wrong with the C code, it seems the fcntl call doesn't support F_SETOWN. Note that errno=25 is ENOTTY (which is what Ruby reports).

Note added by Matthias Winkelmann on 2009-09-24 12:41:35

Getting the same error, when typesetting laTeX documents (with the apple+r command)

Note added by Taylor Luk on 2009-10-29 07:45:46

I have discovered a workaround, may be this as one solution we can explore to work around the problem.


To execute ruby script (select current bundle context to "rspec") then your program will execute file.

I suspect, rspec bundle is not build using fcntl() system call, i am sure there is other ways to manage a ruby process with alternative system call.

Anyone has ideas to share and perhaps work out a solid solution for those 64bit kernel users..


Taylor Luk

Cheers

Note added by Allan Odgaard on 2009-10-29 08:49:23

A workaround is already at http://wiki.macromates.com/Troubleshooting/SnowLeopard

Note added by Taylor Luk on 2009-10-29 09:53:40

Hello Allan,

Thanks for the quick reply, i have followed the instruction on that wiki, plus one of the beta version of that interactive input library. (with or without textmate restart)

It still has the same problem with 64bit snow leopard kernel, but thanks anyway.. it doesn't bother me too much

/Applications/TextMate.app/Contents/SharedSupport/Support/lib/tm/process.rb:169:in `fcntl': Inappropriate ioctl for device (Errno::ENOTTY) from /Applications/TextMate.app/Contents/SharedSupport/Support/lib/tm/process.rb:169:in `run' from /Applications/TextMate.app/Contents/SharedSupport/Support/lib/tm/executor.rb:211:in `parse_version' from /Applications/TextMate.app/Contents/SharedSupport/Support/lib/tm/executor.rb:98:in `run' from /Users/taylorluk/Library/Application Support/TextMate/Pristine Copy/Bundles/Ruby.tmbundle/Support/RubyMate/run_script.rb:85:in `'