[#8484] strptime fails to properly parse certain inputs — <noreply@...>

Bugs item #5263, was opened at 2006-08-01 23:14

13 messages 2006/08/02
[#8485] Re: [ ruby-Bugs-5263 ] strptime fails to properly parse certain inputs — Yukihiro Matsumoto <matz@...> 2006/08/02

Hi,

[#8538] Re: [ ruby-Bugs-5263 ] strptime fails to properly parse certain inputs — nobu@... 2006/08/06

Hi,

[#8561] sandbox timers & block scopes — why the lucky stiff <ruby-core@...>

Two puzzles I am trying to solve:

28 messages 2006/08/08
[#8624] Re: sandbox timers & block scopes — why the lucky stiff <ruby-core@...> 2006/08/15

raise ThisDecayingInquisition, "anyone? anyone at all?"

[#8627] Re: sandbox timers & block scopes — MenTaLguY <mental@...> 2006/08/15

On Wed, 2006-08-16 at 00:35 +0900, why the lucky stiff wrote:

[#8628] Re: sandbox timers & block scopes — why the lucky stiff <ruby-core@...> 2006/08/15

On Wed, Aug 16, 2006 at 02:46:30AM +0900, MenTaLguY wrote:

[#8629] Re: sandbox timers & block scopes — "Charles O Nutter" <headius@...> 2006/08/15

On 8/15/06, why the lucky stiff <ruby-core@whytheluckystiff.net> wrote:

[#8690] a ruby-core primer — why the lucky stiff <ruby-core@...>

Hello, all. I've been working on the ruby-core page for the new Ruby site.

21 messages 2006/08/22

Re: [ ruby-Bugs-5351 ] Process.gid= fails on OS X

From: Kazuhiro NISHIYAMA <zn@...>
Date: 2006-08-08 15:36:10 UTC
List: ruby-core #8560
>>>>> On Tue, 8 Aug 2006 17:56:07 +0900
>>>>> noreply@rubyforge.org(noreply@rubyforge.org)  said:
> 
> Initial Comment:
> It's that simple. Assign to Process.gid= as root and Ruby will send you an EPERM. setgid() from libc does not have this issue.


|    if (setregid(gid, -1) < 0) rb_sys_fail(0);
is used in Mac OS X, and setregid(nonzero, -1) failed.


used line check:
Mac-mini:~/build/ruby18/ruby18 kazu$ sudo ~/opt/ruby18/bin/ruby -ve 'Process.gid=502'
ruby 1.8.5 (2006-08-08) [powerpc-darwin8.7.0]
/Users/kazu/wc/ruby-lang/ruby_1_8/process.c:2494
/Users/kazu/wc/ruby-lang/ruby_1_8/process.c:2500
-e:1:in `gid=': Operation not permitted (Errno::EPERM)
        from -e:1
Mac-mini:~/build/ruby18/ruby18 kazu$


used printf patch:
Index: process.c
===================================================================
RCS file: /src/ruby/process.c,v
retrieving revision 1.92.2.33
diff -u -p -u -p -r1.92.2.33 process.c
--- process.c   25 Jul 2006 04:58:15 -0000      1.92.2.33
+++ process.c   8 Aug 2006 15:29:20 -0000
@@ -2491,14 +2491,19 @@ proc_setgid(obj, id)
 {
     int gid = NUM2INT(id);

+printf("%s:%d\n", __FILE__, __LINE__);
     check_gid_switch();
 #if defined(HAVE_SETRESGID) && !defined(__CHECKER__)
+printf("%s:%d\n", __FILE__, __LINE__);
     if (setresgid(gid, -1, -1) < 0) rb_sys_fail(0);
 #elif defined HAVE_SETREGID
+printf("%s:%d\n", __FILE__, __LINE__);
     if (setregid(gid, -1) < 0) rb_sys_fail(0);
 #elif defined HAVE_SETRGID
+printf("%s:%d\n", __FILE__, __LINE__);
     if (setrgid((GIDTYPE)gid) < 0) rb_sys_fail(0);
 #elif defined HAVE_SETGID
+printf("%s:%d\n", __FILE__, __LINE__);
     {
        if (getegid() == gid) {
            if (setgid(gid) < 0) rb_sys_fail(0);
@@ -2508,8 +2513,10 @@ proc_setgid(obj, id)
        }
     }
 #else
+printf("%s:%d\n", __FILE__, __LINE__);
     rb_notimplement();
 #endif
+printf("%s:%d\n", __FILE__, __LINE__);
     return INT2FIX(gid);
 }



setregid check:

Mac-mini:~ kazu$ cat r.c
#include <stdio.h>
#include <unistd.h>
int main() {
    printf("%d\n", getgid());
    printf("%d\n", setregid(0, -1));
    perror("setregid(0, -1)");
    printf("%d\n", getgid());
    printf("%d\n", setregid(502, -1));
    perror("setregid(502, -1)");
    printf("%d\n", getgid());
    return 0;
}
Mac-mini:~ kazu$ gcc r.c
Mac-mini:~ kazu$ ./a.out
502
-1
setregid(0, -1): Operation not permitted
502
0
setregid(502, -1): Operation not permitted
502
Mac-mini:~ kazu$ sudo ./a.out
0
0
setregid(0, -1): Unknown error: 0
0
-1
setregid(502, -1): Operation not permitted
0
Mac-mini:~ kazu$


-- 
|ZnZ
|Kazuhiro NISHIYAMA

In This Thread