Jordan Sissel created JRUBY-6280:
------------------------------------

             Summary: Fails to open fifo for writing.
                 Key: JRUBY-6280
                 URL: https://jira.codehaus.org/browse/JRUBY-6280
             Project: JRuby
          Issue Type: Bug
    Affects Versions: JRuby 1.6.5
         Environment: linux
            Reporter: Jordan Sissel
            Assignee: Thomas E Enebo


JRuby fails to open a fifo for writing because it tries to seek in it.

Create a fifo on the filesystem like so:

{noformat}
% mkfifo /tmp/fifo
{noformat}

I tested this on Linux. It is likely other platforms are affected.

Example code showing it working in MRI 1.9.2 and failing in JRuby 1.6.5 (both 
1.8 and 1.9 mode)

{noformat}
% rvm use 1.9.2; ruby -e 'File.new("/tmp/fifo", "w"); puts :OK'
Using /home/jls/.rvm/gems/ruby-1.9.2-p290
OK
% rvm use 1.6.5; ruby -e 'File.new("/tmp/fifo", "w"); puts :OK'
Using /home/jls/.rvm/gems/jruby-1.6.5
IOError: Illegal seek
  initialize at org/jruby/RubyFile.java:442
         new at org/jruby/RubyIO.java:868
      (root) at -e:1
% rvm use 1.6.5; ruby --1.9 -e 'File.new("/tmp/fifo", "w"); puts :OK'
Using /home/jls/.rvm/gems/jruby-1.6.5
IOError: Illegal seek
  initialize at org/jruby/RubyFile.java:464
         new at org/jruby/RubyIO.java:868
      (root) at -e:1
{noformat}

Relevant data from strace:

{noformat}
3086  open("/tmp/fifo", O_RDWR|O_CREAT, 0666) = 5
3086  lseek(5, 0, SEEK_CUR)             = -1 ESPIPE (Illegal seek)
{noformat}

Example code showing using the Java API working fine. Mainly, the point of me 
trying this in 'pure java api' was to see if it was a something related to a 
missed-feature in Java's cross-platformness

{noformat}
>> writer = java.io.FileWriter.new(java.io.File.new("/tmp/fifo"))
=> #<Java::JavaIo::FileWriter:0x33cfa965>
>> writer.write("Hello")
=> nil
>> writer.flush()
=> nil
{noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to