Bug 719921 - Date class init from string incorrect parsing
Summary: Date class init from string incorrect parsing
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: ruby
Version: 5.8
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: rc
: ---
Assignee: Vít Ondruch
QA Contact: BaseOS QE Security Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-07-08 12:29 UTC by Giovanni Cangiani
Modified: 2011-10-12 08:14 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-10-12 08:14:20 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Giovanni Cangiani 2011-07-08 12:29:58 UTC
Description of problem:
in /usr/lib/ruby/1.8/date/format.rb the function self.__strptime(str, fmt, elem) (line 87)
when reading the month data skips the third entry (%d). looks like it's eaten by %m.

Version-Release number of selected component (if applicable):
ruby 1.8.5

How reproducible:
100%

Steps to Reproduce:
# ruby
require 'date'
d=Date.strptime("20110103", "%Y%m%d")
p d
  
Actual results:
/usr/lib/ruby/1.8/date.rb:650:in `new_with_hash': 3 elements of civil date are necessary (ArgumentError)
	from /usr/lib/ruby/1.8/date.rb:675:in `strptime'
	from -:2


Expected results:
#<Date: 2011-01-03 (4911129/2,0,2299161)>

Additional info:
this bug is no longer present in ruby 1.8.7 so it is just a matter of updating the rpm for ruby

Comment 1 Vít Ondruch 2011-07-28 06:36:27 UTC
Hello Giovanni,

Rebase of Ruby to 1.8.7 version is not possible for RHEL-5. So this is not solution. Do you have by a chance patch which is fixing this issue? Nevertheless I am afraid that RHEL-5 is at end of cycle, so only bugs with huge impact are approved to be fixed. I am not sure this bug is one of them.

Comment 2 Vít Ondruch 2011-10-12 08:14:20 UTC
At the end, it is not bug according to Matz:

http://rubyforge.org/tracker/?func=detail&atid=1698&aid=5263&group_id=426


Note You need to log in before you can comment on or make changes to this bug.