You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
jruby 9.3.9.0 (2.6.8) 2023-01-16 9.3.9.0+ds-8 OpenJDK 64-Bit Server VM 17.0.10+7-Debian-1deb12u1 on 17.0.10+7-Debian-1deb12u1 +jit [x86_64-linux] from Debian Bookworm
jruby 9.4.3.0 (3.1.4) 2023-12-20 9.4.3.0+ds OpenJDK 64-Bit Server VM 17.0.10+7-Debian-1 on 17.0.10+7-Debian-1 +jit [x86_64-linux] from Debian Experimental installed in a Debian Sid chroot
Empty JRUBY_OPTS and no command line flags used.
Operating system and platform: Linux [...] 6.1.0-17-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.69-1 (2023-12-30) x86_64 GNU/Linux
Other relevant info:
Environment variables:
LANG=de_CH.utf8 or LANG=de_CH.UTF-8
LANGUAGE=de_CH:de in some of the environments where I observed this
Expected Behavior
When opening a directory using File.open() and read()ing from it, I'd expect some kind of error, exception or so, since that should not work. For example, the following code fragment stored in a file called example.rb throws an exception when run with regular Ruby:
File.open('.').read(1)
Running with ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux-gnu]:
$ ruby example.rb
example.rb:1:in `read': Is a directory @ io_fread - . (Errno::EISDIR)
from example.rb:1:in `<main>'
Or running it with JRuby under the C locale:
$ LANG=C jruby example.rb
Errno::EISDIR: Is a directory - .
read at org/jruby/RubyIO.java:3248
read at org/jruby/RubyIO.java:3203
<main> at example.rb:1
Actual Behavior
Running the above script under my regular de_CH.utf8 locale (but I see the same behavior with e.g. LANG=en_US.UTF-8 or LANG=C.utf8/LANG=C.UTF-8 on my system, too - unsetting the LANGUAGE environment variable makes them work though), it does not throw an exception but just runs indefinitely and hangs using ~100% of one CPU core.
I noticed this issue when using Puppet Server running on JRuby on a machine which is using the de_CH.UTF-8 locale to deploy a directory structure containing a directory and a symbolic link to it. Puppet Server apparently tries to calculate a checksum over the linked directory in this case which is thus File.open()ed and read() from and appears to rely on read() throwing an exception, however, since read() never returned in this setup, Puppet Server just hung indefinitely.
Environment Information
jruby 9.3.9.0 (2.6.8) 2023-01-16 9.3.9.0+ds-8 OpenJDK 64-Bit Server VM 17.0.10+7-Debian-1deb12u1 on 17.0.10+7-Debian-1deb12u1 +jit [x86_64-linux]
from Debian Bookwormjruby 9.4.3.0 (3.1.4) 2023-12-20 9.4.3.0+ds OpenJDK 64-Bit Server VM 17.0.10+7-Debian-1 on 17.0.10+7-Debian-1 +jit [x86_64-linux]
from Debian Experimental installed in a Debian Sid chrootJRUBY_OPTS
and no command line flags used.Linux [...] 6.1.0-17-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.69-1 (2023-12-30) x86_64 GNU/Linux
Other relevant info:
LANG=de_CH.utf8
orLANG=de_CH.UTF-8
LANGUAGE=de_CH:de
in some of the environments where I observed thisExpected Behavior
When opening a directory using
File.open()
andread()
ing from it, I'd expect some kind of error, exception or so, since that should not work. For example, the following code fragment stored in a file calledexample.rb
throws an exception when run with regular Ruby:Running with
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux-gnu]
:Or running it with JRuby under the
C
locale:Actual Behavior
Running the above script under my regular
de_CH.utf8
locale (but I see the same behavior with e.g.LANG=en_US.UTF-8
orLANG=C.utf8
/LANG=C.UTF-8
on my system, too - unsetting theLANGUAGE
environment variable makes them work though), it does not throw an exception but just runs indefinitely and hangs using ~100% of one CPU core.I noticed this issue when using Puppet Server running on JRuby on a machine which is using the
de_CH.UTF-8
locale to deploy a directory structure containing a directory and a symbolic link to it. Puppet Server apparently tries to calculate a checksum over the linked directory in this case which is thusFile.open()
ed andread()
from and appears to rely onread()
throwing an exception, however, sinceread()
never returned in this setup, Puppet Server just hung indefinitely.My current, uneducated guess why JRuby behaves this way would be the current logic used to map certain exceptions to
Errno.*
constants which I assume to currently fail to do the right thing on at least some locales different fromC
.The text was updated successfully, but these errors were encountered: