Bug #4467
closedProcess.maxgroups= should only accept numeric values
Description
=begin
At the moment Process.maxgroups= accepts non-numeric values, which results in defaulting to 4096. IMO it should raise a TypeError.
diff --git a/process.orig b/process.c
index f658fa9..c3c4a1f 100644
--- a/process.orig
+++ b/process.c
@@ -2752,7 +2752,7 @@ proc_getmaxgroups(obj)
static VALUE
proc_setmaxgroups(VALUE obj, VALUE val)
{
- size_t ngroups = FIX2INT(val);
-
size_t ngroups = NUM2INT(val);
if (ngroups > 4096)
ngroups = 4096;
=end
Updated by djberg96 (Daniel Berger) over 13 years ago
=begin
I'd also argue that it should raise an ArgumentError for values less than 0.
=end
Updated by kosaki (Motohiro KOSAKI) over 13 years ago
=begin
Hi
Process.maxgroup has more serious issue. Linux has 65536 maxgroup, but Ruby restrict it
4096. It's bad. :-/
So, I'd propse 1) deprecate maxgroups= method 2) maxgroup method use sysconf(_SC_NGROUPS_MAX)
(or NGROUPS_MAX macro if the platform don't have sysctl) instead mysterious 4096.
=end
Updated by kosaki (Motohiro KOSAKI) over 13 years ago
- ruby -v changed from ruby 1.8.7 (2010-08-16 patchlevel 334) [i686-linux] to -
=begin
Hi
Process.maxgroup has more serious issue. Linux has 65536 maxgroup, but Ruby restrict it
4096. It's bad. :-/
So, I'd propse 1) deprecate maxgroups= method 2) maxgroup method use sysconf(_SC_NGROUPS_MAX)
(or NGROUPS_MAX macro if the platform don't have sysctl) instead mysterious 4096.
sitenode: Today, I've searched maxgroups usecase awhile. But, I have
no luck. I haven't
found any usecase. Instead JRuby don't implement both maxgroups and
maxgroups= method. Then, I think this is no big issue...
=end
Updated by kosaki (Motohiro KOSAKI) over 13 years ago
=begin
Hi Daniel,
I've applyed the suggest of Coeemnt#1 (ie. negative value check) by r31035 into trunk.
But I can't reproduce your mention of to accept non numeric value. At least, trunk seems to
reject non numeric value already.
% ./ruby-193 -e 'Process.maxgroups="100"'
-e:1:in maxgroups=': can't convert String into Integer (TypeError) from -e:1:in
'
So, could you please post your test code?
=end
Updated by djberg96 (Daniel Berger) over 13 years ago
=begin
My report was for 1.8.7:
irb(main):003:0> Process.maxgroups = "test"
=> "test"
irb(main):004:0> Process.maxgroups
=> 4096
It must have been fixed in 1.9.
Regards,
Dan
=end
Updated by kosaki (Motohiro KOSAKI) over 13 years ago
- Status changed from Open to Closed
=begin
=end
Updated by djberg96 (Daniel Berger) over 13 years ago
=begin
I agree, Process.maxgroups= should be deprecated unless there's an underlying posix call that supports it. I don't think there is one, and I agree that there doesn't seem to be a use case for it.
=end
Updated by naruse (Yui NARUSE) over 13 years ago
=begin
(2011/03/07 12:47), Kiyotaka ATSUMI wrote:
Recently, I received some mails written as "To:
undisclosed-recipients:;" from this mailing list.Since I am classifying e-mail according to 'To' field, I cannot
classify such mail, and I am in trouble. So, please write
"ruby-core@ruby-lang.org" to 'To' field if possible.
Using 'To' field breaks filters when ruby-core@ is in CC.
Correct way is see following fields:
- X-ML-Name: ruby-core
- List-Id: ruby-core.ruby-lang.org
--
NARUSE, Yui naruse@airemix.jp
=end
Updated by kosaki (Motohiro KOSAKI) over 13 years ago
=begin
Hi
Process.maxgroup has more serious issue. Linux has 65536 maxgroup, but Ruby restrict it
4096. It's bad. :-/
So, I'd propse 1) deprecate maxgroups= method 2) maxgroup method use sysconf(_SC_NGROUPS_MAX)
(or NGROUPS_MAX macro if the platform don't have sysctl) instead mysterious 4096.
sitenode: Today, I've searched maxgroups usecase awhile. But, I have
no luck. I haven't
found any usecase. Instead JRuby don't implement both maxgroups and
maxgroups= method. Then, I think this is no big issue...
=end
Updated by naruse (Yui NARUSE) over 13 years ago
=begin
(2011/03/07 12:47), Kiyotaka ATSUMI wrote:
Recently, I received some mails written as "To:
undisclosed-recipients:;" from this mailing list.Since I am classifying e-mail according to 'To' field, I cannot
classify such mail, and I am in trouble. So, please write
"ruby-core@ruby-lang.org" to 'To' field if possible.
Using 'To' field breaks filters when ruby-core@ is in CC.
Correct way is see following fields:
- X-ML-Name: ruby-core
- List-Id: ruby-core.ruby-lang.org
--
NARUSE, Yui naruse@airemix.jp
=end
Updated by kosaki (Motohiro KOSAKI) over 13 years ago
=begin
Hi
Process.maxgroup has more serious issue. Linux has 65536 maxgroup, but Ruby restrict it
4096. It's bad. :-/
So, I'd propse 1) deprecate maxgroups= method 2) maxgroup method use sysconf(_SC_NGROUPS_MAX)
(or NGROUPS_MAX macro if the platform don't have sysctl) instead mysterious 4096.
sitenode: Today, I've searched maxgroups usecase awhile. But, I have
no luck. I haven't
found any usecase. Instead JRuby don't implement both maxgroups and
maxgroups= method. Then, I think this is no big issue...
=end
Updated by naruse (Yui NARUSE) over 13 years ago
=begin
(2011/03/07 12:47), Kiyotaka ATSUMI wrote:
Recently, I received some mails written as "To:
undisclosed-recipients:;" from this mailing list.Since I am classifying e-mail according to 'To' field, I cannot
classify such mail, and I am in trouble. So, please write
"ruby-core@ruby-lang.org" to 'To' field if possible.
Using 'To' field breaks filters when ruby-core@ is in CC.
Correct way is see following fields:
- X-ML-Name: ruby-core
- List-Id: ruby-core.ruby-lang.org
--
NARUSE, Yui naruse@airemix.jp
=end