Bug #17780
closedBackport for super_method aliases in ruby 2.7.3 causes Segfault
Description
This error was discovered while trying to run bundle exec srb init on a new rails project.
Thanks to Peter Zhu for debugging this, finding the breaking commit, and providing a minimum example:
Breaking commit: https://github.com/ruby/ruby/commit/c98aa2db60f43e839d7a82897c22b5ceecbed417
Minimum example:
module Test
  def foo
    puts "hello"
  end
  alias :f :foo
end
method = Test.instance_method(:f)
super_method = method.super_method
Files
        
           Updated by peterzhu2118 (Peter Zhu) over 4 years ago
          Updated by peterzhu2118 (Peter Zhu) over 4 years ago
          
          
        
        
      
      - Assignee set to peterzhu2118 (Peter Zhu)
        
           Updated by peterzhu2118 (Peter Zhu) over 4 years ago
          Updated by peterzhu2118 (Peter Zhu) over 4 years ago
          
          
        
        
      
      Note that this bug is reproducible on 2.6.7, 2.7.3, 3.0.1, master.
        
           Updated by peterzhu2118 (Peter Zhu) over 4 years ago
          Updated by peterzhu2118 (Peter Zhu) over 4 years ago
          
          
        
        
      
      
    
        
           Updated by peterzhu2118 (Peter Zhu) over 4 years ago
          Updated by peterzhu2118 (Peter Zhu) over 4 years ago
          
          
        
        
      
      GitHub PR: https://github.com/ruby/ruby/pull/4364
        
           Updated by jeremyevans0 (Jeremy Evans) over 4 years ago
          Updated by jeremyevans0 (Jeremy Evans) over 4 years ago
          
          
        
        
      
      Pull request submitted to fix this: https://github.com/ruby/ruby/pull/4365
        
           Updated by jeremyevans0 (Jeremy Evans) over 4 years ago
          Updated by jeremyevans0 (Jeremy Evans) over 4 years ago
          
          
        
        
      
      - Backport changed from 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN to 2.6: REQUIRED, 2.7: REQUIRED, 3.0: REQUIRED
        
           Updated by Anonymous over 4 years ago
          Updated by Anonymous over 4 years ago
          
          
        
        
      
      - Status changed from Open to Closed
Applied in changeset git|d8a13e504992a45d52063f7c925408d7aad3595a.
[Bug #17780] Fix Method#super_method for module alias
Method#super_method crashes for aliased module methods because they are
not defined on a class. This bug was introduced in
c60aaed1856b2b6f90de0992c34771830019e021 as part of bug #17130.
        
           Updated by nagachika (Tomoyuki Chikanaga) over 4 years ago
          Updated by nagachika (Tomoyuki Chikanaga) over 4 years ago
          
          
        
        
      
      - Backport changed from 2.6: REQUIRED, 2.7: REQUIRED, 3.0: REQUIRED to 2.6: REQUIRED, 2.7: REQUIRED, 3.0: DONE
ruby_3_0 410216c9db033a72f4dd119c366bc58dd54383ec merged revision(s) d8a13e504992a45d52063f7c925408d7aad3595a.
        
           Updated by usa (Usaku NAKAMURA) over 4 years ago
          Updated by usa (Usaku NAKAMURA) over 4 years ago
          
          
        
        
      
      - Backport changed from 2.6: REQUIRED, 2.7: REQUIRED, 3.0: DONE to 2.6: REQUIRED, 2.7: DONE, 3.0: DONE
        
           Updated by usa (Usaku NAKAMURA) over 4 years ago
          Updated by usa (Usaku NAKAMURA) over 4 years ago
          
          
        
        
      
      - Backport changed from 2.6: REQUIRED, 2.7: DONE, 3.0: DONE to 2.6: DONE, 2.7: DONE, 3.0: DONE
ruby_2_6 r67945 merged revision(s) d8a13e50.