Package: ruby-gruff
Followup-For: Bug #676206

Dear Nobuhiro,

Thank you for working on this issue. The bug is simply caused by the fact that
taking the modulo with respect to 0.0 gives an "Division by zero" error
with Ruby1.9, but raises no error and return NaN with Ruby1.8.

This has been discussed upstream [1], and the corresponding code has been
merged [2].

The patch you proposed for supporting 1.9.3 contains this fix, but also
many modifications that did not appear in upstream release (other than
the upstream VCS). They contain code such that 'require "rubygems"' that
are not suitable for Debian Ruby packages.

Ignoring the test results for Ruby 1.9 is also not satisfactory, I am
afraid.

It occurs that the 'freeze_exception' branch of Git repository for the
Debian packaging of ruby-gruff [3] includes the patch [2] cherrypicked
from upstream. It is waiting for review and upload [4]. I should have
tagged this bug as pending and fixed-upstream, which I am doing now.

  1: https://github.com/topfunky/gruff/issues/21
  2: https://github.com/topfunky/gruff/pull/22
  3: 
http://anonscm.debian.org/gitweb/?p=pkg-ruby-extras/ruby-gruff.git;a=summary
  4: http://lists.debian.org/debian-ruby/2012/07/msg00000.html

See debdiff output attached.

Cheers,

Cédric
diff -Nru ruby-gruff-0.3.6/debian/changelog ruby-gruff-0.3.6/debian/changelog
--- ruby-gruff-0.3.6/debian/changelog	2012-07-23 13:58:26.000000000 +0200
+++ ruby-gruff-0.3.6/debian/changelog	2012-07-23 14:03:14.000000000 +0200
@@ -1,3 +1,12 @@
+ruby-gruff (0.3.6-6) unstable; urgency=low
+
+  * Team upload
+  * Add fix_division_by_0 patch, applied upstream to prevent 'division by zero'
+    errors with Ruby1.9 if @marker_count is not set explicitly, which is the
+    case in the test suite (Closes:#676206)
+
+ -- Cédric Boutillier <cedric.boutill...@gmail.com>  Fri, 06 Jul 2012 06:03:30 +0200
+
 ruby-gruff (0.3.6-5) unstable; urgency=low
 
   * Added missing dependency and build-dependency on ruby-rmagick
diff -Nru ruby-gruff-0.3.6/debian/patches/fix_division_by_0 ruby-gruff-0.3.6/debian/patches/fix_division_by_0
--- ruby-gruff-0.3.6/debian/patches/fix_division_by_0	1970-01-01 01:00:00.000000000 +0100
+++ ruby-gruff-0.3.6/debian/patches/fix_division_by_0	2012-07-23 14:03:14.000000000 +0200
@@ -0,0 +1,25 @@
+Description: Fix division by zero errors with Ruby1.9
+Author: Serge Prikha <pri...@gmail.com>
+Origin: https://github.com/prikha/gruff/commit/f5098443aba86fc59b02eace6ecad7530d72694b
+Reviewed-by: Cédric Boutillier <cedric.boutill...@gmail.com>
+Applied-Upstream: yes
+Bug: https://github.com/topfunky/gruff/issues/21
+Bug-Debian: http://bugs.debian.org/676206
+Last-Update: 2012-06-06
+
+
+---
+ lib/gruff/base.rb |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/lib/gruff/base.rb
++++ b/lib/gruff/base.rb
+@@ -1062,7 +1062,7 @@
+     # Return a formatted string representing a number value that should be
+     # printed as a label.
+     def label(value)
+-      label = if (@spread.to_f % @marker_count.to_f == 0) || !@y_axis_increment.nil?
++      label = if (@spread.to_f % (@marker_count.to_f==0 ? 1 : @marker_count.to_f) == 0) || !@y_axis_increment.nil?
+         value.to_i.to_s
+       elsif @spread > 10.0
+         sprintf("%0i", value)
diff -Nru ruby-gruff-0.3.6/debian/patches/series ruby-gruff-0.3.6/debian/patches/series
--- ruby-gruff-0.3.6/debian/patches/series	2012-07-23 13:58:26.000000000 +0200
+++ ruby-gruff-0.3.6/debian/patches/series	2012-07-23 14:03:14.000000000 +0200
@@ -1,3 +1,4 @@
 drop_require_rubygems
 remove_obsolete_call_from_test_line
 sort_needed_for_test_scene
+fix_division_by_0

Reply via email to