Skip to content

Packager should ignore directories in spec.files for back-compat with old gemspecs #413

jeremy opened this Issue Dec 9, 2012 · 1 comment

2 participants

jeremy commented Dec 9, 2012

Granted that spec.files must all be files for the gem to validate.

However, many old gemspecs use spec.files = Dir['lib/**/*'] style globs for file listings, resulting in intermediate directories in spec.files.

RubyGems 2.0 can't package these gemspecs any more. It tries to add the dirs to the tarball as if they were files.

I think it's probably worth maintaining compatibility with old gemspecs:

diff --git a/lib/rubygems/package.rb b/lib/rubygems/package.rb
index 1769af0..0707a26 100644
--- a/lib/rubygems/package.rb
+++ b/lib/rubygems/package.rb
@@ -196,7 +196,7 @@ class Gem::Package
         open file, 'rb' do |src_io|
           dst_io.write 16384 until src_io.eof?
-      end
+      end if stat.file?
@jeremy jeremy added a commit to rails/rails that referenced this issue Dec 9, 2012
@jeremy jeremy Omit directories from gemspec.files for RubyGems 2 compat.
RG2 packager expects each spec.files path to be a file and bombs when it tries to tarball a dir.

May revert if rubygems/rubygems#413 is accepted.
@drbrain drbrain was assigned Dec 9, 2012
@drbrain drbrain closed this in 486ed83 Dec 10, 2012
jeremy commented Dec 10, 2012


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.