Package: python3.2
Version: 3.2~b1-1
Severity: important
Tags: patch
User: [email protected]
Usertags: hurd
Hi,
after python 3.2~a2-5, a new MAXPATHLEN usage came in, so python3.2 does not
compile[1] on hurd-i386.
Attached there is an updated hurd-path_max.diff which makes python3.2 compile
again.
[1]
https://buildd.debian.org/fetch.cgi?pkg=python3.2;ver=3.2~a4-2;arch=hurd-i386;stamp=1290813366
Thanks,
--
Pino
# DP: Replace PATH_MAX with MAXPATHLEN.
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -680,7 +680,7 @@
}
static wchar_t *default_home = NULL;
-static wchar_t env_home[PATH_MAX+1];
+static wchar_t env_home[MAXPATHLEN+1];
void
Py_SetPythonHome(wchar_t *home)
@@ -695,8 +695,8 @@
if (home == NULL && !Py_IgnoreEnvironmentFlag) {
char* chome = Py_GETENV("PYTHONHOME");
if (chome) {
- size_t r = mbstowcs(env_home, chome, PATH_MAX+1);
- if (r != (size_t)-1 && r <= PATH_MAX)
+ size_t r = mbstowcs(env_home, chome, MAXPATHLEN+1);
+ if (r != (size_t)-1 && r <= MAXPATHLEN)
home = env_home;
}
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -1804,7 +1804,7 @@
#else /* All other filename syntaxes */
if (_HAVE_SCRIPT_ARGUMENT(argc, argv)) {
#if defined(HAVE_REALPATH)
- if (_Py_wrealpath(argv0, fullpath, PATH_MAX)) {
+ if (_Py_wrealpath(argv0, fullpath, MAXPATHLEN)) {
argv0 = fullpath;
}
#endif
--- a/Python/fileutils.c
+++ b/Python/fileutils.c
@@ -1,4 +1,5 @@
#include "Python.h"
+#include "osdefs.h"
#ifdef MS_WINDOWS
# include <windows.h>
#endif
@@ -325,7 +326,7 @@
_Py_wreadlink(const wchar_t *path, wchar_t *buf, size_t bufsiz)
{
char *cpath;
- char cbuf[PATH_MAX];
+ char cbuf[MAXPATHLEN];
wchar_t *wbuf;
int res;
size_t r1;
@@ -335,11 +336,11 @@
errno = EINVAL;
return -1;
}
- res = (int)readlink(cpath, cbuf, PATH_MAX);
+ res = (int)readlink(cpath, cbuf, MAXPATHLEN);
PyMem_Free(cpath);
if (res == -1)
return -1;
- if (res == PATH_MAX) {
+ if (res == MAXPATHLEN) {
errno = EINVAL;
return -1;
}
@@ -370,7 +371,7 @@
wchar_t *resolved_path, size_t resolved_path_size)
{
char *cpath;
- char cresolved_path[PATH_MAX];
+ char cresolved_path[MAXPATHLEN];
wchar_t *wresolved_path;
char *res;
size_t r;
@@ -409,11 +410,11 @@
#ifdef MS_WINDOWS
return _wgetcwd(buf, size);
#else
- char fname[PATH_MAX];
+ char fname[MAXPATHLEN];
wchar_t *wname;
size_t len;
- if (getcwd(fname, PATH_MAX) == NULL)
+ if (getcwd(fname, MAXPATHLEN) == NULL)
return NULL;
wname = _Py_char2wchar(fname, &len);
if (wname == NULL)