Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Extend YAML::Syck::DefaultKey fixing to `marshal_dump` as well. #121

Merged
merged 1 commit into from

6 participants

@dpiddy

I'm running into a problem on our internal gems repo where built-gem
metadata is being uploaded with unquoted ='s. When gem
generate_index
is run, the metadata is loaded which turns the
= into DefaultKey. That's then marshaled out as part of the quick
specs which breaks clients that try to load them.

Applying the same fix to marshal_dump let quick specs be generated
that didn't have DefaultKey refs in them even though the incoming
gem specs were broken.

@zenspider zenspider merged commit b14197a into rubygems:master
@parndt

Could we please have a rubygems 1.8.6 with this? I'm having trouble building gems that actually install properly.

@jonforums

On a test version of a gem built on Win7 32bit with RG 1.8.8 and installed with RG 1.8.9 I'm seeing an install failure that appears similar to this issue. The failure only occurs for me on MRI 1.8.7; MRI 1.9.3dev and 1.9.4dev are OK.

Can anyone reproduce?

C:\Users\Jon\Documents\RubyDev\posix-spawn-git>gem install posix-spawn-0.3.7.alpha.1.gem
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
Invalid gemspec in [C:/ruby187/lib/ruby/gems/1.8/specifications/posix-spawn-0.3.7.alpha.1.gemspec]: Illformed requirement ["# 0.7.6"]
Successfully installed posix-spawn-0.3.7.alpha.1
1 gem installed

The lib/ruby/gems/1.8/specifications/posix-spawn-0.3.7.alpha.1.gemspec contains

# -*- encoding: utf-8 -*-

Gem::Specification.new do |s|
  s.name = %q{posix-spawn}
  s.version = "0.3.7.alpha.1"

  s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
  s.authors = [%q{Ryan Tomayko}, %q{Aman Gupta}]
  s.date = %q{2011-08-24}
  s.description = %q{posix-spawn uses posix_spawnp(2) for faster process spawning}
  s.email = [%q{r@tomayko.com}, %q{aman@tmm1.net}]
  s.executables = [%q{posix-spawn-benchmark}]
  s.extensions = [%q{ext/extconf.rb}]
  s.extra_rdoc_files = [%q{COPYING}, %q{HACKING}]
  s.files = [%q{bin/posix-spawn-benchmark}, %q{COPYING}, %q{HACKING}, %q{ext/extconf.rb}]
  s.homepage = %q{http://github.com/rtomayko/posix-spawn}
  s.require_paths = [%q{lib}]
  s.rubygems_version = %q{1.8.9}
  s.summary = %q{posix_spawnp(2) for ruby}

  if s.respond_to? :specification_version then
    s.specification_version = 3

    if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
      s.add_development_dependency(%q, ["#<YAML::Syck::DefaultKey:0x3b61f18> 0.7.6"])
    else
      s.add_dependency(%q, ["#<YAML::Syck::DefaultKey:0x3b61f18> 0.7.6"])
    end
  else
    s.add_dependency(%q, ["#<YAML::Syck::DefaultKey:0x3b61f18> 0.7.6"])
  end
end

My gem environment is

C:\Users\Jon\Documents\RubyDev\posix-spawn-git>gem env
Invalid gemspec in [C:/ruby187/lib/ruby/gems/1.8/specifications/posix-spawn-0.3.7.alpha.1.gemspec]: Illformed requirement ["# 0.7.6"]
RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.9
  - RUBY VERSION: 1.8.7 (2011-06-30 patchlevel 352) [i386-mingw32]
  - INSTALLATION DIRECTORY: C:/ruby187/lib/ruby/gems/1.8
  - RUBY EXECUTABLE: C:/ruby187/bin/ruby.exe
  - EXECUTABLE DIRECTORY: C:/ruby187/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-mingw32
  - GEM PATHS:
     - C:/ruby187/lib/ruby/gems/1.8
     - C:/Users/Jon/.gem/ruby/1.8
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - "gem" => "--no-ri --no-rdoc"
     - :sources => ["http://rubygems.org"]
  - REMOTE SOURCES:
     - http://rubygems.org
@luislavena
Collaborator

@jonforums: seems the issue associated with the generated gemspec. Can you verify the contents of the generated .gem and see inside metadata both all dependencies state YAML::Syck::DefaultKey:0x3b61f18 ?

@jonforums

full metadata contents from the test gem that I build (v0.3.7.alpha.1)

--- !ruby/object:Gem::Specification
name: posix-spawn
version: !ruby/object:Gem::Version
  version: 0.3.7.alpha.1
  prerelease: 6
platform: ruby
authors:
- Ryan Tomayko
- Aman Gupta
autorequire: 
bindir: bin
cert_chain: []
date: 2011-08-24 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
  name: rake-compiler
  requirement: &17118504 !ruby/object:Gem::Requirement
    none: false
    requirements:
    - - =
      - !ruby/object:Gem::Version
        version: 0.7.6
  type: :development
  prerelease: false
  version_requirements: *17118504
description: posix-spawn uses posix_spawnp(2) for faster process spawning
email:
- r@tomayko.com
- aman@tmm1.net
executables:
- posix-spawn-benchmark
extensions:
- ext/extconf.rb
extra_rdoc_files:
- COPYING
- HACKING
files:
- .gitignore
- COPYING
- Gemfile
- HACKING
- README.md
- Rakefile
- TODO
- bin/posix-spawn-benchmark
- ext/extconf.rb
- ext/posix-spawn.c
- lib/posix-spawn.rb
- lib/posix/spawn.rb
- lib/posix/spawn/child.rb
- lib/posix/spawn/version.rb
- posix-spawn.gemspec
- test/test_backtick.rb
- test/test_child.rb
- test/test_popen.rb
- test/test_spawn.rb
- test/test_system.rb
homepage: http://github.com/rtomayko/posix-spawn
licenses: []
post_install_message: 
rdoc_options: []
require_paths:
- lib
required_ruby_version: !ruby/object:Gem::Requirement
  none: false
  requirements:
  - - ! '>='
    - !ruby/object:Gem::Version
      version: '0'
required_rubygems_version: !ruby/object:Gem::Requirement
  none: false
  requirements:
  - - ! '>'
    - !ruby/object:Gem::Version
      version: 1.3.1
requirements: []
rubyforge_project: 
rubygems_version: 1.8.8
signing_key: 
specification_version: 3
summary: posix_spawnp(2) for ruby
test_files: []

...and the metadata contents from the official posix-spawn v0.3.6 gem:

--- !ruby/object:Gem::Specification 
name: posix-spawn
version: !ruby/object:Gem::Version 
  hash: 31
  prerelease: 
  segments: 
  - 0
  - 3
  - 6
  version: 0.3.6
platform: ruby
authors: 
- Ryan Tomayko
- Aman Gupta
autorequire: 
bindir: bin
cert_chain: []

date: 2011-04-19 00:00:00 -07:00
default_executable: 
dependencies: 
- !ruby/object:Gem::Dependency 
  name: rake-compiler
  prerelease: false
  requirement: &id001 !ruby/object:Gem::Requirement 
    none: false
    requirements: 
    - - "="
      - !ruby/object:Gem::Version 
        hash: 15
        segments: 
        - 0
        - 7
        - 6
        version: 0.7.6
  type: :development
  version_requirements: *id001
description: posix-spawn uses posix_spawnp(2) for faster process spawning
email: 
- r@tomayko.com
- aman@tmm1.net
executables: 
- posix-spawn-benchmark
extensions: 
- ext/extconf.rb
extra_rdoc_files: 
- COPYING
- HACKING
files: 
- .gitignore
- COPYING
- Gemfile
- HACKING
- README.md
- Rakefile
- TODO
- bin/posix-spawn-benchmark
- ext/extconf.rb
- ext/posix-spawn.c
- lib/posix-spawn.rb
- lib/posix/spawn.rb
- lib/posix/spawn/child.rb
- lib/posix/spawn/version.rb
- posix-spawn.gemspec
- test/test_backtick.rb
- test/test_child.rb
- test/test_popen.rb
- test/test_spawn.rb
- test/test_system.rb
has_rdoc: true
homepage: http://github.com/rtomayko/posix-spawn
licenses: []

post_install_message: 
rdoc_options: []

require_paths: 
- lib
required_ruby_version: !ruby/object:Gem::Requirement 
  none: false
  requirements: 
  - - ">="
    - !ruby/object:Gem::Version 
      hash: 3
      segments: 
      - 0
      version: "0"
required_rubygems_version: !ruby/object:Gem::Requirement 
  none: false
  requirements: 
  - - ">="
    - !ruby/object:Gem::Version 
      hash: 3
      segments: 
      - 0
      version: "0"
requirements: []

rubyforge_project: 
rubygems_version: 1.4.2
signing_key: 
specification_version: 3
summary: posix_spawnp(2) for ruby
test_files: []
@drbrain
Owner

I can reproduce with a checkout of https://github.com/rtomayko/posix-spawn.git by rake19 package; gem install pkg/posix-spawn-0.3.6 rake19 is 1.9.3, gem is 1.8.7

@drbrain
Owner

The posix-spawn gem is fixed by @a2498af

@dimko dimko referenced this pull request from a commit in dimko/carrierwave
@felixbuenemann felixbuenemann Fix gemspec compatibility with old rubygems
Old rubygems versions (eg. 1.3.7) without this fix
rubygems/rubygems@a2498af
don't like version numbers without a prefix.
As the gemspec specifies to be dependent on rubygems
1.3.5 we should fix this.
Also see rubygems/rubygems#121
for discussion.
0f62b25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 14 additions and 6 deletions.
  1. +14 −6 lib/rubygems/requirement.rb
View
20 lib/rubygems/requirement.rb
@@ -129,18 +129,15 @@ def hash # :nodoc:
end
def marshal_dump # :nodoc:
+ fix_syck_default_key_in_requirements!
+
[@requirements]
end
def marshal_load array # :nodoc:
@requirements = array[0]
- # Fixup the Syck DefaultKey bug
- @requirements.each do |r|
- if r[0].kind_of? YAML::Syck::DefaultKey
- r[0] = "="
- end
- end
+ fix_syck_default_key_in_requirements!
end
def prerelease?
@@ -180,6 +177,17 @@ def to_s # :nodoc:
def <=> other # :nodoc:
to_s <=> other.to_s
end
+
+ private
+
+ def fix_syck_default_key_in_requirements!
+ # Fixup the Syck DefaultKey bug
+ @requirements.each do |r|
+ if r[0].kind_of? YAML::Syck::DefaultKey
+ r[0] = "="
+ end
+ end
+ end
end
# :stopdoc:
Something went wrong with that request. Please try again.