Bug 250731 - lang/jruby: File.stat and File.lstat return incorrect values
Summary: lang/jruby: File.stat and File.lstat return incorrect values
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-ruby (Nobody)
URL:
Keywords:
Depends on: 253822
Blocks:
  Show dependency treegraph
 
Reported: 2020-10-30 03:08 UTC by dearblue
Modified: 2021-02-24 20:35 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (ruby)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dearblue 2020-10-30 03:08:27 UTC
I tried jruby-9.2.5.0.

Wrong result by jruby:

```
% jruby -e 'p File.lstat "/usr/local/share/jruby/lib/ruby/gems/shared/gems/rubygems-update-3.1.4"'
#<File::Stat dev=0xffffffffe2d119e8, ino=762223326, mode=0110572, nlink=6, uid=0, gid=2, rdev=0x0, size=721299000, blksize=721299000, blocks=1604023633, atime=1970-01-01 13:41:17 +0900, mtime=1970-01-01 09:00:00 +0900, ctime=1992-11-09 17:50:01 +0900, birthtime=2020-10-30 11:07:13 +0900>
```

Expected result:

```
% ruby27 -e 'p File.lstat "/usr/local/share/jruby/lib/ruby/gems/shared/gems/rubygems-update-3.1.4"'
#<File::Stat dev=0x2d6e9adee2d119e8, ino=430458, mode=040755, nlink=2, uid=0, gid=0, rdev=0xffffffffffffffff, size=2, blksize=131072, blocks=1, atime=2020-10-30 11:07:13.721299 +0900, mtime=2020-10-30 11:07:13.721299 +0900, ctime=2020-10-30 11:07:13.721299 +0900, birthtime=2020-10-30 11:07:13.721299 +0900>
```

This will determine that there is a "path problem" and will fail to update or install `jgem`.

```
% sudo jgem up --system --debug
NOTE:  Debugging mode prints all exceptions even when rescued
Updating rubygems-update
Exception `Resolv::DNS::Config::NXDomain' at /usr/local/share/jruby/lib/ruby/stdlib/resolv.rb:551 - _rubygems._tcp.api.rubygems.org
Exception `Resolv::DNS::Config::NXDomain' at /usr/local/share/jruby/lib/ruby/stdlib/resolv.rb:551 - _rubygems._tcp.api.rubygems.org
Exception `Resolv::DNS::Config::NXDomain' at /usr/local/share/jruby/lib/ruby/stdlib/resolv.rb:551 - _rubygems._tcp.api.rubygems.org.home
Exception `Resolv::DNS::Config::NXDomain' at /usr/local/share/jruby/lib/ruby/stdlib/resolv.rb:551 - _rubygems._tcp.api.rubygems.org.home
Exception `Resolv::ResolvError' at /usr/local/share/jruby/lib/ruby/stdlib/resolv.rb:496 - DNS result has no information for _rubygems._tcp.api.rubygems.org
Exception `Gem::Package::PathError' at /usr/local/share/jruby/lib/ruby/stdlib/rubygems/package.rb:441 - installing into parent path .bundle/config of /usr/local/share/jruby/lib/ruby/gems/shared/gems/rubygems-update-3.1.4 is not allowed
Exception `Gem::Package::PathError' at /usr/local/share/jruby/lib/ruby/stdlib/rubygems/package.rb:441 - installing into parent path .bundle/config of /usr/local/share/jruby/lib/ruby/gems/shared/gems/rubygems-update-3.1.4 is not allowed
Exception `Gem::Package::PathError' at /usr/local/share/jruby/lib/ruby/stdlib/rubygems/package.rb:441 - installing into parent path .bundle/config of /usr/local/share/jruby/lib/ruby/gems/shared/gems/rubygems-update-3.1.4 is not allowed
Exception `Gem::Package::PathError' at /usr/local/share/jruby/lib/ruby/stdlib/rubygems/package.rb:441 - installing into parent path .bundle/config of /usr/local/share/jruby/lib/ruby/gems/shared/gems/rubygems-update-3.1.4 is not allowed
ERROR:  While executing gem ... (Gem::Package::PathError)
    installing into parent path .bundle/config of /usr/local/share/jruby/lib/ruby/gems/shared/gems/rubygems-update-3.1.4 is not allowed
        /usr/local/share/jruby/lib/ruby/stdlib/rubygems/package.rb:441:in `block in mkdir_p_safe'
        org/jruby/RubyArray.java:1792:in `each'
        org/jruby/RubyEnumerable.java:1042:in `inject'
        /usr/local/share/jruby/lib/ruby/stdlib/rubygems/package.rb:435:in `mkdir_p_safe'
        /usr/local/share/jruby/lib/ruby/stdlib/rubygems/package.rb:381:in `block in extract_tar_gz'
        /usr/local/share/jruby/lib/ruby/stdlib/rubygems/package/tar_reader.rb:65:in `each'
        /usr/local/share/jruby/lib/ruby/stdlib/rubygems/package.rb:365:in `block in extract_tar_gz'
        /usr/local/share/jruby/lib/ruby/stdlib/rubygems/package.rb:474:in `block in open_tar_gz'
        org/jruby/ext/zlib/RubyGzipFile.java:97:in `wrap'
        /usr/local/share/jruby/lib/ruby/stdlib/rubygems/package.rb:471:in `open_tar_gz'
        /usr/local/share/jruby/lib/ruby/stdlib/rubygems/package.rb:364:in `extract_tar_gz'
        /usr/local/share/jruby/lib/ruby/stdlib/rubygems/package.rb:345:in `block in extract_files'
        /usr/local/share/jruby/lib/ruby/stdlib/rubygems/package/tar_reader.rb:65:in `each'
        /usr/local/share/jruby/lib/ruby/stdlib/rubygems/package.rb:342:in `block in extract_files'
        org/jruby/RubyIO.java:1154:in `open'
        /usr/local/share/jruby/lib/ruby/stdlib/rubygems/package/file_source.rb:30:in `with_read_io'
        /usr/local/share/jruby/lib/ruby/stdlib/rubygems/package.rb:339:in `extract_files'
        /usr/local/share/jruby/lib/ruby/stdlib/rubygems/installer.rb:794:in `extract_files'
        /usr/local/share/jruby/lib/ruby/stdlib/rubygems/installer.rb:304:in `install'
        /usr/local/share/jruby/lib/ruby/stdlib/rubygems/resolver/specification.rb:97:in `install'
        /usr/local/share/jruby/lib/ruby/stdlib/rubygems/request_set.rb:168:in `block in install'
        org/jruby/RubyArray.java:1792:in `each'
        /usr/local/share/jruby/lib/ruby/stdlib/rubygems/request_set.rb:156:in `install'
        /usr/local/share/jruby/lib/ruby/stdlib/rubygems/dependency_installer.rb:409:in `install'
        /usr/local/share/jruby/lib/ruby/stdlib/rubygems/commands/update_command.rb:213:in `update_gem'
        /usr/local/share/jruby/lib/ruby/stdlib/rubygems/commands/update_command.rb:241:in `update_rubygems'
        /usr/local/share/jruby/lib/ruby/stdlib/rubygems/commands/update_command.rb:90:in `execute'
        /usr/local/share/jruby/lib/ruby/stdlib/rubygems/command.rb:313:in `invoke_with_build_args'
        /usr/local/share/jruby/lib/ruby/stdlib/rubygems/command_manager.rb:171:in `process_args'
        /usr/local/share/jruby/lib/ruby/stdlib/rubygems/command_manager.rb:141:in `run'
        /usr/local/share/jruby/lib/ruby/stdlib/rubygems/gem_runner.rb:59:in `run'
        /usr/local/bin/jgem:21:in `<main>'
Exception `Gem::SystemExitException' at /usr/local/share/jruby/lib/ruby/stdlib/rubygems/user_interaction.rb:394 - Exiting RubyGems with exit_code 1
```
Comment 1 Thomas Hurst 2021-02-24 17:47:34 UTC
This was fixed several years ago - https://github.com/jnr/jnr-posix/issues/126


9.2.16.0 should be out today, be a good time to update the port.  Until then it should be marked BROKEN on 12+.
Comment 2 Thomas Hurst 2021-02-24 17:50:46 UTC
9.2.15.0, rather.