Forum: Ruby-core [Backport93 - Backport #7746][Open] Backport NSGetEnviron()/setproctitle.c fix for macosx

Posted by "docwhat (Christian Höltje)" <docwhat@gmail.com> (Guest)
on 2013-01-28 00:11
(Received via mailing list)
Issue #7746 has been reported by docwhat (Christian Höltje).

----------------------------------------
Backport #7746: Backport NSGetEnviron()/setproctitle.c fix for macosx
https://bugs.ruby-lang.org/issues/7746

Author: docwhat (Christian Höltje)
Status: Open
Priority: Normal
Assignee: kosaki (Motohiro KOSAKI)
Category:
Target version:


The fix for issue #6576 should be back ported to 1.9.3 as well.  Without 
it you cannot build shared ruby libraries that work reliably.  An 
example of this breakage is compiling something that uses the embedded 
library like vim; it crashes the instance vim tries to use ruby.

Here's the patch needed:

diff --git a/missing/setproctitle.c b/missing/setproctitle.c
index 169ba8b..4dc6d03 100644
--- a/missing/setproctitle.c
+++ b/missing/setproctitle.c
@@ -48,6 +48,12 @@
 #endif
 #include <string.h>

+#if defined(__APPLE__)
+#include <crt_externs.h>
+#undef environ
+#define environ (*_NSGetEnviron())
+#endif
+
 #define SPT_NONE  0  /* don't use it at all */
 #define SPT_PSTAT  1  /* use pstat(PSTAT_SETCMD, ...) */
 #define SPT_REUSEARGV  2  /* cover argv with title information */
Posted by kosaki (Motohiro KOSAKI) (Guest)
on 2013-01-28 09:13
(Received via mailing list)
Issue #7746 has been updated by kosaki (Motohiro KOSAKI).


Confused. Mac OS X has native setproctile(). I think 
missing/setproctitle.c shouldn't be used.
----------------------------------------
Backport #7746: Backport NSGetEnviron()/setproctitle.c fix for macosx
https://bugs.ruby-lang.org/issues/7746#change-35685

Author: docwhat (Christian Höltje)
Status: Open
Priority: Normal
Assignee: kosaki (Motohiro KOSAKI)
Category:
Target version:


The fix for issue #6576 should be back ported to 1.9.3 as well.  Without 
it you cannot build shared ruby libraries that work reliably.  An 
example of this breakage is compiling something that uses the embedded 
library like vim; it crashes the instance vim tries to use ruby.

Here's the patch needed:

diff --git a/missing/setproctitle.c b/missing/setproctitle.c
index 169ba8b..4dc6d03 100644
--- a/missing/setproctitle.c
+++ b/missing/setproctitle.c
@@ -48,6 +48,12 @@
 #endif
 #include <string.h>

+#if defined(__APPLE__)
+#include <crt_externs.h>
+#undef environ
+#define environ (*_NSGetEnviron())
+#endif
+
 #define SPT_NONE  0  /* don't use it at all */
 #define SPT_PSTAT  1  /* use pstat(PSTAT_SETCMD, ...) */
 #define SPT_REUSEARGV  2  /* cover argv with title information */
Posted by jacknagel (Jack Nagel) (Guest)
on 2013-02-02 02:17
(Received via mailing list)
Issue #7746 has been updated by jacknagel (Jack Nagel).


kosaki (Motohiro KOSAKI) wrote:
> Confused. Mac OS X has native setproctile(). I think missing/setproctitle.c 
shouldn't be used.

At least 10.6 does not have setproctitle().
----------------------------------------
Backport #7746: Backport NSGetEnviron()/setproctitle.c fix for macosx
https://bugs.ruby-lang.org/issues/7746#change-35770

Author: docwhat (Christian Höltje)
Status: Open
Priority: Normal
Assignee: kosaki (Motohiro KOSAKI)
Category:
Target version:


The fix for issue #6576 should be back ported to 1.9.3 as well.  Without 
it you cannot build shared ruby libraries that work reliably.  An 
example of this breakage is compiling something that uses the embedded 
library like vim; it crashes the instance vim tries to use ruby.

Here's the patch needed:

diff --git a/missing/setproctitle.c b/missing/setproctitle.c
index 169ba8b..4dc6d03 100644
--- a/missing/setproctitle.c
+++ b/missing/setproctitle.c
@@ -48,6 +48,12 @@
 #endif
 #include <string.h>

+#if defined(__APPLE__)
+#include <crt_externs.h>
+#undef environ
+#define environ (*_NSGetEnviron())
+#endif
+
 #define SPT_NONE  0  /* don't use it at all */
 #define SPT_PSTAT  1  /* use pstat(PSTAT_SETCMD, ...) */
 #define SPT_REUSEARGV  2  /* cover argv with title information */
Posted by kosaki (Motohiro KOSAKI) (Guest)
on 2013-02-02 03:32
(Received via mailing list)
Issue #7746 has been updated by kosaki (Motohiro KOSAKI).

Status changed from Open to Assigned
Assignee changed from kosaki (Motohiro KOSAKI) to usa (Usaku NAKAMURA)

OK, ack then.
Usa-san, I think r36151 can be apply cleanly.

----------------------------------------
Backport #7746: Backport NSGetEnviron()/setproctitle.c fix for macosx
https://bugs.ruby-lang.org/issues/7746#change-35771

Author: docwhat (Christian Höltje)
Status: Assigned
Priority: Normal
Assignee: usa (Usaku NAKAMURA)
Category:
Target version:


The fix for issue #6576 should be back ported to 1.9.3 as well.  Without 
it you cannot build shared ruby libraries that work reliably.  An 
example of this breakage is compiling something that uses the embedded 
library like vim; it crashes the instance vim tries to use ruby.

Here's the patch needed:

diff --git a/missing/setproctitle.c b/missing/setproctitle.c
index 169ba8b..4dc6d03 100644
--- a/missing/setproctitle.c
+++ b/missing/setproctitle.c
@@ -48,6 +48,12 @@
 #endif
 #include <string.h>

+#if defined(__APPLE__)
+#include <crt_externs.h>
+#undef environ
+#define environ (*_NSGetEnviron())
+#endif
+
 #define SPT_NONE  0  /* don't use it at all */
 #define SPT_PSTAT  1  /* use pstat(PSTAT_SETCMD, ...) */
 #define SPT_REUSEARGV  2  /* cover argv with title information */
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.