[#61822] Plan Developers Meeting Japan April 2014 — Zachary Scott <e@...>

I would like to request developers meeting around April 17 or 18 in this month.

14 messages 2014/04/03
[#61825] Re: Plan Developers Meeting Japan April 2014 — Urabe Shyouhei <shyouhei@...> 2014/04/03

It's good if we have a meeting then.

[#61826] Re: Plan Developers Meeting Japan April 2014 — Zachary Scott <e@...> 2014/04/03

Regarding openssl issues, I’ve discussed possible meeting time with Martin last month and he seemed positive.

[#61833] Re: Plan Developers Meeting Japan April 2014 — Martin Bo煬et <martin.bosslet@...> 2014/04/03

Hi,

[ruby-core:62147] [ruby-trunk - Feature #9770] Etc.uname

From: akr@...
Date: 2014-04-24 15:03:32 UTC
List: ruby-core #62147
Issue #9770 has been updated by Akira Tanaka.


As far as the current usages are guraded by platform test such as /linux/ =~ RUBY_PLATFORM,
it seems that emulation on Windows is not so important for non-Windows platforms.

If someone want to check Windows version, Etc.uname may be a good method to provide the information.

----------------------------------------
Feature #9770: Etc.uname
https://bugs.ruby-lang.org/issues/9770#change-46301

* Author: Akira Tanaka
* Status: Open
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
----------------------------------------
How about Etc.uname method to call the uname(2) system call?

```
% ./ruby -rpp -retc -e 'pp Etc.uname'
{:sysname=>"Linux",
 :nodename=>"boron",
 :release=>"2.6.18-6-xen-686",
 :version=>"#1 SMP Thu Nov 5 19:54:42 UTC 2009",
 :machine=>"i686"}
```

Sometimes we need to obtain OS (kernel) version or similar system information.

For example, there are several tests which invokes uname command (and function via Win32API):

```
test/ruby/test_io.rb:        return false if (`/bin/uname -r`.split('.') <=> %w[3 8]) < 0
test/ruby/test_io.rb:        return false if (`/bin/uname -r`.split('.') <=> %w[3 5]) < 0
test/ruby/test_io.rb:        return false if (`/bin/uname -r`.split('.') <=> %w[3 8]) < 0
test/ruby/test_sleep.rb:        4.98 if /Linux ([\d.]+)/ =~ `uname -sr` && ($1.split('.')<=>%w/2 6 18/)<1
test/socket/test_socket.rb:            (`uname -r`[/[0-9.]+/].split('.').map(&:to_i) <=> [2,6,18]) <= 0
test/dbm/test_dbm.rb:        uname = Win32API.new('cygwin1', 'uname', 'P', 'I')
```

Etc.uname provides clean replacement for them.
`uname -r` can be changed to Etc.uname[:release].

uname function is defined by POSIX.
So it is pretty portable.
If the function is not available, NotImplementedError is raised.

I chose Etc module because uname() returns system wide information.

The return value is a plain hash because:

* Struct is marshal-incompatible if some OS add fields. (glibc has "domainname", for example.  Current implementation doesn't support it, though.)
* No inspect method required to view contents.

Any idea?


---Files--------------------------------
etc-uname.patch (3.16 KB)


-- 
https://bugs.ruby-lang.org/

In This Thread

Prev Next