Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PTY.open unusable because of fcntl error #5004

Closed
byteit101 opened this issue Jan 24, 2018 · 2 comments
Closed

PTY.open unusable because of fcntl error #5004

byteit101 opened this issue Jan 24, 2018 · 2 comments

Comments

@byteit101
Copy link
Member

Environment

  • jruby 9.1.15.0 (2.3.3) 2017-12-07 929fde8 OpenJDK 64-Bit Server VM 25.151-b12 on 1.8.0_151-b12 +jit [linux-x86_64]
  • Multiple linuxes (RHELs & Debian)

MRI

2.3.0 :001 > require 'pty'
 => true 
2.3.0 :002 > PTY.open{|m,s|}
 => nil 

Actual Behavior

jruby-9.1.15.0 :001 > require 'pty'
 => true 
jruby-9.1.15.0 :002 > PTY.open{|m,s|}
NotImplementedError: F_SETFL only supports O_NONBLOCK
	from org/jruby/RubyIO.java:2441:in `fcntl'
	from /home/byteit101/.rvm/rubies/jruby-9.1.15.0/lib/ruby/stdlib/pty.rb:140:in `hack_close_on_exec'
	from /home/byteit101/.rvm/rubies/jruby-9.1.15.0/lib/ruby/stdlib/pty.rb:57:in `block in open'
	from org/jruby/RubyArray.java:1735:in `each'
	from /home/byteit101/.rvm/rubies/jruby-9.1.15.0/lib/ruby/stdlib/pty.rb:54:in `open'
	from (irb):2:in `<eval>'
	from org/jruby/RubyKernel.java:994:in `eval'
	from org/jruby/RubyKernel.java:1292:in `loop'
	from org/jruby/RubyKernel.java:1114:in `catch'
	from org/jruby/RubyKernel.java:1114:in `catch'
	from /home/byteit101/.rvm/rubies/jruby-9.1.15.0/bin/irb:13:in `<main>'

@headius
Copy link
Member

headius commented Jan 24, 2018

Fallout from adding CLOEXEC support; now it is defined so code runs that didn't before, but not all paths have been fixed to support it.

headius added a commit that referenced this issue Jan 24, 2018

Verified

This commit was signed with the committer’s verified signature.
headius Charles Oliver Nutter
Note that this logic is still wrong when attempting to clear flags
since it only looks for them to be set. We should mimic CRuby's
fcntl logic when we have access to a real file descriptor, and
use the current logic (with fixes for clearing flags) as a
fallback only.
@headius headius added this to the JRuby 9.1.16.0 milestone Jan 24, 2018
@headius
Copy link
Member

headius commented Jan 24, 2018

Fixed for 9.1.16 by softening the restrictions on fcntl flags. The logic in there is not correct yet, since it doesn't clear flags and only sets specific ones (NONBLOCK and CLOEXEC) but it works properly again (and is no worse than before).

@headius headius closed this as completed Jan 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants