[DRE-maint] Bug#859463: ruby-unf-ext FTBFS on ppc64el: unf/table.hh:13539:25: error: narrowing conversion of '-52' from 'int' to 'char' inside { } [-Wnarrowing]

Antonio Terceiro terceiro at debian.org
Thu Apr 6 19:54:13 UTC 2017


On Tue, Apr 04, 2017 at 02:26:00PM +0000, Niels Thykier wrote:
> On Mon, 03 Apr 2017 23:38:48 +0300 Adrian Bunk <bunk at debian.org> wrote:
> > Source: ruby-unf-ext
> > Version: 0.0.7.2-2
> > Severity: serious
> > 
> > ruby-unf-ext FTBFS on ppc64el (originally reported by Frederic Bonnard):
> > 
> > ...
> > unf/table.hh:13539:25: error: narrowing conversion of '-51' from 'int' to 'char' inside { } [-Wnarrowing]
> > unf/table.hh:13539:25: error: narrowing conversion of '-123' from 'int' to 'char' inside { } [-Wnarrowing]
> > unf/table.hh:13539:25: error: narrowing conversion of '-50' from 'int' to 'char' inside { } [-Wnarrowing]
> > unf/table.hh:13539:25: error: narrowing conversion of '-105' from 'int' to 'char' inside { } [-Wnarrowing]
> > unf/table.hh:13539:25: error: narrowing conversion of '-52' from 'int' to 'char' inside { } [-Wnarrowing]
> > ...
> > 
> > 
> > Complete log is attached.
> 
> This is caused by ppc64el having "char" being unsigned by default.
> Beyond the table that needs to be converted/dealt with, there are about
> 20 -Wsign-conversion issues in the code that smells like they may cause
> issues as well.
> 
> That said, a short term fix may be to revert:
> https://github.com/knu/ruby-unf_ext/commit/1e2d2bc29798342ab2616eb3d74ea36c793a33e4

Nope. That was actually done after the current upstream release that we
have in Debian, actually tyring to _fix_ the issue. The actual fix comes
a little later in
https://github.com/knu/ruby-unf_ext/commit/8a6a735b51ef903200fc541112e35b7cea781856

I even proposed to revert that:
https://github.com/knu/ruby-unf_ext/pull/27

Upstream seems to be cooking a new release, to be released at any time
now I assume. With or without that special case for ARM, the code buids
OK under ppc64el.

I will probably upload that, since the resulting upstream diff looks
quite unproblematic (if they accept my proposal, the chunk for
ext/unf_ext/extconf.rb will disappear from the final diff):

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8c20624..60c99a6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.0.7.3 (2017-04-06)
+
+- Fix compile issues on ARM and GCC 6.
+
 ## 0.0.7.2 (2016-02-01)
 
 - Version bump just for adding Windows binaries for Ruby 2.3.
diff --git a/ext/unf_ext/extconf.rb b/ext/unf_ext/extconf.rb
index 9068085..746d7ca 100644
--- a/ext/unf_ext/extconf.rb
+++ b/ext/unf_ext/extconf.rb
@@ -6,6 +6,17 @@ else
   have_library('stdc++')
 end
 
+case RUBY_PLATFORM
+when /\Aarm/
+  # A quick fix for char being unsigned by default on ARM
+  if defined?($CXXFLAGS)
+    $CXXFLAGS << ' -fsigned-char'
+  else
+    # Ruby < 2.0
+    $CFLAGS << ' -fsigned-char'
+  end
+end
+
 create_makefile 'unf_ext'
 
 unless CONFIG['CXX']
diff --git a/ext/unf_ext/unf/normalizer.hh b/ext/unf_ext/unf/normalizer.hh
index b19b99c..d20244b 100644
--- a/ext/unf_ext/unf/normalizer.hh
+++ b/ext/unf_ext/unf/normalizer.hh
@@ -17,9 +17,9 @@ namespace UNF {
 
   public:
     Normalizer()
-      : nf_d(TABLE::NODES, TABLE::CANONICAL_DECOM_ROOT, TABLE::STRINGS),
-	nf_kd(TABLE::NODES, TABLE::COMPATIBILITY_DECOM_ROOT, TABLE::STRINGS),
-	nf_c(TABLE::NODES, TABLE::CANONICAL_COM_ROOT, TABLE::STRINGS),
+      : nf_d(TABLE::NODES, TABLE::CANONICAL_DECOM_ROOT, (const char *)TABLE::STRINGS),
+	nf_kd(TABLE::NODES, TABLE::COMPATIBILITY_DECOM_ROOT, (const char *)TABLE::STRINGS),
+	nf_c(TABLE::NODES, TABLE::CANONICAL_COM_ROOT, (const char *)TABLE::STRINGS),
 	nf_c_qc(TABLE::NODES, TABLE::NFC_ILLEGAL_ROOT),
 	nf_kc_qc(TABLE::NODES, TABLE::NFKC_ILLEGAL_ROOT),
 	ccc(TABLE::NODES, TABLE::CANONICAL_CLASS_ROOT)
diff --git a/ext/unf_ext/unf/table.hh b/ext/unf_ext/unf/table.hh
index 2b45703..ecfe147 100644
--- a/ext/unf_ext/unf/table.hh
+++ b/ext/unf_ext/unf/table.hh
@@ -6297,7 +6297,7 @@ const unsigned NODES[]={
 0xFF000000,0xFF000000,0xFF000000,0xFF000000,0xFF000000,0xFF000000,0xFF000000,0xFF000000,0xFF000000,0xFF000000,
 0xFF000000,0xFF000000,0xFF000000,0xFF000000,0xFF000000};
 
-const char STRINGS[]={
+const signed char STRINGS[]={
  -27,-113, -81, -27, -66,-105, -27,-106, -74, -25,-108, -77, -26, -70,-128, -27,-112,-120, -25, -87,
  -70, -25, -90,-127, -26,-116,-121, -23,-127,-118, -26,-115,-107, -26,-118,-107, -26, -68,-108, -27,
 -112, -71, -27, -93, -80, -24, -78, -87, -25, -75,-126, -27,-120, -99, -26,-106, -80, -27, -66,-116,
diff --git a/lib/unf_ext/version.rb b/lib/unf_ext/version.rb
index f9d0c50..7c77497 100644
--- a/lib/unf_ext/version.rb
+++ b/lib/unf_ext/version.rb
@@ -1,5 +1,5 @@
 module UNF
   class Normalizer
-    VERSION = "0.0.7.2"
+    VERSION = "0.0.7.3"
   end
 end
diff --git a/unf_ext.gemspec b/unf_ext.gemspec
index 28f6eda..c00426c 100644
--- a/unf_ext.gemspec
+++ b/unf_ext.gemspec
@@ -25,15 +25,16 @@ Gem::Specification.new do |gem|
   ]
 
   if RUBY_VERSION < "1.9"
+    gem.add_development_dependency("rake", [">= 0.9.2.2", "< 11"])
     gem.add_development_dependency('i18n', '< 0.7.0')
     # Cap dependency on activesupport with < 4.0 on behalf of
     # shoulda-matchers to satisfy bundler.
     gem.add_development_dependency("activesupport", ["< 4.0"])
     gem.add_development_dependency("test-unit", ["= 3.1.5"])
   else
+    gem.add_development_dependency("rake", [">= 0.9.2.2"])
     gem.add_development_dependency("test-unit")
   end
-  gem.add_development_dependency("rake", [">= 0.9.2.2"])
   gem.add_development_dependency("rdoc", ["> 2.4.2"])
   gem.add_development_dependency("bundler", [">= 1.2"])
   gem.add_development_dependency("rake-compiler", [">= 0.7.9"])
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-ruby-extras-maintainers/attachments/20170406/3394ca39/attachment.sig>


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