[#101179] Spectre Mitigations — Amel <amel.smajic@...>
Hi there!
5 messages
2020/12/01
[#101180] Re: Spectre Mitigations
— Chris Seaton <chris@...>
2020/12/01
I wouldn’t recommend using Ruby to run in-process untrusted code in the first place. Are people doing that?
[#101694] Ruby 3.0.0 Released — "NARUSE, Yui" <naruse@...>
We are pleased to announce the release of Ruby 3.0.0. From 2015 we
4 messages
2020/12/25
[ruby-core:101572] [Ruby master Bug#17409] Endless range of dates stuck on include? when miss
From:
sergey.gnuskov@...
Date:
2020-12-21 08:19:45 UTC
List:
ruby-core #101572
Issue #17409 has been updated by gsmetal (Sergey G).
duerst (Martin Dst) wrote in #note-4:
> zverok (Victor Shepelev) wrote in #note-1:
> > Nothing specific to dates there, and not a bug.
> >
> > This is just how ranges work:
> > * `range.include?(x)` is basically `range.each.any? {|el| el == x }`, which, with endless range, is an infinite loop
> > * `range.cover?(x)` is basically `x >= range.begin && x <= range.end`, which is instantaneous.
> >
> > The behavior of `#include?` is redefined for Numeric and String, so `(1..).include?(0)` will behave like `cover?` (return `false` immediately), but with any other type, the behavior is the same as for Date.
>
> What's the reason there is no redefinition for Date? Is there an actual use case for something like the current `(Date.today..).include?(Date.today - 1)` (of course with other actual values, because we don't need this to create an infinite loop)?
Yes, it was a little bit frustrating, that everything worked on numbers and then it unexpectedly stuck on dates.. This case with endless ranges should be at least somehow mentioned in `include?` documentation, I think. Now it doesn't seem very clear [here](https://ruby-doc.org/core-2.7.1/Range.html#method-i-include-3F).
----------------------------------------
Bug #17409: Endless range of dates stuck on include? when miss
https://bugs.ruby-lang.org/issues/17409#change-89357
* Author: gsmetal (Sergey G)
* Status: Rejected
* Priority: Normal
* ruby -v: ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
This code stucks (on latest ruby 2.7.1):
```ruby
require 'date'
(Date.today..).include?(Date.today - 1)
```
But it works well with `cover?`:
```ruby
2.7.1 :001 > require 'date'
=> true
2.7.1 :002 > (Date.today..).cover?(Date.today - 1)
=> false
```
--
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>