[DRE-maint] Bug#990443: ruby-gtk2: crashes with openssl: superclass mismatch for class Socket (TypeError)

Peter Michael Green plugwash at debian.org
Sat Mar 5 20:10:12 GMT 2022


I noticed this bug while working on a derivative and decided to take a look.
Note though that I am NOT a ruby guy.

Upstream hasn't fixed the underlying issue, but has suggested it can be 
worked around by reordering
requires/imports and has closed the bug.

I took upstreams suggestion and turned it into a patch that could be 
applied to origami-pdf, unfortunately
when I tried to build origami-pdf it failed with.

ArgumentError: wrong number of arguments (given 1, expected 0; required 
keyword: year)
     /origami-pdf-2.0.0/lib/origami/string.rb:383:in `initialize'
     /origami-pdf-2.0.0/lib/origami/string.rb:453:in `new'
     /origami-pdf-2.0.0/lib/origami/string.rb:453:in `now'
     /origami-pdf-2.0.0/lib/origami/signature.rb:517:in `pre_build'
     /origami-pdf-2.0.0/lib/origami/pdf.rb:798:in `block in physicalize'
     /origami-pdf-2.0.0/lib/origami/pdf.rb:808:in `block (2 levels) in 
physicalize'
     /origami-pdf-2.0.0/lib/origami/dictionary.rb:137:in `block in map!'
     /origami-pdf-2.0.0/lib/origami/dictionary.rb:136:in `each_pair'
     /origami-pdf-2.0.0/lib/origami/dictionary.rb:136:in `map!'
     /origami-pdf-2.0.0/lib/origami/pdf.rb:802:in `block in physicalize'
     /origami-pdf-2.0.0/lib/origami/pdf.rb:808:in `block (2 levels) in 
physicalize'
     /origami-pdf-2.0.0/lib/origami/pdf.rb:802:in `map!'
     /origami-pdf-2.0.0/lib/origami/pdf.rb:802:in `block in physicalize'
     /origami-pdf-2.0.0/lib/origami/pdf.rb:817:in `block (2 levels) in 
physicalize'
     /origami-pdf-2.0.0/lib/origami/pdf.rb:816:in `each_value'
     /origami-pdf-2.0.0/lib/origami/pdf.rb:816:in `block in physicalize'
     /origami-pdf-2.0.0/lib/origami/pdf.rb:808:in `block (2 levels) in 
physicalize'
     /origami-pdf-2.0.0/lib/origami/dictionary.rb:137:in `block in map!'
     /origami-pdf-2.0.0/lib/origami/dictionary.rb:136:in `each_pair'
     /origami-pdf-2.0.0/lib/origami/dictionary.rb:136:in `map!'
     /origami-pdf-2.0.0/lib/origami/pdf.rb:802:in `block in physicalize'
     /origami-pdf-2.0.0/lib/origami/pdf.rb:828:in `block in physicalize'
     /origami-pdf-2.0.0/lib/origami/pdf.rb:827:in `each'
     /origami-pdf-2.0.0/lib/origami/pdf.rb:827:in `physicalize'
     /origami-pdf-2.0.0/lib/origami/pdf.rb:722:in `compile'
     /origami-pdf-2.0.0/lib/origami/signature.rb:200:in `sign'
     /origami-pdf-2.0.0/test/test_pdf_sign.rb:43:in `test_sign'

I beleive this is related to changes in ruby 3.0, 
https://rubyreferences.github.io/rubychanges/3.0.html#keyword-arguments-are-now-fully-separated-from-positional-arguments 
I fixed the
code according to the information on that page and did another build.

After installing that, I tested that pdfwalker now crashes with an 
apparently unrelated error,
so the workaround appears to be effective.

> /usr/share/origami/gui/treeview.rb:54:in `<class:PDFTree>': 
> 'Pango::WEIGHT_NORMAL' has been deprecated. Use 
> 'Pango::Weight::NORMAL' or ':normal'.
> /usr/share/origami/gui/treeview.rb:54:in `<class:PDFTree>': 
> 'Pango::STYLE_NORMAL' has been deprecated. Use 'Pango::Style::NORMAL' 
> or ':normal'.
> /usr/share/origami/gui/treeview.rb:376:in `reset_appearance': 
> 'Pango::WEIGHT_BOLD' has been deprecated. Use 'Pango::Weight::BOLD' or 
> ':bold'.
> /usr/share/origami/gui/treeview.rb:385:in `reset_appearance': 
> 'Pango::STYLE_ITALIC' has been deprecated. Use 'Pango::Style::ITALIC' 
> or ':italic'.
> /usr/share/origami/gui/treeview.rb:390:in `reset_appearance': 
> 'Pango::STYLE_OBLIQUE' has been deprecated. Use 
> 'Pango::Style::OBLIQUE' or ':oblique'.
> /usr/lib/ruby/vendor_ruby/glib2/deprecatable.rb:112:in 
> `const_missing': uninitialized constant Pango::FontDescription::Weight 
> (NameError)
> Did you mean?  Pango::Weight
>         from /usr/share/origami/gui/treeview.rb:63:in `initialize'
>         from /usr/share/origami/gui/treeview.rb:28:in `new'
>         from /usr/share/origami/gui/treeview.rb:28:in `create_treeview'
>         from /usr/share/origami/gui/walker.rb:94:in `initialize'
>         from /usr/share/origami/gui/walker.rb:60:in `new'
>         from /usr/share/origami/gui/walker.rb:60:in `start'
>         from /usr/bin/pdfwalker:6:in `<main>'

IMO bug 1000618 should be downgraded. Given that there is a known workaround
and given that only one of the three reverse dependencies seems to be 
affected,
I don't think the bug can reasonably be regarded as rendering ruby-gtk2 
unusable.

origami-pdf clearly needs more work though, by someone with more ruby 
knowlege
than me if it is to get back into testing, I've attached a debdiff of 
what I have done
so far anyway.

-------------- next part --------------
diff -Nru origami-pdf-2.0.0/debian/changelog origami-pdf-2.0.0/debian/changelog
--- origami-pdf-2.0.0/debian/changelog	2016-10-28 19:21:34.000000000 +0000
+++ origami-pdf-2.0.0/debian/changelog	2022-03-05 19:11:29.000000000 +0000
@@ -1,3 +1,10 @@
+origami-pdf (2.0.0-1+rpi1) bookworm-staging; urgency=medium
+
+  * Apply workaround for ruby gtk2/openssl conflict.
+  * Fix tests with ruby 3.0.
+
+ -- Peter Michael Green <plugwash at raspbian.org>  Sat, 05 Mar 2022 19:11:29 +0000
+
 origami-pdf (2.0.0-1) unstable; urgency=medium
 
   * New upstream release
diff -Nru origami-pdf-2.0.0/debian/patches/gtk2-openssl-workaround.patch origami-pdf-2.0.0/debian/patches/gtk2-openssl-workaround.patch
--- origami-pdf-2.0.0/debian/patches/gtk2-openssl-workaround.patch	1970-01-01 00:00:00.000000000 +0000
+++ origami-pdf-2.0.0/debian/patches/gtk2-openssl-workaround.patch	2022-03-05 19:11:29.000000000 +0000
@@ -0,0 +1,27 @@
+Description: Apply workaround for ruby gtk2/openssl conflict.
+ A conflict between the gtk2 and openssl modules prevents pdfwalker from
+ starting. ruby-gnome upstream reccomended reordering includes/requires as a
+ workaround, this patch does that.
+
+ https://github.com/ruby-gnome/ruby-gnome/issues/1449
+Author: Peter Michael Green <plugwash at debian.org>
+
+--- origami-pdf-2.0.0.orig/bin/gui/walker.rb
++++ origami-pdf-2.0.0/bin/gui/walker.rb
+@@ -25,7 +25,6 @@ begin
+ rescue LoadError
+     abort('Error: you need to install ruby-gtk2 to run this application')
+ end
+-include Gtk
+ 
+ begin
+     require 'origami'
+@@ -34,6 +33,8 @@ rescue LoadError
+     require 'origami'
+ end
+ 
++include Gtk
++
+ require 'gui/menu'
+ require 'gui/about'
+ require 'gui/file'
diff -Nru origami-pdf-2.0.0/debian/patches/ruby-3.0.patch origami-pdf-2.0.0/debian/patches/ruby-3.0.patch
--- origami-pdf-2.0.0/debian/patches/ruby-3.0.patch	1970-01-01 00:00:00.000000000 +0000
+++ origami-pdf-2.0.0/debian/patches/ruby-3.0.patch	2022-03-05 19:11:29.000000000 +0000
@@ -0,0 +1,40 @@
+Description: ruby 3.0 compatibility.
+ Ruby 3.0 requires explicit conversion of hash to keywork arguments, see
+ https://rubyreferences.github.io/rubychanges/3.0.html#keyword-arguments-are-now-fully-separated-from-positional-arguments
+Author: Peter Michael Green <plugwash at raspbian.org>
+
+---
+The information above should follow the Patch Tagging Guidelines, please
+checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
+are templates for supplementary fields that you might want to add:
+
+Origin: <vendor|upstream|other>, <url of original patch>
+Bug: <url in upstream bugtracker>
+Bug-Debian: https://bugs.debian.org/<bugnumber>
+Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
+Forwarded: <no|not-needed|url proving that it has been forwarded>
+Reviewed-By: <name and email of someone who approved the patch>
+Last-Update: 2022-03-05
+
+Index: origami-pdf-2.0.0/lib/origami/string.rb
+===================================================================
+--- origami-pdf-2.0.0.orig/lib/origami/string.rb
++++ origami-pdf-2.0.0/lib/origami/string.rb
+@@ -430,7 +430,7 @@ module Origami
+                 date[:utc_offset] = utc_offset
+             end
+ 
+-            Origami::Date.new(date)
++            Origami::Date.new(**date)
+         end
+ 
+         #
+@@ -450,7 +450,7 @@ module Origami
+                 utc_offset: now.utc_offset
+             }
+ 
+-            Origami::Date.new(date)
++            Origami::Date.new(**date)
+         end
+     end
+ 
diff -Nru origami-pdf-2.0.0/debian/patches/series origami-pdf-2.0.0/debian/patches/series
--- origami-pdf-2.0.0/debian/patches/series	2016-10-28 19:21:34.000000000 +0000
+++ origami-pdf-2.0.0/debian/patches/series	2022-03-05 19:11:29.000000000 +0000
@@ -1 +1,3 @@
 0001-Adjust-paths-to-work-against-installed-code.patch
+gtk2-openssl-workaround.patch
+ruby-3.0.patch


More information about the Pkg-ruby-extras-maintainers mailing list