Ruby - debian sid - cannot load gems - irb works

Hi,

I’ve problem with my Ruby running debian unstable (sid) 2.6.39-2-amd64

I’ve got these packages from debian repository:

ii libruby1.8 1.8.7.352-2
Libraries necessary to run Ruby 1.8
ii libtcltk-ruby1.8 1.8.7.352-2
Tcl/Tk interface for Ruby 1.8
ii ruby1.8 1.8.7.352-2
Interpreter of object-oriented scripting language Ruby 1.8
ii ruby1.8-dev 1.8.7.352-2
Header files for compiling extension modules for the Ruby 1.8
ii ruby1.8-full 1.8.7.352-2
Ruby 1.8 full installation
ii rubygems 1.7.2-1
package management framework for Ruby libraries/applications
ii rubygems1.8 1.7.2-1
Transitional package for rubygems
ii rubygems 1.7.2-1
package management framework for Ruby libraries/applications
ii rubygems1.8 1.7.2-1
Transitional package for rubygems

Over gem install I’ve installed these gems

columnize (0.3.4)
dbd-odbc (0.2.5)
dbi (0.4.5)
deprecated (3.0.0, 2.0.1)
ini (0.1.1)
json (1.5.3)
linecache (0.46)
rbx-require-relative (0.0.5)
ruby-debug (0.10.4)
ruby-debug-base (0.10.4)

And this is env:

RubyGems Environment:

  • RUBYGEMS VERSION: 1.7.2
  • RUBY VERSION: 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
  • INSTALLATION DIRECTORY: /var/lib/gems/1.8/
  • RUBY EXECUTABLE: /usr/bin/ruby1.8
  • EXECUTABLE DIRECTORY: /var/lib/gems/1.8/bin
  • RUBYGEMS PLATFORMS:
    • ruby
    • x86_64-linux
  • GEM PATHS:
    • /var/lib/gems/1.8/
    • /home/hellth/.gem/ruby/1.8
    • /var/lib/gems/1.8
  • GEM CONFIGURATION:
    • :update_sources => true
    • :verbose => true
    • :benchmark => false
    • :backtrace => false
    • :bulk_threshold => 1000
  • REMOTE SOURCES:

I wrote a simple script:

#!/usr/bin/ruby -w
require ‘rubygems’
require ‘ini’

BEGIN {
puts “Initializing script”
}

Initialize backend

inifname=‘/path/to/some.ini’ unless inifname
@ini=Ini.load(inifname)
puts @ini

It returns this error:

ruby --debug parseini.rb
Exception `LoadError’ at /usr/lib/ruby/vendor_ruby/1.8/rubygems.rb:1340

  • no such file to load – rubygems/defaults/operating_system
    Initializing script
    Exception `LoadError’ at
    /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36 - no such
    file to load – ini
    #Ini:0x7ffb63852dc8

but! When I start irb and type:
irb(main):003:0> require ‘rubygems’
=> true
irb(main):004:0> require ‘ini’
=> true

I’ve tried to set a env variable:
GEM_HOME=/var/lib/gems/

but still the same, does anybody knows what’s goin on?
Or it would be better to ask at debian forum?

Thanks.

Here are some additional lists:

me@computer:/var/lib/gems/1.8# la *
cache:
total 1.2M
-rw-r–r-- 1 root root 14K Aug 8 16:09 columnize-0.3.4.gem
-rw-r–r-- 1 root root 43K Jul 20 18:21 dbd-odbc-0.2.5.gem
-rw-r–r-- 1 root root 72K Jul 20 18:21 dbi-0.4.5.gem
-rw-r–r-- 1 root root 6.0K Jul 20 18:21 deprecated-2.0.1.gem
-rw-r–r-- 1 root root 6.0K Aug 8 15:22 deprecated-3.0.0.gem
-rw-r–r-- 1 root root 9.0K Jul 20 18:21 ini-0.1.1.gem
-rw-r–r-- 1 root root 660K Jul 20 18:21 json-1.5.3.gem
-rw-r–r-- 1 root root 28K Aug 8 16:09 linecache-0.46.gem
-rw-r–r-- 1 root root 8.5K Aug 8 16:09 rbx-require-relative-0.0.5.gem
-rw-r–r-- 1 root root 129K Aug 8 16:09 ruby-debug-0.10.4.gem
-rw-r–r-- 1 root root 113K Aug 8 16:09 ruby-debug-base-0.10.4.gem
-rw-r–r-- 1 root root 74K Jul 20 18:22 ruby-odbc-0.99994.gem

doc:
total 28K
drwxr-xr-x 2 root root 4.0K Aug 8 16:09 columnize-0.3.4
drwxr-xr-x 4 root root 4.0K Aug 8 13:35 dbd-odbc-0.2.5
drwxr-xr-x 4 root root 4.0K Aug 8 13:35 dbi-0.4.5
drwxr-xr-x 4 root root 4.0K Jul 20 18:21 deprecated-2.0.1
drwxr-xr-x 4 root root 4.0K Aug 8 15:22 deprecated-3.0.0
drwxr-xr-x 4 root root 4.0K Aug 8 16:41 ini-0.1.1
drwxr-xr-x 4 root root 4.0K Aug 8 15:22 json-1.5.3

gems:
total 48K
drwxr-xr-x 4 root root 4.0K Aug 8 16:09 columnize-0.3.4
drwxr-xr-x 4 root root 4.0K Aug 8 13:34 dbd-odbc-0.2.5
drwxr-xr-x 7 root root 4.0K Aug 8 13:34 dbi-0.4.5
drwxr-xr-x 4 root root 4.0K Jul 20 18:21 deprecated-2.0.1
drwxr-xr-x 4 root root 4.0K Aug 8 15:22 deprecated-3.0.0
drwxr-xr-x 4 root root 4.0K Aug 8 16:41 ini-0.1.1
drwxr-xr-x 10 root root 4.0K Aug 8 15:22 json-1.5.3
drwxr-xr-x 5 root root 4.0K Aug 8 16:09 linecache-0.46
drwxr-xr-x 4 root root 4.0K Aug 8 16:09 rbx-require-relative-0.0.5
drwxr-xr-x 6 root root 4.0K Aug 8 16:09 ruby-debug-0.10.4
drwxr-xr-x 5 root root 4.0K Aug 8 16:09 ruby-debug-base-0.10.4
drwxr-xr-x 6 root root 4.0K Aug 8 13:35 ruby-odbc-0.99994

specifications:
total 44K
-rw-r–r-- 1 root root 1.9K Aug 8 16:09 columnize-0.3.4.gemspec
-rw-r–r-- 1 root root 1.1K Aug 8 13:34 dbd-odbc-0.2.5.gemspec
-rw-r–r-- 1 root root 1.3K Aug 8 13:34 dbi-0.4.5.gemspec
-rw-r–r-- 1 root root 687 Jul 20 18:21 deprecated-2.0.1.gemspec
-rw-r–r-- 1 root root 687 Aug 8 15:22 deprecated-3.0.0.gemspec
-rw-r–r-- 1 root root 1.2K Aug 8 16:41 ini-0.1.1.gemspec
-rw-r–r-- 1 root root 1.6K Aug 8 15:22 json-1.5.3.gemspec
-rw-r–r-- 1 root root 1.3K Aug 8 16:09 linecache-0.46.gemspec
-rw-r–r-- 1 root root 1.6K Aug 8 16:09
rbx-require-relative-0.0.5.gemspec
-rw-r–r-- 1 root root 1.3K Aug 8 16:09 ruby-debug-0.10.4.gemspec
-rw-r–r-- 1 root root 1.4K Aug 8 16:09 ruby-debug-base-0.10.4.gemspec

I’ve tried to add simlink to gems but no success

me@computer:/usr/lib/ruby/vendor_ruby/1.8/rubygems# la
total 424K
-rw-r–r-- 1 root root 2.2K Apr 29 16:51 builder.rb
-rw-r–r-- 1 root root 4.5K Apr 29 16:51 command_manager.rb
-rw-r–r-- 1 root root 13K Apr 29 16:51 command.rb
drwxr-xr-x 2 root root 4.0K Jul 20 18:19 commands
-rw-r–r-- 1 root root 9.2K Apr 29 16:51 config_file.rb
-rw-r–r-- 1 root root 1.8K Apr 29 16:51 custom_require.rb
-rw-r–r-- 1 root root 2.1K Apr 29 16:51 defaults.rb
-rw-r–r-- 1 root root 9.9K Apr 29 16:51 dependency_installer.rb
-rw-r–r-- 1 root root 5.4K Apr 29 16:51 dependency_list.rb
-rw-r–r-- 1 root root 5.2K Apr 29 16:51 dependency.rb
-rw-r–r-- 1 root root 1.7K Apr 29 16:51 deprecate.rb
-rw-r–r-- 1 root root 5.7K Apr 29 16:51 doc_manager.rb
-rw-r–r-- 1 root root 793 Apr 29 16:51 errors.rb
-rw-r–r-- 1 root root 2.4K Apr 29 16:51 exceptions.rb
drwxr-xr-x 2 root root 4.0K Jul 20 18:19 ext
-rw-r–r-- 1 root root 379 Apr 29 16:51 ext.rb
-rw-r–r-- 1 root root 2.0K Apr 29 16:51 format.rb
-rw-r–r-- 1 root root 1.9K Apr 29 16:51 gemcutter_utilities.rb
-rw-r–r-- 1 root root 2.3K Apr 29 16:51 gem_openssl.rb
-rw-r–r-- 1 root root 4.0K Apr 29 16:51 gem_path_searcher.rb
-rw-r–r-- 1 root root 2.4K Apr 29 16:51 gem_runner.rb
lrwxrwxrwx 1 root root 18 Aug 8 18:14 gems → /var/lib/gems/1.8/
-rw-r–r-- 1 root root 17K Apr 29 16:51 indexer.rb
-rw-r–r-- 1 root root 17K Apr 29 16:51 installer.rb
-rw-r–r-- 1 root root 3.3K Apr 29 16:51 installer_test_case.rb
-rw-r–r-- 1 root root 3.9K Apr 29 16:51 install_update_options.rb
-rw-r–r-- 1 root root 3.4K Apr 29 16:51 local_remote_options.rb
-rw-r–r-- 1 root root 972 Apr 29 16:51 mock_gem_ui.rb
-rw-r–r-- 1 root root 3.7K Apr 29 16:51 old_format.rb
drwxr-xr-x 3 root root 4.0K Jul 20 18:19 package
-rw-r–r-- 1 root root 2.6K Apr 29 16:51 package.rb
-rw-r–r-- 1 root root 3.8K Apr 29 16:51 package_task.rb
-rw-r–r-- 1 root root 5.4K Apr 29 16:51 platform.rb
-rw-r–r-- 1 root root 13K Apr 29 16:51 remote_fetcher.rb
-rw-r–r-- 1 root root 3.8K Apr 29 16:51 requirement.rb
-rw-r–r-- 1 root root 577 Apr 29 16:51 require_paths_builder.rb
-rw-r–r-- 1 root root 29K Apr 29 16:51 security.rb
-rw-r–r-- 1 root root 22K Apr 29 16:51 server.rb
-rw-r–r-- 1 root root 9.3K Apr 29 16:51 source_index.rb
-rw-r–r-- 1 root root 7.0K Apr 29 16:51 spec_fetcher.rb
-rw-r–r-- 1 root root 39K Apr 29 16:51 specification.rb
-rw-r–r-- 1 root root 21K Apr 29 16:51 test_case.rb
-rw-r–r-- 1 root root 3.4K Apr 29 16:51 test_utilities.rb
-rw-r–r-- 1 root root 1.3K Apr 29 16:51 text.rb
-rw-r–r-- 1 root root 7.1K Apr 29 16:51 uninstaller.rb
-rw-r–r-- 1 root root 12K Apr 29 16:51 user_interaction.rb
-rw-r–r-- 1 root root 4.7K Apr 29 16:51 validator.rb
-rw-r–r-- 1 root root 1.6K Apr 29 16:51 version_option.rb
-rw-r–r-- 1 root root 11K Apr 29 16:51 version.rb

Freak On A Leash escreveu isso a:

ruby --debug parseini.rb
Exception `LoadError’ at /usr/lib/ruby/vendor_ruby/1.8/rubygems.rb:1340

  • no such file to load – rubygems/defaults/operating_system
    Initializing script
    Exception `LoadError’ at
    /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36 - no such
    file to load – ini
    #Ini:0x7ffb63852dc8

This is not an error. You passed --debug to ruby and that makes Ruby to
print all exceptions that happen to the console.

When you do require "ini", The new require provided by first tries
to load from the current $LOAD_PATH, and that raises a LoadError because
ini is not installed system wide. Rubygems handles that exception,
activates the gem (what adds the gem’s lib/ directory to the
$LOAD_PATH), and then tries require 'ini' again. And it works: if you
notice the end of the output, your script wrote the Ini object to the
standard output.

On 09/08/11 at 01:17 +0900, Freak On A Leash wrote:

ii ruby1.8 1.8.7.352-2
package management framework for Ruby libraries/applications
json (1.5.3)

  • INSTALLATION DIRECTORY: /var/lib/gems/1.8/
    • :update_sources => true
      require ‘rubygems’

but! When I start irb and type:
irb(main):003:0> require ‘rubygems’
=> true
irb(main):004:0> require ‘ini’
=> true

Hi,

Isn’t that the expected behaviour of --debug?

  • Lucas