Issue #16904 has been updated by jaruga (Jun Aruga).


> What's wrong in Fedora?

Thank you for checking the issue on your environment.
In Fedora Ruby, there is no default gem psych gemspec: there is no file such as /usr/share/gems/specifications/default/psych-*.gemspec .
You can see https://github.com/rubygems/rubygems/issues/3629#issuecomment-630288731 for detail.

This is the wrong point. That's why I wrote "It's a Fedora Ruby specific case. This is not the case of Ruby built from source normally.".

Though this issue can happen in Upstream Ruby too, according to https://github.com/ruby/psych/issues/386 , I has not tried it on my environment.

And I was able to reproduce the error by Vit's way on upstream Ruby (Ruby built from the source).

```
$ which ruby
/usr/local/ruby-2.7.1/bin/ruby

$ ruby -v
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux]

$ gem install psych --user-install

$ gem list psych

*** LOCAL GEMS ***

psych (3.1.0)


$ RUBYOPT="--disable-gems" ruby -r psych -e 'require "rubygems"; Gem.load_yaml'
...
/home/jaruga/.gem/ruby/2.7.0/gems/psych-3.1.0/lib/psych/parser.rb:34:in `<class:Parser>': superclass mismatch for class Mark (TypeError)
```


----------------------------------------
Bug #16904: rubygems: psych: superclass mismatch for class Mark (TypeError)
https://bugs.ruby-lang.org/issues/16904#change-85746

* Author: jaruga (Jun Aruga)
* Status: Open
* Priority: Normal
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
Is it possible to backport the following commits into Ruby?

Remove explicit `psych` activation
https://github.com/rubygems/rubygems/commit/1ccf0912a161d20e0c4a7b139fd76e8739a411ba

bundler: Remove explicit `psych` activation. 
https://github.com/rubygems/rubygems/commit/88478bb56945ffa9868491cacd0bc74d9d73c848

It causes the following kind of error when psych is installed as not default gem but regular gem. It's a Fedora Ruby specific case. **This is not the case of Ruby built from source normally.**


```
$ cat test.rb 
require 'psych'
Gem.load_yaml # <= The error happens.
```

```
$ ruby test.rb
/usr/lib64/gems/ruby/psych-3.1.0/psych.so: warning: already initialized constant Psych::Parser::ANY
...
/usr/share/gems/gems/psych-3.1.0/lib/psych/parser.rb:34:in `<class:Parser>': superclass mismatch for class Mark (TypeError)
```

It is possibly also related to https://github.com/ruby/psych/issues/386 .

Thank you.



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>