[#82706] [Ruby trunk Bug#13851] getting "can't modify string; temporarily locked" on non-frozen instances — cardoso_tiago@...
Issue #13851 has been updated by chucke (Tiago Cardoso).
3 messages
2017/09/07
[#82853] [Ruby trunk Bug#13916] Race condition when sending a signal to a new fork — russell.davis@...
Issue #13916 has been reported by russelldavis (Russell Davis).
3 messages
2017/09/19
[#82892] [Ruby trunk Bug#13921] buffered read_nonblock doesn't work as expected using SSLSocket — cardoso_tiago@...
Issue #13921 has been updated by chucke (Tiago Cardoso).
3 messages
2017/09/20
[ruby-core:83053] [Ruby trunk Bug#13947] Incorreсt string parsing in Date.parse
From:
merch-redmine@...
Date:
2017-09-28 19:44:08 UTC
List:
ruby-core #83053
Issue #13947 has been updated by jeremyevans0 (Jeremy Evans).
shevegen (Robert A. Heiler) wrote:
> On my system ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-linux] I get:
>
>
> Date.parse('Some random string')
> # ArgumentError: invalid date
>
> Date.parse('Repellendus Sint sunt quae molestiae dolor illo inventore ea')
> # => #<Date: 2017-09-24 ((2458021j,0s,0n),+0s,2299161j)>
>
> So I assume that the first has changed. I have no idea why the latter works
> though - I agree. That is weird, unless it is some hidden time info ... but
> to my untrained eyes, it looks like an inconsistency. :D
>
> Given that the behaviour between 2.3.3 and 2.4.x is different in the first
> case, I assume that this was not deliberate, so, yep probably a bug.
This isn't a bug, it's the result of the fact that `Date.parse` has always been deliberately loose in parsing (back to ruby 1.8 at least), and `sunt` is parsed as Sunday, returning the Sunday for the current week:
~~~
require 'date'
puts %w'Repellendus Sint sunt quae molestiae dolor illo inventore ea'.map{|w| [w, (Date.parse(w) rescue nil)].inspect}
["Repellendus", nil]
["Sint", nil]
["sunt", #<Date: 2017-09-24 ((2458021j,0s,0n),+0s,2299161j)>]
["quae", nil]
["molestiae", nil]
["dolor", nil]
["illo", nil]
["inventore", nil]
["ea", nil]
~~~
Changing `Date.parse` to be strict instead of loose would be a significant break to backwards compatibility.
In general, you shouldn't pass random data to `Date.parse` and expect it to return an error. `Date.parse` always assumes there is some date information in the string and tries its best to find it, and only raises an error if it can't find any date information.
And if you assume that `sunt` shouldn't be recognized as Sunday, you should consider cases such as:
```
Date.parse('2008W50')
=> #<Date: 2008-12-08 ((2454809j,0s,0n),+0s,2299161j)>
Date.parse('SunT2008W50')
=> #<Date: 2008-12-14 ((2454815j,0s,0n),+0s,2299161j)>
Date.parse('SatT2008W50')
=> #<Date: 2008-12-13 ((2454814j,0s,0n),+0s,2299161j)>
```
----------------------------------------
Bug #13947: Incorreсt string parsing in Date.parse
https://bugs.ruby-lang.org/issues/13947#change-66979
* Author: gregory (Gregory Tereshko)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: 2.3.3
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
There is no exception when parsing random lorem ipsum string to date. But if parse any another string everithing works smoothly.
The income string is - "Repellendus Sint sunt quae molestiae dolor illo inventore ea"


**UPD:**
It reacts on "sun" in that string
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>