Bug 32226

Summary: Missing files for ruby-json
Product: Mageia Reporter: Jean-Georges Pinna <jgpinna>
Component: RPM PackagesAssignee: Pascal Terjan <pterjan>
Status: NEW --- QA Contact:
Severity: normal    
Priority: Normal    
Version: 9   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Source RPM: ruby-json-2.6.1-44.mga9.x86_64.rpm CVE:
Status comment:
Attachments: content that works
The gem file from rubygems.org

Description Jean-Georges Pinna 2023-09-01 13:05:25 CEST
Description of problem:
When i try to install redmine 5.0.5, when i run :
bundle exec rake generate_secret_token

i have the following error:
Ignoring bigdecimal-3.1.1 because its extensions are not built. Try: gem pristine bigdecimal --version 3.1.1
rake aborted!
LoadError: cannot load such file -- json/pure
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `block in require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:299:in `load_dependency'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `block in require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:299:in `load_dependency'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/core_ext/object/json.rb:4:in `<top (required)>'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `block in require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:299:in `load_dependency'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/core_ext/object.rb:13:in `<top (required)>'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `block in require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:299:in `load_dependency'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `require'
/usr/share/gems/gems/railties-6.1.7.2/lib/rails/configuration.rb:4:in `<top (required)>'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `block in require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:299:in `load_dependency'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `require'
/usr/share/gems/gems/railties-6.1.7.2/lib/rails/railtie/configuration.rb:3:in `<top (required)>'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `block in require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:299:in `load_dependency'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `require'
/usr/share/gems/gems/railties-6.1.7.2/lib/rails/railtie.rb:241:in `config'
/usr/share/gems/gems/railties-6.1.7.2/lib/rails/railtie.rb:146:in `config'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/i18n_railtie.rb:10:in `<class:Railtie>'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/i18n_railtie.rb:9:in `<module:I18n>'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/i18n_railtie.rb:8:in `<top (required)>'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `block in require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:299:in `load_dependency'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/railtie.rb:4:in `<top (required)>'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `block in require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:299:in `load_dependency'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `require'
/usr/share/gems/gems/railties-6.1.7.2/lib/rails.rb:17:in `<top (required)>'
/opt/redmine-5.0.5/config/application.rb:5:in `require'
/opt/redmine-5.0.5/config/application.rb:5:in `<top (required)>'
/opt/redmine-5.0.5/Rakefile:5:in `require'
/opt/redmine-5.0.5/Rakefile:5:in `<top (required)>'
/usr/local/share/gems/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/usr/local/share/gems/gems/bundler-2.4.19/lib/bundler/cli/exec.rb:58:in `load'
/usr/local/share/gems/gems/bundler-2.4.19/lib/bundler/cli/exec.rb:58:in `kernel_load'
/usr/local/share/gems/gems/bundler-2.4.19/lib/bundler/cli/exec.rb:23:in `run'
/usr/local/share/gems/gems/bundler-2.4.19/lib/bundler/cli.rb:492:in `exec'
/usr/local/share/gems/gems/bundler-2.4.19/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/usr/local/share/gems/gems/bundler-2.4.19/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/share/gems/gems/bundler-2.4.19/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/usr/local/share/gems/gems/bundler-2.4.19/lib/bundler/cli.rb:34:in `dispatch'
/usr/local/share/gems/gems/bundler-2.4.19/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/usr/local/share/gems/gems/bundler-2.4.19/lib/bundler/cli.rb:28:in `start'
/usr/local/share/gems/gems/bundler-2.4.19/exe/bundle:37:in `block in <top (required)>'
/usr/local/share/gems/gems/bundler-2.4.19/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
/usr/local/share/gems/gems/bundler-2.4.19/exe/bundle:29:in `<top (required)>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'

Caused by:
LoadError: cannot load such file -- json/ext/parser
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `block in require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:299:in `load_dependency'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `block in require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:299:in `load_dependency'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `block in require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:299:in `load_dependency'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/core_ext/object/json.rb:4:in `<top (required)>'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `block in require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:299:in `load_dependency'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/core_ext/object.rb:13:in `<top (required)>'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `block in require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:299:in `load_dependency'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `require'
/usr/share/gems/gems/railties-6.1.7.2/lib/rails/configuration.rb:4:in `<top (required)>'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `block in require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:299:in `load_dependency'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `require'
/usr/share/gems/gems/railties-6.1.7.2/lib/rails/railtie/configuration.rb:3:in `<top (required)>'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `block in require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:299:in `load_dependency'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `require'
/usr/share/gems/gems/railties-6.1.7.2/lib/rails/railtie.rb:241:in `config'
/usr/share/gems/gems/railties-6.1.7.2/lib/rails/railtie.rb:146:in `config'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/i18n_railtie.rb:10:in `<class:Railtie>'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/i18n_railtie.rb:9:in `<module:I18n>'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/i18n_railtie.rb:8:in `<top (required)>'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `block in require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:299:in `load_dependency'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/railtie.rb:4:in `<top (required)>'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `block in require'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:299:in `load_dependency'
/usr/share/gems/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `require'
/usr/share/gems/gems/railties-6.1.7.2/lib/rails.rb:17:in `<top (required)>'
/opt/redmine-5.0.5/config/application.rb:5:in `require'
/opt/redmine-5.0.5/config/application.rb:5:in `<top (required)>'
/opt/redmine-5.0.5/Rakefile:5:in `require'
/opt/redmine-5.0.5/Rakefile:5:in `<top (required)>'
/usr/local/share/gems/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/usr/local/share/gems/gems/bundler-2.4.19/lib/bundler/cli/exec.rb:58:in `load'
/usr/local/share/gems/gems/bundler-2.4.19/lib/bundler/cli/exec.rb:58:in `kernel_load'
/usr/local/share/gems/gems/bundler-2.4.19/lib/bundler/cli/exec.rb:23:in `run'
/usr/local/share/gems/gems/bundler-2.4.19/lib/bundler/cli.rb:492:in `exec'
/usr/local/share/gems/gems/bundler-2.4.19/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/usr/local/share/gems/gems/bundler-2.4.19/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/share/gems/gems/bundler-2.4.19/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/usr/local/share/gems/gems/bundler-2.4.19/lib/bundler/cli.rb:34:in `dispatch'
/usr/local/share/gems/gems/bundler-2.4.19/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/usr/local/share/gems/gems/bundler-2.4.19/lib/bundler/cli.rb:28:in `start'
/usr/local/share/gems/gems/bundler-2.4.19/exe/bundle:37:in `block in <top (required)>'
/usr/local/share/gems/gems/bundler-2.4.19/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
/usr/local/share/gems/gems/bundler-2.4.19/exe/bundle:29:in `<top (required)>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'


if i add the missing file (i extract thiese file from the official gems).
file list:
./lib/json/pure
./lib/json/pure/parser.rb
./lib/json/pure/generator.rb
./ext
./ext/json
./ext/json/Makefile
./ext/json/ext
./ext/json/ext/fbuffer
./ext/json/ext/fbuffer/fbuffer.h
./ext/json/ext/generator
./ext/json/ext/generator/.sitearchdir.-.json.-.ext.time
./ext/json/ext/generator/generator.c
./ext/json/ext/generator/generator.o
./ext/json/ext/generator/generator.h
./ext/json/ext/generator/Makefile
./ext/json/ext/generator/depend
./ext/json/ext/generator/generator.so
./ext/json/ext/generator/extconf.rb
./ext/json/ext/parser
./ext/json/ext/parser/parser.rl
./ext/json/ext/parser/.sitearchdir.-.json.-.ext.time
./ext/json/ext/parser/parser.c
./ext/json/ext/parser/parser.o
./ext/json/ext/parser/parser.so
./ext/json/ext/parser/Makefile
./ext/json/ext/parser/depend
./ext/json/ext/parser/parser.h
./ext/json/ext/parser/extconf.rb
./ext/json/extconf.rb



Version-Release number of selected component (if applicable):


How reproducible:
install redmine but not only, i think that it appens every time you run rake

Steps to Reproduce:
1.download redmine 5.0.5
2.extract files
3.run bundle exec rake generate_secret_token
Comment 1 Jean-Georges Pinna 2023-09-01 13:08:47 CEST
Created attachment 13963 [details]
content that works

i join a tar.gz with the json-2.6.1 gems content that works
Comment 2 Lewis Smith 2023-09-02 22:15:48 CEST
Thank you for this very detailed report, but it is not clear exactly which files are missing (it is all very json technical!).
The title talks of "Missing files".
At the head of the last file list, "if i add the missing file..."
Is that last list of all the missing files?

FWIW It looks as if the SRPM 'ruby-json' has not altered for years, so is it the right one?.
/lib/json/pure is in pkg ruby-json_pure in SRPM ruby-json_pure, which has been updated releatively recently.
json/ext/parser is in pkg ruby-json in SRPM ruby.

/ext/json exists in pkg php-devel, does not look relevant.
None of /ext/json/* are found by urpmf, so are ? missing.

[Ruby itself is currently maintained by pterjan]

CC: (none) => lewyssmith

Comment 3 Jean-Georges Pinna 2023-09-02 22:39:04 CEST
Created attachment 13967 [details]
The gem file from rubygems.org
Comment 4 Jean-Georges Pinna 2023-09-02 22:46:04 CEST
I add all these file to make rake work.
./lib/json/pure
./lib/json/pure/parser.rb
./lib/json/pure/generator.rb
./ext
./ext/json
./ext/json/Makefile
./ext/json/ext
./ext/json/ext/fbuffer
./ext/json/ext/fbuffer/fbuffer.h
./ext/json/ext/generator
./ext/json/ext/generator/.sitearchdir.-.json.-.ext.time
./ext/json/ext/generator/generator.c
./ext/json/ext/generator/generator.o
./ext/json/ext/generator/generator.h
./ext/json/ext/generator/Makefile
./ext/json/ext/generator/depend
./ext/json/ext/generator/generator.so
./ext/json/ext/generator/extconf.rb
./ext/json/ext/parser
./ext/json/ext/parser/parser.rl
./ext/json/ext/parser/.sitearchdir.-.json.-.ext.time
./ext/json/ext/parser/parser.c
./ext/json/ext/parser/parser.o
./ext/json/ext/parser/parser.so
./ext/json/ext/parser/Makefile
./ext/json/ext/parser/depend
./ext/json/ext/parser/parser.h
./ext/json/ext/parser/extconf.rb
./ext/json/extconf.rb


To find tese files i download the gem file from rubygems.org and extract the content. These files are in the gem file but not in the rpm file (also pure dir. I have check the json-pure-2.6.2 gemfile and it also contains pure dir)

I add pure dir it because json-pure is installed on my server and in the stack trace json/pure is missing

in the json-2.6.1.tar.gz file i put all the content of /usr/share/gems/gems/json-2.6.1 of my working platform

I have not check if it can work with less files

regards
Comment 5 Jean-Georges Pinna 2023-09-02 22:47:41 CEST
I am not sure all these files are needed
Comment 6 Lewis Smith 2023-09-05 21:39:25 CEST
Assigning this to pterjan for Ruby.

CC: lewyssmith => (none)
Assignee: bugsquad => pterjan

Comment 7 Pascal Terjan 2023-09-05 22:31:44 CEST
I just checked ruby-json and it doesn't seem to be missing any file, and it is working correctly. Most of the files you list are source files which are not expected to be in the package, as we build it and provide the resulting libraries.

Installing ruby-json_pure package should fix the error "LoadError: cannot load such file -- json/pure" you have.

For "Ignoring bigdecimal-3.1.1 because its extensions are not built. Try: gem pristine bigdecimal --version 3.1.1" I am not sure what the problem is. There seems to be a packaging bug (ruby package contains /usr/share/ruby/bigdecimal.rb while other files are in ruby-bigdecimal package) and I also get that error message but it seems to work fine if I install ruby-bigdecimal:

$ irb
Ignoring bigdecimal-3.1.1 because its extensions are not built. Try: gem pristine bigdecimal --version 3.1.1
irb(main):001:0> require 'bigdecimal'
=> true
irb(main):002:0> puts BigDecimal("2.0") / BigDecimal("0.0")
Infinity
=> nil
Comment 8 Pascal Terjan 2023-09-05 22:37:09 CEST
(Also, rake works fine here, I tested on a few things)
Comment 9 Jean-Georges Pinna 2023-09-06 09:12:25 CEST
I just check, if I remove all these file (json_pure is installed), the command "bundle exec rake generate_secret_token" the error appens.
I tried to reduce the number of files and it appears that only 
lib/json/pure.rb
lib/json/pure/generator.rb
lib/json/pure/parser.rb 
are necessary

bigdecimal is not the problem, i run gem pristine ... and it is ok
Comment 10 Pascal Terjan 2023-09-07 22:26:55 CEST
Again, json_pure seems to be working fine:

$ ruby -rjson/pure -e 'p JSON.parse("{\"x\": \"foo\"}")'
Ignoring bigdecimal-3.1.1 because its extensions are not built. Try: gem pristine bigdecimal --version 3.1.1
{"x"=>"foo"}

And it contains those files:
/usr/share/gems/gems/json_pure-2.6.2/lib/json/pure.rb
/usr/share/gems/gems/json_pure-2.6.2/lib/json/pure/generator.rb
/usr/share/gems/gems/json_pure-2.6.2/lib/json/pure/parser.rb

So it seems something you are using is not able to use that gem for some reason.
Comment 11 Jean-Georges Pinna 2023-09-07 23:19:46 CEST
Logically, this should work, but I did the test again this morning because I prefer to avoid tinkering with the contents of the packages. I did a minimal installation, with Ruby, RubyGems, ruby-json, ruby-json-pure, then I unpacked redmine 5.0.5 in /opt, then I ran the commands to install Redmine, and when I I launched "bundle exec rake generate_secret_token" I got the same error, perhaps it is linked to the Redmine Gemfile or a problem in the ruby configuration or to the fact that ruby-json is in version 2.6.1 and ruby-json_pure in version 2.6.2