View Issue Details

IDProjectCategoryView StatusLast Update
0000443AlmaLinux-8rubypublic2023-11-16 07:03
Reporteremacalinao Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Summary0000443: `gem install --install-dir` and `--bindir` behavior differs from documentation
DescriptionMethod operating_system_defaults at https://git.almalinux.org/rpms/ruby/src/branch/c8-stream-2.5/SOURCES/operating_system.rb#L98-L110 forces binary files to be written to bin/ in the user's home directory when `gem install` is executed as a non-root user, ignoring the GEM_HOME environment setting.

From https://guides.rubygems.org/command-reference/#gem-environment: "RubyGems’ default local repository can be overridden with the GEM_PATH and GEM_HOME environment variables. GEM_HOME sets the default repository to install into. "

The expected behavior is for binstubs to be installed in $GEM_HOME/bin by default, which differs from the AlmaLinux 8 implementation.


Referring to line https://git.almalinux.org/rpms/ruby/src/branch/c8-stream-2.5/SOURCES/operating_system.rb#L103 :

If the user specifies `--no-user-install`, having the operating_system_defaults method inject `--bindir #{File.join [Dir.home, 'bin']}` to put binstubs in the user's home directory (as it does now) doesn't make sense.

If the user specifies `--install-dir`, `gem install` will fail with output "ERROR: Use --install-dir or --user-install but not both" because operating_system_defaults adds `--user-install`. This renders the `--install-dir` option unusable on its own.

Both issues can be worked around by passing in additional arguments (see Steps to Reproduce section), but the solutions are unintuitive.


Suggestion: how about not adding both `--user-install` and `--bindir...` if the user specifies either `--no-user-install` or `--install-dir`?
Steps To ReproduceAs a user other than root:
> mkdir gem_home
> export GEM_HOME=$PWD/gem_home
> gem install bundler -v 1.17.3
> ls ~/bin/bundler # confirm that the bundler executable was written to ~/bin
> ls $GEM_HOME/bin # fails, directory doesn't exist

Work-around:
> gem install bundler -v 1.17.3 --bindir $GEM_HOME/bin


Also,
> gem install bundler --install-dir $GEM_HOME
ERROR: Use --install-dir or --user-install but not both

Work-around:
> gem install bundler --install-dir $GEM_HOME --no-user-install
TagsNo tags attached.
abrt_hash
URL

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2023-11-16 07:03 emacalinao New Issue