From: william.mccumstie@... Date: 2017-07-06T11:10:39+00:00 Subject: [ruby-core:81932] [Ruby trunk Bug#13722] OptionParser::DecimalInteger can be converted as Octal Issue #13722 has been updated by wmccumstie (William McCumstie). From optparse.rb: ``` OptionParser comes with a few ready-to-use kinds of type # coercion. They are: # # - Date -- Anything accepted by +Date.parse+ # - DateTime -- Anything accepted by +DateTime.parse+ # - Time -- Anything accepted by +Time.httpdate+ or +Time.parse+ # - URI -- Anything accepted by +URI.parse+ # - Shellwords -- Anything accepted by +Shellwords.shellwords+ # - String -- Any non-empty string # - Integer -- Any integer. Will convert octal. (e.g. 124, -3, 040) # - Float -- Any float. (e.g. 10, 3.14, -100E+13) # - Numeric -- Any integer, float, or rational (1, 3.4, 1/3) # - DecimalInteger -- Like +Integer+, but no octal format. # - OctalInteger -- Like +Integer+, but no decimal format. # - DecimalNumeric -- Decimal integer or float. # - TrueClass -- Accepts '+, yes, true, -, no, false' and # defaults as +true+ # - FalseClass -- Same as +TrueClass+, but defaults to +false+ # - Array -- Strings separated by ',' (e.g. 1,2,3) # - Regexp -- Regular expressions. Also includes options. ``` DecimalInteger does not support octal format. So either it should convert as a decimal or throw an error. ---------------------------------------- Bug #13722: OptionParser::DecimalInteger can be converted as Octal https://bugs.ruby-lang.org/issues/13722#change-65656 * Author: wmccumstie (William McCumstie) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: ruby 2.5.0dev (2017-07-03 trunk 59255) [x86_64-linux] * Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN ---------------------------------------- OptionParser::DecimalInteger will convert in octal format for input values that start with a '0'. In the attached script, an input of '035' will be converted to 29. Script Output: $: ./ruby-op-octal-bug.rb Input: 035 Parsed: 29 ---Files-------------------------------- ruby-op-octal-bug.rb (332 Bytes) -- https://bugs.ruby-lang.org/ Unsubscribe: