#986254 gem2deb creates gemspec file as a binary file for ruby-magic-static gem

Package:
gem2deb
Source:
gem2deb
Description:
Debian Ruby packaging suite
Submitter:
Pirate Praveen
Date:
2021-04-09 09:33:03 UTC
Severity:
normal
#986254#5
Date:
2021-04-01 17:12:26 UTC
From:
To:
Since the gemspec file has some binary data quilt is failing to create
a patch. Attached is the generated gemspec file. I had to manually
remove the offending characters using gedit and add it as
debian/gemspec for the build to work.

I'm not sure if it is really gem2deb issue or an upstream issue.

#986254#10
Date:
2021-04-07 08:50:58 UTC
From:
To:
On Thu, 01 Apr 2021 22:42:26 +0530 Pirate Praveen  <praveen@onenetbeyond.org> wrote:
 > Package: gem2deb
 > Version: 1.4
 >
 > Since the gemspec file has some binary data quilt is failing to
create
 > a patch. Attached is the generated gemspec file. I had to manually
 > remove the offending characters using gedit and add it as
 > debian/gemspec for the build to work.
 >
 > I'm not sure if it is really gem2deb issue or an upstream issue.
 >

This looks like a gem2deb issue as the binary character is added again
to the gemspec file in binary package even though I manually removed it
in gedit as added it as debian/gemspec

This is the offending line that makes creating patch impossible.

# stub: ruby-magic-static 0.3.5 ruby lib\00lib

#986254#15
Date:
2021-04-07 11:12:12 UTC
From:
To:
I did a bit of debugging on this, and it looks like for this case, the
culprit is yaml instead.

This is what I did:

* patched the gem2deb code to _not_ delete metadata.yml

diff --git a/lib/gem2deb/gem2tgz.rb b/lib/gem2deb/gem2tgz.rb
index d03452f..aac5162 100644
--- a/lib/gem2deb/gem2tgz.rb
+++ b/lib/gem2deb/gem2tgz.rb
@@ -101,7 +101,7 @@ module Gem2Deb
             f.puts "#########################################################"
             f.puts(gemspec.to_ruby)
           end
-          FileUtils.rm_f('metadata.yml')
+          #FileUtils.rm_f('metadata.yml')
         end
         FileUtils.rm_f('metadata.gz')
       end


* Now, I have the metadata.yml - I just wrote a snippet of code to check the
 behaviour of gemspec w.r.t metadata file
 Here it is:

```
require 'yaml'
gemspec = YAML.load_file('metadata.yml')
File.open('out', 'w') do |f|
	f.puts(gemspec.to_ruby)
end
```
--- NOTE: I'm attaching metadata.yml with this email in case it helps --- * Now I run it, and check the type of file "out" is $ file out out: data while in principle, it _really should_ have been ASCII/txt (tried with a couple more ruby gems, and that is the type I get) * Now, the metadata.yml has the same entry ("- lib") repeated twice in the 'require_paths' field. When I comment one of them, and run the snippet again, I get: $ file out out: ASCII text, with very long lines So my guess is that the same entry repeated twice is messing with gemspec, removing which it works well. Nilesh
#986254#20
Date:
2021-04-07 11:19:38 UTC
From:
To:
And I tried changing the second "-lib" entry to ruby-lib (it does not
mean anything, this is a random example)

and I get the same offending term: ruby lib^@ruby-lib
attaching the output, for ref

So it looks like more than one entry in "require_paths" outputs a
"binary" gemspec which is troublesome.

Nilesh

#986254#25
Date:
2021-04-07 11:25:29 UTC
From:
To:
used in gem2deb codebase to generate gemspec (hope it makes sense and is coherent)

Nilesh

#986254#30
Date:
2021-04-07 17:20:31 UTC
From:
To:
This sounds like a bug in rubygems itself.
#986254#35
Date:
2021-04-07 17:36:25 UTC
From:
To:
On the other hand, this seems to be done on purpose.

  def to_ruby
    require_relative 'openssl'
    mark_version
    result = []
    result << "# -*- encoding: utf-8 -*-"
    result << "#{Gem::StubSpecification::PREFIX}#{name} #{version} #{platform} #{raw_require_paths.join("\0")}"
    result << "#{Gem::StubSpecification::PREFIX}#{extensions.join "\0"}" unless
      extensions.empty?

However, trying to load such gemspec should work fine:

$ ruby -e 'puts Gem::Specification.new { |s| s.version = "1"; s.require_paths = ["foo", "bar"] }.to_ruby' > /tmp/g
$ file /tmp/g
/tmp/g: data
$ ruby -e 'puts Gem::Specification.load("/tmp/g")'
#<Gem::Specification name= version=1>

Praveen, can you share the exact error that you got originally?

#986254#40
Date:
2021-04-07 18:16:54 UTC
From:
To:
We can't create a patch for gemspec, for example I want to remove mini_portile2 from runtime dependencies. quilt refresh fails on it. Even git diff fails to show the diff.
#986254#45
Date:
2021-04-09 09:00:13 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
ruby-ruby-magic-static, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 986254@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Pirate Praveen <praveen@debian.org> (supplier of updated ruby-ruby-magic-static package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Wed, 07 Apr 2021 14:15:30 +0530
Source: ruby-ruby-magic-static
Binary: ruby-ruby-magic-static ruby-ruby-magic-static-dbgsym
Architecture: source amd64
Version: 0.3.5-1
Distribution: unstable
Urgency: medium
Maintainer: Debian Ruby Team <pkg-ruby-extras-maintainers@lists.alioth.debian.org>
Changed-By: Pirate Praveen <praveen@debian.org>
Description:
 ruby-ruby-magic-static - File Magic in Ruby
Closes: 986254
Changes:
 ruby-ruby-magic-static (0.3.5-1) unstable; urgency=medium
 .
   * Initial release (Closes: #986254)
Checksums-Sha1:
 2e97f57b366f9fc798553f2fd08dd2389af97445 2180 ruby-ruby-magic-static_0.3.5-1.dsc
 cd055f01a6bce41d0d48c065d20576cb211f2cc4 28086 ruby-ruby-magic-static_0.3.5.orig.tar.gz
 cb915b30e51b9120303e79b97f36bf1976c9356a 4840 ruby-ruby-magic-static_0.3.5-1.debian.tar.xz
 520a7bc7a34c04ed8b6ec832dce2d982d99af113 38780 ruby-ruby-magic-static-dbgsym_0.3.5-1_amd64.deb
 d2b28fd6095662f84b4c4cd9234e9ad6a7640b4d 9517 ruby-ruby-magic-static_0.3.5-1_amd64.buildinfo
 25042dddbf9e780104d836c13ff8cf1e7e0ed58b 22184 ruby-ruby-magic-static_0.3.5-1_amd64.deb
Checksums-Sha256:
 25cf63b3b7cead6bbec02d33d9f92dd28b3b3ec23255b181e907c15f771c70ac 2180 ruby-ruby-magic-static_0.3.5-1.dsc
 0192edc99789712aee6ff1ede085a81969dac3a3c605d10393ed752025a74e10 28086 ruby-ruby-magic-static_0.3.5.orig.tar.gz
 b1df179e673865da5e4fb32a989300c8b39d7d16e07578e0ac138c6fc20ae531 4840 ruby-ruby-magic-static_0.3.5-1.debian.tar.xz
 aa4d02049f36f38257666ee1dd5df549e607af98c4ef60dda5078ad186ca8850 38780 ruby-ruby-magic-static-dbgsym_0.3.5-1_amd64.deb
 9678cd700bde187c58809c26abc8bee27bd984a441bb9066b48d2191ea77495d 9517 ruby-ruby-magic-static_0.3.5-1_amd64.buildinfo
 1f7662401975f155ffb58cc807b413f74f537af97d3d3faaa28f8ffb39da0f68 22184 ruby-ruby-magic-static_0.3.5-1_amd64.deb
Files:
 ad4dd3554af88e65c62b58c95e7a5feb 2180 ruby optional ruby-ruby-magic-static_0.3.5-1.dsc
 b505940cf8c704d39f0f193b65b1b052 28086 ruby optional ruby-ruby-magic-static_0.3.5.orig.tar.gz
 996332046f3c87dd4c98f8c14b4e96c8 4840 ruby optional ruby-ruby-magic-static_0.3.5-1.debian.tar.xz
 4b2d5b4303f16b8d5241900f7549326d 38780 debug optional ruby-ruby-magic-static-dbgsym_0.3.5-1_amd64.deb
 a9ace3469e3ef7cf0769196e2d2fcdc4 9517 ruby optional ruby-ruby-magic-static_0.3.5-1_amd64.buildinfo
 cf5bec622a9307df10e511df42be6ee1 22184 ruby optional ruby-ruby-magic-static_0.3.5-1_amd64.deb
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEE0whj4mAg5UP0cZqDj1PgGTspS3UFAmBtczsACgkQj1PgGTsp
S3WCSg//bCBM0tfM1mZ2AZq83nrul3PO3DKO9Boz9WskM8ea44P0JkC769wIx3pU
AycMNjlbyINU9jtD28qsxy34wfNEAwuIBBf7c/ZRaEySBsWtlpIVT3ndYiDzS0Nc
EAR4H0d5G4kkL24wortCHNAcCZIkITXbI19T/3Pd099JHYqbvXCjLFNM5pRkYK0H
T1vfODWnJ777AkTdn30oQUjCJtW1W5Yc7NMxlq+gC92kGwnjt2PKYyInvaexh+z2
DsPPCmoOHmyoR/IDnlWG8sbS9qK23I6mbeXsYdKrdm/0kmSa09eOb8uHRHQ8vurU
36MeYUc8mRnnnHwmDTjkyGlItr/VVmj44phkBj15I8FdOUnSBnkMg6uczVgM3I6x
rIOzXnvduJd9yUkIHJoF3OFkO5zgk8WmlysOUTYrhBd4Y8oOZi1UL11Axa52NVO1
A4WqGBJMG8vpjPVb7IMWl4MOm1kxycyvLWMXLwwjX+eYnAATGeWdQH7E+mF/tqiA
EQVBQ2cMAKjnM8c2oueJouE8rhCjiVZThqmNvwOHc1di+94Xmc2rfIQhFSio9icE
ZVe7ZfeEVEImIblumw1TKeOhaz7xAX+QcyH/pA6yZIwzSsKKV4oRnj1itVofZnBf
BhePQf+PnB+WImGiMFcz/0VcZFhnu8TjLm27SqcyVylDbTz6Do8=
=1Ny/
-----END PGP SIGNATURE-----

#986254#50
Date:
2021-04-09 09:31:02 UTC
From:
To:
On Fri, 09 Apr 2021 09:00:13 +0000 Debian FTP Masters  <ftpmaster@ftp-master.debian.org> wrote:
 > Source: ruby-ruby-magic-static
 > Source-Version: 0.3.5-1
 > Done: Pirate Praveen <praveen@debian.org>
 >
 > We believe that the bug you reported is fixed in the latest version
of
 > ruby-ruby-magic-static, which is due to be installed in the Debian
FTP archive.

Sorry, wrongly closed the wrong bug. Reopening.