From: nagachika00@... Date: 2014-02-19T16:38:44+00:00 Subject: [ruby-core:60871] [ruby-trunk - Bug #8865] OptionParser acceptable bugs Issue #8865 has been updated by Tomoyuki Chikanaga. Backport changed from 1.9.3: DONE, 2.0.0: REQUIRED to 1.9.3: DONE, 2.0.0: DONE r42844 and r42845 were backported to ruby_2_0_0 at r45050. ---------------------------------------- Bug #8865: OptionParser acceptable bugs https://bugs.ruby-lang.org/issues/8865#change-45282 * Author: Eric Hodel * Status: Closed * Priority: Normal * Assignee: Eric Hodel * Category: lib * Target version: * ruby -v: - * Backport: 1.9.3: DONE, 2.0.0: DONE ---------------------------------------- I have found a few bugs in OptionParser's accept feature: Hexadecimal and binary numbers are not properly supported for Integer OptionParser::DecimalInteger, OptionParser::OctalInteger and OptionParser::DecimalNumeric convert invalid input to 0 or nil instead of raising InvalidArgument. The attached patch fixes the validation regular expression for handling binary and hexadecimal arguments and adds verification for DecimalInteger, OctalInteger and DecimalNumeric ---Files-------------------------------- optparse.rb.accept.patch (1.63 KB) optparse.rb.accept.2.patch (6.85 KB) optparse.rb.accept.3.patch (7.77 KB) -- http://bugs.ruby-lang.org/