Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chruby puts a missing directory on the PATH #489

Open
schneems opened this issue Feb 3, 2023 · 2 comments
Open

Chruby puts a missing directory on the PATH #489

schneems opened this issue Feb 3, 2023 · 2 comments
Assignees
Labels
Milestone

Comments

@schneems
Copy link

schneems commented Feb 3, 2023

Description

Ruby install + chruby puts an missing directory on PATH. It's not a bug per-say but I wanted to check and see if it's intentional or not.

I wrote a tool to help people diagnose PATH issues and noticed this chruby while testing.

Steps To Reproduce

$ cargo install cargo-whichp
$ cargo whichp a-command-that-does-not-exist
Program "a-command-that-does-not-exist" not found

Info: No other executables with the same name are found on the PATH

Info: These executables have the closest spelling to "a-command-that-does-not-exist" but did not match:
      "mbedtls-selftest", "qt-cmake-standalone-test", "g-ir-annotation-tool"

Info: The following directories on PATH were searched (top to bottom):
  - [OK     ] "/Users/rschneeman/.gem/ruby/3.1.3/bin"
  - [MISSING] "/Users/rschneeman/.rubies/ruby-3.1.3/lib/ruby/gems/3.1.0/bin"
  - [OK     ] "/Users/rschneeman/.rubies/ruby-3.1.3/bin"
  - [OK     ] "/Users/rschneeman/.cargo/bin"
  - [OK     ] "/usr/local/bin"
  - [OK     ] "/usr/local/sbin"
  - [OK     ] "/Users/rschneeman/bin/dotfiles/bin/"
  - [OK     ] "/usr/local/bin"
  - [OK     ] "/System/Cryptexes/App/usr/bin"
  - [OK     ] "/usr/bin"
  - [OK     ] "/bin"
  - [OK     ] "/usr/sbin"
  - [OK     ] "/sbin"
  - [OK     ] "/Users/rschneeman/.cargo/bin"
Explanation:
    [OK     ] - Path part is a valid, non-empty, directory
    [MISSING] - Path part does not exist exist on disk, no such directory

It puts this on the PATH but it doesn't seem to actually be a directory:

  - [MISSING] "/Users/rschneeman/.rubies/ruby-3.1.3/lib/ruby/gems/3.1.0/bin"

Expected Behavior

Directories on the PATH are all on disk

Actual Behavior

  - [MISSING] "/Users/rschneeman/.rubies/ruby-3.1.3/lib/ruby/gems/3.1.0/bin"
$ ls /Users/rschneeman/.rubies/ruby-3.1.3/lib/ruby/gems/3.1.0/bin
ls: /Users/rschneeman/.rubies/ruby-3.1.3/lib/ruby/gems/3.1.0/bin: No such file or directory

Environment

$ bash --version
GNU bash, version 5.1.16(1)-release (x86_64-apple-darwin20.6.0)
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
⛄️ 3.1.3 🚀 /private/tmp/lol-yolo (main)
$  zsh --version
zsh 5.8.1 (x86_64-apple-darwin22.0)
⛄️ 3.1.3 🚀 /private/tmp/lol-yolo (main)
$ chruby --version
chruby: 0.3.9
⛄️ 3.1.3 🚀 /private/tmp/lol-yolo (main)
$ ruby --version
ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [x86_64-darwin20]
⛄️ 3.1.3 🚀 /private/tmp/lol-yolo (main)
$ gem --version
3.3.26
⛄️ 3.1.3 🚀 /private/tmp/lol-yolo (main)
$ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 3.3.26
  - RUBY VERSION: 3.1.3 (2022-11-24 patchlevel 185) [x86_64-darwin20]
  - INSTALLATION DIRECTORY: /Users/rschneeman/.gem/ruby/3.1.3
  - USER INSTALLATION DIRECTORY: /Users/rschneeman/.gem/ruby/3.1.0
  - RUBY EXECUTABLE: /Users/rschneeman/.rubies/ruby-3.1.3/bin/ruby
  - GIT EXECUTABLE: /usr/local/bin/git
  - EXECUTABLE DIRECTORY: /Users/rschneeman/.gem/ruby/3.1.3/bin
  - SPEC CACHE DIRECTORY: /Users/rschneeman/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Users/rschneeman/.rubies/ruby-3.1.3/etc
  - RUBYGEMS PLATFORMS:
     - ruby
     - x86_64-darwin-20
  - GEM PATHS:
     - /Users/rschneeman/.gem/ruby/3.1.3
     - /Users/rschneeman/.rubies/ruby-3.1.3/lib/ruby/gems/3.1.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => true
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /Users/rschneeman/.gem/ruby/3.1.3/bin
     - /Users/rschneeman/.rubies/ruby-3.1.3/lib/ruby/gems/3.1.0/bin
     - /Users/rschneeman/.rubies/ruby-3.1.3/bin
     - /Users/rschneeman/.cargo/bin
     - /usr/local/bin
     - /usr/local/sbin
     - /Users/rschneeman/bin/dotfiles/bin/
     - /usr/local/bin
     - /System/Cryptexes/App/usr/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
     - /Users/rschneeman/.cargo/bin
@schneems schneems added the bug label Feb 3, 2023
@postmodern postmodern self-assigned this Feb 4, 2023
@postmodern
Copy link
Owner

Ah yes, I added the ruby's gem root bin/ directory to cover my bases, but apparently rubygems does not use that directory and instead installs gem executable binstubs into $RUBY_ROOT/bin. I can remove the directory from $PATH now that it's actually causing issues.

@schneems
Copy link
Author

schneems commented Feb 5, 2023

That makes sense. Thanks for looking into it!

@postmodern postmodern added this to the 0.3.9 milestone May 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants