Skip to content

Clear ENV["XDG_CONFIG_HOME"] to avoid loading user-defined irbrc in test#982

Merged
tompng merged 1 commit into
ruby:masterfrom
tompng:test_clear_xdg_env
Jul 18, 2024
Merged

Clear ENV["XDG_CONFIG_HOME"] to avoid loading user-defined irbrc in test#982
tompng merged 1 commit into
ruby:masterfrom
tompng:test_clear_xdg_env

Conversation

@tompng

@tompng tompng commented Jul 17, 2024

Copy link
Copy Markdown
Member

TestIRB::ConfigValidationTest#setup forgot to clear ENV['XDG_CONFIG_HOME']

With these environment variables, rake test fails.

echo "puts 'IRBRC'; exit" > /path/to/dummy_home/env_irbrc
echo "puts 'HOME'; exit" > /path/to/dummy_home/.irbrc
echo "puts 'XDG'; exit" > /path/to/dummy_home/.config/irb/irbrc
IRBRC=/path/to/dummy_home/env_irbrc HOME=/path/to/dummy_home/ XDG_CONFIG_HOME=/path/to/dummy_home/.config rake test

Test passes with normal irbrc content maybe with Error loading RC file warning message, but it's better not to read user-defined irbrc file.

Comment thread test/irb/helper.rb Outdated
@tompng tompng force-pushed the test_clear_xdg_env branch from 6113d5e to 90b4bfa Compare July 18, 2024 10:20
@tompng tompng merged commit 632da0f into ruby:master Jul 18, 2024
@tompng tompng deleted the test_clear_xdg_env branch July 18, 2024 10:56
matzbot pushed a commit to ruby/ruby that referenced this pull request Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants