[ruby-core:72809] Re: [Ruby trunk - Bug #11973] [Open] IO#advise should raise NotImplementedError on platforms that do not support that call

From: KOSAKI Motohiro <kosaki.motohiro@...>
Date: 2016-01-11 18:55:26 UTC
List: ruby-core #72809
On Sun, Jan 10, 2016 at 5:26 PM,  <git@chuckremes.com> wrote:
> Issue #11973 has been reported by Chuck Remes.
>
> ----------------------------------------
> Bug #11973: IO#advise should raise NotImplementedError on platforms that do not support that call
> https://bugs.ruby-lang.org/issues/11973
>
> * Author: Chuck Remes
> * Status: Open
> * Priority: Normal
> * Assignee:
> * ruby -v: 2.4.0
> * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
> ----------------------------------------
> Right now IO#advise returns nil when passed legal arguments even on platforms that do not support that POSIX function (like OS X). To be consistent with other calls in core, I think that IO#advise should raise NotImplementedError for unsupported platforms.

Simply impossible.
For example, Linux define POSIX_FADV_NOREUSE, but not implement AND no
error return. Then, IO#advise return nil and just no-op in this case.

We can implement raise NotImplementedError SOME CASES and not raise
another some cases. But nobody want such inconsistency mess.

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next