Ruby Forum Ruby-core > Problem with setreuid under Mac OS X

Posted by Vincent Isambart (Guest)
on 27.08.2006 15:38
(Received via mailing list)
Hello,

I think there is a little problem in the modification for setregid of
the 16th August: shouldn't the redefined setregid in process.c be
static? Because as it is, I have a warning during the linking:
/usr/bin/ld: warning multiple definitions of symbol _setreuid
libruby-1.9-static.a(process.o) definition of _setreuid in section
(__TEXT,__text)
/usr/lib/gcc/powerpc-apple-darwin8/4.0.1/../../../libpthread.dylib(setreuid.So)

As it is not used in any other source file, I could be static...

Regards,
Vincent ISAMBART
Posted by unknown (Guest)
on 27.08.2006 16:26
(Received via mailing list)
Hi,

At Sun, 27 Aug 2006 22:36:34 +0900,
Vincent Isambart wrote in [ruby-core:08727]:
> I think there is a little problem in the modification for setregid of
> the 16th August: shouldn't the redefined setregid in process.c be
> static? Because as it is, I have a warning during the linking:
> /usr/bin/ld: warning multiple definitions of symbol _setreuid
> libruby-1.9-static.a(process.o) definition of _setreuid in section
> (__TEXT,__text)
> /usr/lib/gcc/powerpc-apple-darwin8/4.0.1/../../../libpthread.dylib(setreuid.So)

setreuid() in the system library is broken.

> As it is not used in any other source file, I could be static...

So it is intended to replace the wrong one.
Posted by Vincent Isambart (Guest)
on 28.08.2006 09:50
(Received via mailing list)
Hi,

> > I think there is a little problem in the modification for setregid of
> > the 16th August: shouldn't the redefined setregid in process.c be
> > static? Because as it is, I have a warning during the linking:
> > /usr/bin/ld: warning multiple definitions of symbol _setreuid
> > libruby-1.9-static.a(process.o) definition of _setreuid in section
> > (__TEXT,__text)
> > /usr/lib/gcc/powerpc-apple-darwin8/4.0.1/../../../libpthread.dylib(setreuid.So)
>
> setreuid() in the system library is broken.
Yes, I understand that but even if ruby defines a better one, it
should not use the same name (maybe something like ruby_setreuid) to
not have any problem at linking time.
This kind of multiple definition warning is not a good thing, and if
the linker was more strict it would even be an error instead of a
warning.

> > As it is not used in any other source file, I could be static...
>
> So it is intended to replace the wrong one.
I do not see the problem in using an other name (and why not a static 
function).
You mean you want to replace the system one even for ruby C extensions?
In that case, you could put a "#define setreuid ruby_setreuid" in
ruby.h. I know it's not very clean, but it would still do what you
want and there would be no linking problem...

And I talk about setreuid but it's the same for setregid.

Regards,
Vincent ISAMBART