Bundler::GemRequireError on pry when HOME env var is unavailable
dannyfallon opened this issue · comments
This issue stems from the default_rc_file
code:
Line 314 in 9d9ae4a
The docs around File.expand_path
explicitly called out that if you're going to use ~
then a HOME
env variable needs to be set:
The given pathname may start with a “~'', which expands to the process owner's home directory (the environment variable HOME must be set correctly)
When it's not set or otherwise there are problems the command is liable to raise ArgumentError
HOME="" ruby -e "File.expand_path('~')"
Traceback (most recent call last):
1: from -e:1:in `<main>'
-e:1:in `expand_path': non-absolute home (ArgumentError)
Where we've run into this is running a rake task under AWS System Manager - we believe the commands are executed under execve
which doesn't have a shell and doesn't have shell expansion.
We have same issue with Puma:
/usr/local/lib/ruby/gems/2.6.0/gems/pry-0.13.1/lib/pry/config.rb:314:in `expand_path': couldn't find login name -- expanding `~' (ArgumentError)
from /usr/local/lib/ruby/gems/2.6.0/gems/pry-0.13.1/lib/pry/config.rb:314:in `default_rc_file'
from /usr/local/lib/ruby/gems/2.6.0/gems/pry-0.13.1/lib/pry/config.rb:187:in `initialize'
from /usr/local/lib/ruby/gems/2.6.0/gems/pry-0.13.1/lib/pry/pry_class.rb:327:in `new'
from /usr/local/lib/ruby/gems/2.6.0/gems/pry-0.13.1/lib/pry/pry_class.rb:327:in `reset_defaults'
from /usr/local/lib/ruby/gems/2.6.0/gems/pry-0.13.1/lib/pry/pry_class.rb:337:in `init'
from /usr/local/lib/ruby/gems/2.6.0/gems/pry-0.13.1/lib/pry/pry_class.rb:388:in `<main>'
from /usr/local/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
from /usr/local/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
from /usr/local/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
from /usr/local/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
from /usr/local/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
from /usr/local/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:324:in `block in require'
from /usr/local/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:291:in `load_dependency'
from /usr/local/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:324:in `require'
from /usr/local/lib/ruby/gems/2.6.0/gems/pry-0.13.1/lib/pry.rb:61:in `<main>'
from /usr/local/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
from /usr/local/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
from /usr/local/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
from /usr/local/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
from /usr/local/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
from /usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/runtime.rb:81:in `block (2 levels) in require'
from /usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/runtime.rb:76:in `each'
from /usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/runtime.rb:76:in `block in require'
from /usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/runtime.rb:65:in `each'
from /usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/runtime.rb:65:in `require'
from /usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler.rb:114:in `require'
from /var/apps/SerpApi/config/application.rb:21:in `<top (required)>'
from /var/apps/SerpApi/config/environment.rb:2:in `require_relative'
from /var/apps/SerpApi/config/environment.rb:2:in `<top (required)>'
from config.ru:3:in `require_relative'
from config.ru:3:in `block in <main>'
from /usr/local/lib/ruby/gems/2.6.0/gems/rack-2.2.3/lib/rack/builder.rb:116:in `eval'
from /usr/local/lib/ruby/gems/2.6.0/gems/rack-2.2.3/lib/rack/builder.rb:116:in `new_from_string'
from /usr/local/lib/ruby/gems/2.6.0/gems/rack-2.2.3/lib/rack/builder.rb:105:in `load_file'
from /usr/local/lib/ruby/gems/2.6.0/gems/rack-2.2.3/lib/rack/builder.rb:66:in `parse_file'
from /usr/local/lib/ruby/gems/2.6.0/gems/puma-4.3.6/lib/puma/configuration.rb:321:in `load_rackup'
from /usr/local/lib/ruby/gems/2.6.0/gems/puma-4.3.6/lib/puma/configuration.rb:246:in `app'
from /usr/local/lib/ruby/gems/2.6.0/gems/puma-4.3.6/lib/puma/runner.rb:165:in `app'
from /usr/local/lib/ruby/gems/2.6.0/gems/puma-4.3.6/lib/puma/runner.rb:172:in `start_server'
from /usr/local/lib/ruby/gems/2.6.0/gems/puma-4.3.6/lib/puma/cluster.rb:269:in `worker'
from /usr/local/lib/ruby/gems/2.6.0/gems/puma-4.3.6/lib/puma/cluster.rb:138:in `block (2 levels) in spawn_workers'
from /usr/local/lib/ruby/gems/2.6.0/gems/puma-4.3.6/lib/puma/cluster.rb:138:in `fork'
from /usr/local/lib/ruby/gems/2.6.0/gems/puma-4.3.6/lib/puma/cluster.rb:138:in `block in spawn_workers'
from /usr/local/lib/ruby/gems/2.6.0/gems/puma-4.3.6/lib/puma/cluster.rb:134:in `times'
from /usr/local/lib/ruby/gems/2.6.0/gems/puma-4.3.6/lib/puma/cluster.rb:134:in `spawn_workers'
from /usr/local/lib/ruby/gems/2.6.0/gems/puma-4.3.6/lib/puma/cluster.rb:204:in `check_workers'
from /usr/local/lib/ruby/gems/2.6.0/gems/puma-4.3.6/lib/puma/cluster.rb:487:in `run'
from /usr/local/lib/ruby/gems/2.6.0/gems/puma-4.3.6/lib/puma/launcher.rb:172:in `run'
from /usr/local/lib/ruby/gems/2.6.0/gems/puma-4.3.6/lib/puma/cli.rb:80:in `run'
from /usr/local/lib/ruby/gems/2.6.0/gems/puma-4.3.6/bin/puma:10:in `<top (required)>'
from /usr/local/bin/puma:23:in `load'
from /usr/local/bin/puma:23:in `<main>'
We didn't have this issue under 0.11.3
pry only after 0.13.1
pry upgrade. A temporary fix would be to set a home as a puma variable. But it seems something that needs to be also handled on pry side as it's a regression?