ruby-commandline [0.7.10-13] (quantal) -- ERROR: comparison of String with 10 failed

Bug #1123281 reported by J G Miller
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ruby-commandline (Ubuntu)
New
Undecided
Unassigned

Bug Description

PRETTY_NAME="Ubuntu quantal (12.10)"
VERSION="12.10, Quantal Quetzal"

Package: ruby-commandline
Priority: optional
Section: ruby
Installed-Size: 96
Maintainer: Ubuntu Developers <email address hidden>
Architecture: all
Version: 0.7.10-13
Ruby-Versions: ruby1.9.1 ruby1.8

After installing dhelp which uses ruby, I was frequently seeing during package installation the error message

ERROR: comparison of String with 10 failed

following the invocation of dhelp information processing for the particular package.

In fact, just invoking dhelp_parse at the command line produces the error message

 dhelp_parse
ERROR: comparison of String with 10 failed

After investigation, it was ascertained that this error was due to console width
being obtained from the environmental variable COLUMNS in the form of a string
and not being automatically converted to an integer.

Therefore the following fix of changing console width from a string to an integer needed to be applied to

/usr/lib/ruby/vendor_ruby/commandline/application.rb

--- application.rb.OLD 2012-05-30 12:59:59.000000000 +0200
+++ application.rb.NEW 2012-05-30 12:59:59.000000000 +0200
@@ -336,6 +336,7 @@
     # Formatting defaults
     #
     console_width = ENV["COLUMNS"]
+ console_width = console_width.to_i
     @columns =
       if console_width.nil?
         DEFAULT_CONSOLE_WIDTH

and to

/usr/lib/ruby/vendor_ruby/commandline/optionparser/optionparser.rb

--- optionparser.rb.OLD 2012-05-30 12:59:59.000000000 +0200
+++ optionparser.rb.NEW 2012-05-30 12:59:59.000000000 +0200
@@ -67,6 +67,7 @@
     # Formatting defaults
     #
     console_width = ENV["COLUMNS"]
+ console_width = console_width.to_i
     @columns =
       if console_width.nil?
         DEFAULT_CONSOLE_WIDTH

in order to ensure that in both cases the comparison test was being done on console width in the form of an integer.

Having applied this changes, dhelp_parse then works without error.

dhelp_parse
 Usage: dhelp_parse [-v] [-h] -a doc-base_file1 d-b_f2 ... | -d doc-base_file1 d-b_f2 ... | -i | -r

J G Miller (jgmiller)
description: updated
tags: added: dhelp ruby-commandline
tags: added: patch quantal
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.