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

debrew: fix irb start #8374

Merged
merged 1 commit into from Aug 17, 2020
Merged

debrew: fix irb start #8374

merged 1 commit into from Aug 17, 2020

Conversation

bayandin
Copy link
Member

@bayandin bayandin commented Aug 17, 2020

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew tests with your changes locally?

irb doesn't start from debug menu with an error FrozenError: can't modify frozen #<Class:#<Array:0x00007fd4b48840b0>>.
irb#setup method defaults argv to ::ARGV and tries to shift it, which fails for out case when ::ARGV is frozen.

This PR defaults argv to an empty array (also we don't really want to pass brew cli arguments toirb).

The whole log looks like this:

brew install -s -d hello
...
RuntimeError: boom
1. raise
2. ignore
3. backtrace
4. irb
5. shell
Choose an action: 4
When you exit this IRB session, execution will continue.

WARNING: This version of ruby is included in macOS for compatibility with legacy software. 
In future versions of macOS the ruby runtime will not be available by 
default, and may require you to install an additional package.

/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/irb/init.rb:134:in `shift'
FrozenError: can't modify frozen #<Class:#<Array:0x00007fd4b48840b0>>
1. raise
2. backtrace
3. shell
Choose an action: 2
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/irb/init.rb:134:in `shift'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/irb/init.rb:134:in `parse_opts'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/irb/init.rb:27:in `setup'
/usr/local/Homebrew/Library/Homebrew/debrew/irb.rb:14:in `start_within'
/usr/local/Homebrew/Library/Homebrew/debrew.rb:127:in `block (5 levels) in debug'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mutex_m.rb:78:in `synchronize'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mutex_m.rb:78:in `mu_synchronize'
/usr/local/Homebrew/Library/Homebrew/debrew.rb:127:in `block (4 levels) in debug'
/usr/local/Homebrew/Library/Homebrew/debrew.rb:17:in `raise'
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/hello.rb:22:in `install'
/usr/local/Homebrew/Library/Homebrew/debrew.rb:24:in `block in install'
/usr/local/Homebrew/Library/Homebrew/debrew.rb:94:in `debrew'
/usr/local/Homebrew/Library/Homebrew/debrew.rb:24:in `install'
/usr/local/Homebrew/Library/Homebrew/build.rb:174:in `block (2 levels) in install'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1187:in `block in brew'
/usr/local/Homebrew/Library/Homebrew/formula.rb:2174:in `block (2 levels) in stage'
/usr/local/Homebrew/Library/Homebrew/utils.rb:494:in `with_env'
/usr/local/Homebrew/Library/Homebrew/formula.rb:2173:in `block in stage'
/usr/local/Homebrew/Library/Homebrew/resource.rb:112:in `block in unpack'
/usr/local/Homebrew/Library/Homebrew/resource.rb:198:in `block in mktemp'
/usr/local/Homebrew/Library/Homebrew/mktemp.rb:57:in `block in run'
/usr/local/Homebrew/Library/Homebrew/mktemp.rb:57:in `chdir'
/usr/local/Homebrew/Library/Homebrew/mktemp.rb:57:in `run'
/usr/local/Homebrew/Library/Homebrew/resource.rb:197:in `mktemp'
/usr/local/Homebrew/Library/Homebrew/resource.rb:107:in `unpack'
/usr/local/Homebrew/Library/Homebrew/resource.rb:82:in `stage'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/forwardable.rb:230:in `stage'
/usr/local/Homebrew/Library/Homebrew/formula.rb:2153:in `stage'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1180:in `brew'
/usr/local/Homebrew/Library/Homebrew/build.rb:142:in `block in install'
/usr/local/Homebrew/Library/Homebrew/utils.rb:494:in `with_env'
/usr/local/Homebrew/Library/Homebrew/build.rb:137:in `install'
/usr/local/Homebrew/Library/Homebrew/build.rb:226:in `<main>'
1. raise
2. backtrace
3. shell
...

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me, thanks for the detailed explanation and fix!

@bayandin bayandin merged commit 4508e7c into Homebrew:master Aug 17, 2020
@bayandin bayandin deleted the fix-irb-starting branch August 17, 2020 14:28
@BrewTestBot BrewTestBot added the outdated PR was locked due to age label Dec 17, 2020
@Homebrew Homebrew locked as resolved and limited conversation to collaborators Dec 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants