This repository has been archived by the owner. It is now read-only.

debug installs crash - Error: undefined method `new' for Readline:Module #15776

Closed
2bits opened this Issue Oct 31, 2012 · 41 comments

Comments

Projects
None yet
8 participants
Contributor

2bits commented Oct 31, 2012

I get a new error that just started within 12 hours I think:

$ brew install -vd gnuplot
/usr/local/bin/brew: loading /usr/local/Library/Formula/gnuplot.rb
/usr/local/bin/brew: loading /usr/local/Library/Formula/pkg-config.rb
/usr/local/bin/brew: loading /usr/local/Library/Formula/readline.rb
/usr/local/bin/brew: loading /usr/local/Library/Formula/lua.rb
/usr/local/bin/brew: loading /usr/local/Library/Formula/gd.rb
/usr/local/bin/brew: loading /usr/local/Library/Formula/libpng.rb
/usr/local/bin/brew: loading /usr/local/Library/Formula/jpeg.rb
/usr/local/bin/brew: loading /usr/local/Library/Formula/freetype.rb
/usr/local/Library/Formula/gnuplot.rb: loading /usr/local/Library/Formula/pkg-config.rb
Error: undefined method `new' for Readline:Module
Please report this bug:
    https://github.com/mxcl/homebrew/wiki/troubleshooting
/usr/local/Library/Homebrew/formula.rb:398:in `factory'
/usr/local/Library/Homebrew/formula.rb:442:in `expand_deps'
/usr/local/Library/Homebrew/formula.rb:441:in `map'
/usr/local/Library/Homebrew/formula.rb:441:in `expand_deps'
/usr/local/Library/Homebrew/formula.rb:437:in `recursive_deps'
/usr/local/Library/Homebrew/build.rb:74:in `install'
/usr/local/Library/Homebrew/build.rb:43:in `main'
/usr/local/Library/Homebrew/build.rb:12
/usr/local/Library/Formula/gnuplot.rb:69

I guess that's enough data to work with. My head is at 411375b00d386cd21708ade77efd9a51baceff50 on

/usr/local-0.9.3 10.8.2 4.5.1 clang-421 llvm-2336 /opt/X11-2.7.4
Contributor

mistydemeo commented Oct 31, 2012

Looks like gnuplot's readline dependency's class is clashing with the Readline module provided in core. You say this only started recently though?

Contributor

adamv commented Oct 31, 2012

Can't repo on Snow Leopard just now

Contributor

mistydemeo commented Oct 31, 2012

I can repro on Lion. brew irb, Formula.factory('readline') fails with the same error.

Contributor

2bits commented Oct 31, 2012

This also fails, brew install -vd r.
I'm not 100% sure when it started, but it's habit for me to type brew install -vd.

Contributor

2bits commented Oct 31, 2012

ping @jacknagel @mxcl on this core bug

Contributor

adamv commented Oct 31, 2012

So probably debrew.rb includes irb.rb, and irb.rb requires the 'readline' module.

Contributor

adamv commented Oct 31, 2012

Let's just go to Homebrew 2:

formula 'myformula' do
   ..
end

Using classes for formulae isn't sustainable

Contributor

Sharpie commented Oct 31, 2012

Possible workaround: rename the readline formula to avoid the clash and add a readline alias.

Contributor

Sharpie commented Oct 31, 2012

I'm not 100% sure when it started

It has been around for a good while---I used to run into this whenever using binding.pry to debug formula that depend on Readline.

Member

mxcl commented Oct 31, 2012

Possible workaround: rename the readline formula to avoid the clash and add a readline alias.

Seems like a good workaround. Agree with Adam though that a proper fix would be best—if anyone can be arsed.

Member

mxcl commented Oct 31, 2012

Ideally we'd be dry and have:

formula do
   ..
end

Since the filename has the name in. Though IME this is asking for some other kind of trouble.

Member

mxcl commented Oct 31, 2012

Other option: forcible import formula into the Homebrew module.

I think honestly, we should just alias Readline for now. Homebrew is a big third party tool now, we'll break stuff if we change the namespace of every formula in the repo.

I know we aren't 1.0, but practically that's not relevant anymore.

We'll fix properly for 2. If we ever make it that far.

Contributor

adamv commented Oct 31, 2012

Agree with the nameless formula syntax; there would also be a named version for subformula I think, at least, in my own private design notes.

Contributor

jacknagel commented Oct 31, 2012

git mv readline.rb gnu-readline.rb

Owner

MikeMcQuaid commented Nov 1, 2012

gnu-readline works for me. Might be a good chance to try and fix renames on update too.

Member

mxcl commented Nov 1, 2012

Readline is a major dependency, if we rename the filename we'll break stuff too.

We will have to add ugly hackery. Unless better solution can be discerned.

Member

mxcl commented Nov 1, 2012

I guess we can rename it provided that:

  1. We add an alias to readline so depends_on :readline still works
  2. We are happy that existing installations of readline will not upgrade (unless we fix that first).

Considering 2, I still prefer hackery.

Contributor

adamv commented Nov 1, 2012

With 1 you'd also need to hack brew audit to not complain about depends_on an alias for readline.

Contributor

Sharpie commented Nov 1, 2012

Considering 2, I still prefer hackery.

Well, in this case readline is keg_only---so upgrades don't affect installed software to begin with.

Member

mxcl commented Nov 2, 2012

Well, in this case readline is keg_only---so upgrades don't affect installed software to begin with.

This isn't true since the opt patch. Unless I am mistaken.

Member

mxcl commented Nov 2, 2012

Renames aren't safe, every time we do it, we get tickets with unexpected side-effects to mxcl/master and projects that use Homebrew outside of our horizon.

Contributor

jacknagel commented Nov 6, 2012

Renaming stuff doesn't actually break installed software. Anything that is installed against an existing readline keg will be fine, anything new will install against gnu-readline.

The problem caused by renames is that brew upgrade <old-name> won't work as expected anymore, even if you add an alias (because the alias resolves to the new name!), but I don't really see what choice we have here, we're clashing with a stdlib class and brew install -d is totally broken for anything that pulls in readline.

Contributor

adamv commented Nov 6, 2012

Hey we should revert the new debugging support until we fix this, right?

Contributor

staticfloat commented Nov 6, 2012

I'm getting bitten by this; is there a workaround that you guys can recommend?

Contributor

jacknagel commented Nov 8, 2012

Can we do something here? I want to be able to use --debug again.

Contributor

Sharpie commented Nov 8, 2012

I say we just do the rename. We've done it before and the world didn't end. The situation here is sufficiently dire to justify doing it again.

Contributor

jacknagel commented Nov 8, 2012

I'm going to rename it in ~3 hours unless someone tells me otherwise.

Contributor

2bits commented Nov 10, 2012

fixme please :-)

Contributor

jacknagel commented Nov 10, 2012

https://github.com/jacknagel/homebrew/compare/readline

I need to spend a half hour messing around with it before I push, so I at least understand what all of the implications are, but I'll do it today.

@jacknagel jacknagel closed this in adee531 Nov 11, 2012

Contributor

jacknagel commented Nov 11, 2012

Done.

Contributor

jacknagel commented Nov 11, 2012

Aaaand undone, because: bdaae65

@jacknagel jacknagel reopened this Nov 11, 2012

Contributor

2bits commented Nov 11, 2012

Epic, thank you. During the time this was offline, I found I could use a rescue clause to launch a series of commands to debug a formula (adding in a useless find command at the end to delay the cleanup on exit long enough for my editor to spawn with any logfiles).

Contributor

2bits commented Nov 11, 2012

lol beat my thank you by one minute.

Contributor

jacknagel commented Nov 11, 2012

:/

I dunno what else to suggest. I certainly don't want to do a bunch of surgery to otherwise-functional keg and formula loading code to work around this. I can't find any way to enable the IRB support without pulling in the Readline module, so we may have to just disable that portion of the new debugger for the time being.

Contributor

jacknagel commented Nov 11, 2012

Or only enable it if the readline formula hasn't been loaded, which is sad but better than nothing.

Contributor

jacknagel commented Nov 11, 2012

I guess the only clean solution is to make brew update handle renames.

Contributor

jacknagel commented Nov 11, 2012

Or only enable it if the readline formula hasn't been loaded, which is sad but better than nothing.

This is also difficult, because the debugger is loaded before any formulae.

Owner

MikeMcQuaid commented Nov 11, 2012

Random suggestions: load the non-formula readline only in the functions where it is used, load it directly by path, do some metaprogramming nonsense to rename either of the classes at runtime.

jacknagel added a commit that referenced this issue Nov 12, 2012

Work around Readline clash
Only limited debugging functionality is available to things that involve
the Readline formula, but it is better than crashing outright.

c.f. #15776.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Contributor

jacknagel commented Nov 12, 2012

Pushed a stopgap fix: if the readline formula is part of the dependency tree, the advanced debugging features are disabled, and what remains is basically equivalent to the old debug functionality.

@jacknagel jacknagel closed this Nov 12, 2012

Contributor

2bits commented Nov 12, 2012

Is there a trick to making a piece of software use libedit instead of readline?

Sharpie pushed a commit to Sharpie/homebrew that referenced this issue Nov 15, 2012

Work around Readline clash
Only limited debugging functionality is available to things that involve
the Readline formula, but it is better than crashing outright.

c.f. #15776.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Member

mxcl commented Nov 19, 2012

Let's not rush renames. We've been able to install from outside mxcl/master for a long time now. Not just via taps.

Here's a workable solution:

  1. Stick Readline in a module Homebrew.
  2. Special case Formula.factory so it knows to instantiate from inside the Homebrew module.

Fixed.

snakeyroc3 pushed a commit to snakeyroc3/homebrew that referenced this issue Dec 17, 2012

Rename readline to gnu-readline
The Readline class clashes with the Readline module from the Ruby
stdlib. This has mostly worked, but with the recent debugging support's
integration of IRB, it is no longer possible for them to coexist. So we
need to rename it.

The implications of this are:

 - Anything that depends on readline will reinstall it as
   "gnu-readline". Anything already installed will continue to function.

 - "brew upgrade readline" will say "gnu-readline not installed", as
   "readline" is now an alias.

 - Probably other things.

So there are some downsides, but we will just have to deal with them.

Fixes #15776.

snakeyroc3 pushed a commit to snakeyroc3/homebrew that referenced this issue Dec 17, 2012

Work around Readline clash
Only limited debugging functionality is available to things that involve
the Readline formula, but it is better than crashing outright.

c.f. #15776.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>

@vladshablinsky vladshablinsky referenced this issue Jun 23, 2015

Closed

GitHub Summer of Code: Formula renames #41006

24 of 24 tasks complete

@xu-cheng xu-cheng locked and limited conversation to collaborators Feb 16, 2016

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.