Project

General

Profile

Actions

Bug #11842

closed

r53123 breaks some gems which use erb

Added by yui-knk (Kaneko Yuichiro) over 8 years ago. Updated about 8 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.3.0dev (trunk 53153) [x86_64-darwin14]
[ruby-core:72374]

Description

r53123 breaks some gems which use erb.

Thor gem for example.
They set an instance variable "@output_buffer" to 4th argument (eoutvar) of ERB.new (here).
And change this instance variable from outside erb (here).

Example code of erb shows this usage of eoutvar.
I think we should revert r53123 and add a test case for this usage.

Failures:

  1) Thor::Actions#template allows using block helpers in the template
     Failure/Error: concat(result.strip + " world!")

     NoMethodError:
       undefined method `strip' for ["Hello\n"]:Array
     # ./spec/fixtures/group.thor:58:in `world'
     # (erb):1:in `template'
     # ./lib/thor/actions/file_manipulation.rb:116:in `block in template'
     # ./lib/thor/actions/create_file.rb:53:in `render'
     # ./lib/thor/actions/create_file.rb:62:in `block (2 levels) in invoke!'
     # ./lib/thor/actions/create_file.rb:62:in `open'
     # ./lib/thor/actions/create_file.rb:62:in `block in invoke!'
     # ./lib/thor/actions/empty_directory.rb:116:in `invoke_with_conflict_check'
     # ./lib/thor/actions/create_file.rb:60:in `invoke!'
     # ./lib/thor/actions.rb:94:in `action'
     # ./lib/thor/actions/create_file.rb:25:in `create_file'
     # ./lib/thor/actions/file_manipulation.rb:115:in `template'
     # ./spec/actions/file_manipulation_spec.rb:11:in `block in action'
     # ./spec/helper.rb:55:in `capture'
     # ./spec/actions/file_manipulation_spec.rb:11:in `action'
     # ./spec/actions/file_manipulation_spec.rb:160:in `block (3 levels) in <top (required)>'

Updated by k0kubun (Takashi Kokubun) over 8 years ago

While this case is fixable by https://github.com/erikhuda/thor/pull/512, there may be some gems depending on the eoutvar's behavior.
If "Pass the name of the variable to be used inside a String" is specification, r53123 should be breaking change and I have no objection to revert the patch.

Updated by hsbt (Hiroshi SHIBATA) over 8 years ago

What's affected gems without thor?

Updated by k0kubun (Takashi Kokubun) over 8 years ago

I saw rails's build is also broken due to thor. These are all I know for now.
By the way, since my patch to thor https://github.com/erikhuda/thor/pull/512 was merged, now thor master has no problem about this.

Actions #4

Updated by hsbt (Hiroshi SHIBATA) over 8 years ago

  • Status changed from Open to Closed

Applied in changeset r53216.


  • lib/erb.rb: revert r53123. It break compatibility like thor and rspec-rails.
    We should try with Ruby 2.4 or 3.0.
    [Bug #11842][ruby-core:72374]
  • lib/rdoc/erb_partial.rb: ditto.
  • template/verconf.h.tmpl: ditto.

Updated by hsbt (Hiroshi SHIBATA) over 8 years ago

I found same case with rspec-rails in latest gems registered rubygems.org. It is widely used application development. I decided to revert r53123.

Takashi Kokubun

We will try next release. Thank you for your investigation.

Updated by k0kubun (Takashi Kokubun) over 8 years ago

I see. Thank you for finding a gem which is widely used and has incompatibility about this.
I hope we will try this in later release.

Updated by usa (Usaku NAKAMURA) about 8 years ago

  • Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN to 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: DONTNEED
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0