#7 Building on MacOsX - patch to process.c

closed-accepted
None
5
2004-01-06
2003-12-27
Paul Ross
No

I had another stab at solving the problem with undefined
_environ in process.c and the following patch seems to
work.

I found a thread that suggested the solution at:

http://mail.python.org/pipermail/pythonmac-sig/2003-
October/009188.html

So decided to patch:

Ft/Server/Server/src/process.c

In the style of:

Python-2.3.2/Modules/posixmodule.c

The basic change is to use _NSGetEnviron() to set the
environ variable. The patch is below.

Once patched 4Suite built and installed OK. I ran all the
tests and they look OK. There were a number of failures
but none that looked wildly significant and I understand
that several of these tests fail on Linux anyway.

The setup I am using is 10.3 with one patch and basic
installation of the Panther developers CD, i.e.:
OS: MacOsX 10.3.1
Python: Python 2.3 (#1, Sep 13 2003, 00:49:11)
gcc: [GCC 3.3 20030304 (Apple Computer, Inc. build
1495)] on darwin
4Suite: Version 1.0a3 (Alpha)

Best wishes to all in the new year.

Paul.

Patch:
[Paul-Rosss-Computer:~/Desktop/4Suite] paul% diff -up
../../Applications/installers/4Suite/4Suite/Ft/Server/
Server/src/process.c Ft/Server/Server/src/process.c
--- ../../Applications/installers/4Suite/4Suite/Ft/Server/
Server/src/process.c Thu Mar 27 21:48:58 2003
+++ Ft/Server/Server/src/process.c Sat Dec 27 11:37:
10 2003
@@ -1,6 +1,13 @@
#include <Python.h>

-#if !defined(_MSC_VER) && ( !defined(__WATCOMC__) ||
defined(__QNX__) )
+/* Return a dictionary corresponding to the POSIX
environment table */
+#ifdef WITH_NEXT_FRAMEWORK
+/* On Darwin/MacOSX a shared library or framework has
no access to
+** environ directly, we must obtain it with
_NSGetEnviron().
+*/
+#include <crt_externs.h>
+static char **environ;
+#elif !defined(_MSC_VER) && ( !defined(__WATCOMC__)
|| defined(__QNX__) )
extern char **environ;
#endif /* !_MSC_VER */

@@ -247,6 +254,10 @@ static PyObject
*create_process(PyProces
if (pid == 0)
{
PyOS_AfterFork();
+#ifdef WITH_NEXT_FRAMEWORK
+ if (environ == NULL)
+ environ = *_NSGetEnviron();
+#endif
execve(ps->ps_path, argv, env ? env : environ);

/* if we get here it is definitely an error */

Discussion

  • Jeremy Kloth

    Jeremy Kloth - 2004-01-06
    • assigned_to: nobody --> jkloth
    • status: open --> closed-accepted
     
  • Jeremy Kloth

    Jeremy Kloth - 2004-01-06

    Logged In: YES
    user_id=38980

    Fixed in CVS as of 2004-01-05.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks