1 --- Python-2.4.1/pyconfig.h.in.canonicalize 2004-10-13 11:30:55.000000000 -0400
2 +++ Python-2.4.1/pyconfig.h.in 2005-10-06 14:04:06.000000000 -0400
4 /* Define if pthread_sigmask() does not work on your system. */
5 #undef HAVE_BROKEN_PTHREAD_SIGMASK
7 +/* Define to 1 if you have the `canonicalize_file_name' function. */
8 +#undef HAVE_CANONICALIZE_FILE_NAME
10 /* Define to 1 if you have the `chown' function. */
13 --- Python-2.4.1/Python/sysmodule.c.canonicalize 2005-01-27 13:58:30.000000000 -0500
14 +++ Python-2.4.1/Python/sysmodule.c 2005-10-06 14:56:37.000000000 -0400
15 @@ -1168,11 +1168,13 @@
17 PySys_SetArgv(int argc, char **argv)
19 +#ifndef HAVE_CANONICALIZE_FILE_NAME
20 #if defined(HAVE_REALPATH)
21 char fullpath[MAXPATHLEN];
22 #elif defined(MS_WINDOWS)
23 char fullpath[MAX_PATH];
26 PyObject *av = makeargvobject(argc, argv);
27 PyObject *path = PySys_GetObject("path");
29 @@ -1184,6 +1186,64 @@
33 +#ifdef HAVE_CANONICALIZE_FILE_NAME
34 + char *link = NULL, *argv0copy = NULL;
36 + if (argc > 0 && argv0 != NULL) {
38 + link = canonicalize_file_name(argv0);
40 + link = strdup(argv0);
42 + Py_FatalError("no mem for sys.argv");
46 + if (link[0] == SEP) /* Link to absolute path */
48 + else if (strchr(link, SEP) == NULL) {
49 + /* Link without path */
50 + /* strdup argv0 so we can free it
52 + argv0 = strdup(argv0);
54 + Py_FatalError("no mem for sys.argv");
57 + /* Must join(dirname(argv0), link) */
58 + char *q = strrchr(argv0, SEP);
59 + if (q == NULL) /* argv0 without path */
62 + /* Must make a copy */
64 + strlen(link) + strlen(q) +1,
67 + Py_FatalError("no mem for sys.argv");
68 + strcpy(argv0copy, argv0);
69 + q = strrchr(argv0copy, SEP);
70 + strcpy(argv0copy+1, link);
77 + if (argc > 0 && argv0 != NULL) {
79 + p = strrchr(argv0, SEP);
80 + /* Test for alternate separator */
81 + q = strrchr(p ? p : argv0, '/');
86 + if (n > 1 && p[-1] != ':')
87 + n--; /* Drop trailing separator */
90 +#else /* ! HAVE_CANONICALIZE_FILE_NAME */
92 char link[MAXPATHLEN+1];
93 char argv0copy[2*MAXPATHLEN+1];
94 @@ -1256,9 +1316,14 @@
97 #endif /* All others */
98 +#endif /* ! HAVE_CANONICALIZE_FILE_NAME */
99 a = PyString_FromStringAndSize(argv0, n);
101 Py_FatalError("no mem for sys.path insertion");
102 +#ifdef HAVE_CANONICALIZE_FILE_NAME
103 + if (argc > 0 && argv0 != NULL)
105 +#endif /* HAVE_CANONICALIZE_FILE_NAME */
106 if (PyList_Insert(path, 0, a) < 0)
107 Py_FatalError("sys.path.insert(0) failed");
109 --- Python-2.4.1/configure.in.canonicalize 2005-03-28 18:23:34.000000000 -0500
110 +++ Python-2.4.1/configure.in 2005-10-06 14:04:06.000000000 -0400
111 @@ -2096,8 +2096,8 @@
112 AC_MSG_RESULT(MACHDEP_OBJS)
114 # checks for library functions
115 -AC_CHECK_FUNCS(alarm bind_textdomain_codeset chown clock confstr ctermid \
116 - execv fork fpathconf ftime ftruncate \
117 +AC_CHECK_FUNCS(alarm bind_textdomain_codeset canonicalize_file_name chown \
118 + clock confstr ctermid execv fork fpathconf ftime ftruncate \
119 gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
120 getpriority getpwent getsid getwd \
121 kill killpg lchown lstat mkfifo mknod mktime \