~ubuntu-branches/ubuntu/natty/python3.1/natty-security

« back to all changes in this revision

Viewing changes to debian/patches/hurd-path_max.dpatch

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2010-03-21 17:27:57 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20100321172757-v29qykjsa8u718lo
Tags: 3.1.2-0ubuntu1
* Python 3.1.2 release.
* Fix issue #4961: Inconsistent/wrong result of askyesno function in
  tkMessageBox with Tcl8.5. LP: #462950.
* Don't complain when /usr/local is not writable on installation.
* Apply proposed patch for issue #8032, gdb7 hooks for debugging.
* Backport issue #8140: Extend compileall to compile single files.
  Add -i option.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh -e
 
2
 
 
3
# DP: Replace PATH_MAX with MAXPATHLEN.
 
4
 
 
5
dir=
 
6
if [ $# -eq 3 -a "$2" = '-d' ]; then
 
7
    pdir="-d $3"
 
8
    dir="$3/"
 
9
elif [ $# -ne 1 ]; then
 
10
    echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
 
11
    exit 1
 
12
fi
 
13
case "$1" in
 
14
    -patch)
 
15
        patch $pdir -f --no-backup-if-mismatch -p0 < $0
 
16
        ;;
 
17
    -unpatch)
 
18
        patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
 
19
        ;;
 
20
    *)
 
21
        echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
 
22
        exit 1
 
23
esac
 
24
exit 0
 
25
 
 
26
--- Python/pythonrun.c.orig
 
27
+++ Python/pythonrun.c
 
28
@@ -663,7 +663,7 @@
 
29
 }
 
30
 
 
31
 static wchar_t *default_home = NULL;
 
32
-static wchar_t env_home[PATH_MAX+1];
 
33
+static wchar_t env_home[MAXPATHLEN+1];
 
34
 
 
35
 void
 
36
 Py_SetPythonHome(wchar_t *home)
 
37
@@ -678,8 +678,8 @@
 
38
        if (home == NULL && !Py_IgnoreEnvironmentFlag) {
 
39
                char* chome = Py_GETENV("PYTHONHOME");
 
40
                if (chome) {
 
41
-                       size_t r = mbstowcs(env_home, chome, PATH_MAX+1);
 
42
-                       if (r != (size_t)-1 && r <= PATH_MAX)
 
43
+                       size_t r = mbstowcs(env_home, chome, MAXPATHLEN+1);
 
44
+                       if (r != (size_t)-1 && r <= MAXPATHLEN)
 
45
                                home = env_home;
 
46
                }
 
47
 
 
48
--- Python/sysmodule.c.orig
 
49
+++ Python/sysmodule.c
 
50
@@ -1539,20 +1539,20 @@
 
51
 static wchar_t*
 
52
 _wrealpath(const wchar_t *path, wchar_t *resolved_path)
 
53
 {
 
54
-       char cpath[PATH_MAX];
 
55
-       char cresolved_path[PATH_MAX];
 
56
+       char cpath[MAXPATHLEN];
 
57
+       char cresolved_path[MAXPATHLEN];
 
58
        char *res;
 
59
        size_t r;
 
60
-       r = wcstombs(cpath, path, PATH_MAX);
 
61
-       if (r == (size_t)-1 || r >= PATH_MAX) {
 
62
+       r = wcstombs(cpath, path, MAXPATHLEN);
 
63
+       if (r == (size_t)-1 || r >= MAXPATHLEN) {
 
64
                errno = EINVAL;
 
65
                return NULL;
 
66
        }
 
67
        res = realpath(cpath, cresolved_path);
 
68
        if (res == NULL)
 
69
                return NULL;
 
70
-       r = mbstowcs(resolved_path, cresolved_path, PATH_MAX);
 
71
-       if (r == (size_t)-1 || r >= PATH_MAX) {
 
72
+       r = mbstowcs(resolved_path, cresolved_path, MAXPATHLEN);
 
73
+       if (r == (size_t)-1 || r >= MAXPATHLEN) {
 
74
                errno = EINVAL;
 
75
                return NULL;
 
76
        }
 
77
--- Modules/getpath.c.orig
 
78
+++ Modules/getpath.c
 
79
@@ -139,7 +139,7 @@
 
80
 static int
 
81
 _wstat(const wchar_t* path, struct stat *buf)
 
82
 {
 
83
-    char fname[PATH_MAX];
 
84
+    char fname[MAXPATHLEN];
 
85
     size_t res = wcstombs(fname, path, sizeof(fname));
 
86
     if (res == (size_t)-1) {
 
87
        errno = EINVAL;
 
88
@@ -153,8 +153,8 @@
 
89
 static wchar_t*
 
90
 _wgetcwd(wchar_t *buf, size_t size)
 
91
 {
 
92
-    char fname[PATH_MAX];
 
93
-    if (getcwd(fname, PATH_MAX) == NULL)
 
94
+    char fname[MAXPATHLEN];
 
95
+    if (getcwd(fname, MAXPATHLEN) == NULL)
 
96
        return NULL;
 
97
     if (mbstowcs(buf, fname, size) >= size) {
 
98
        errno = ERANGE;
 
99
@@ -168,18 +168,18 @@
 
100
 int 
 
101
 _Py_wreadlink(const wchar_t *path, wchar_t *buf, size_t bufsiz)
 
102
 {
 
103
-    char cbuf[PATH_MAX];
 
104
-    char cpath[PATH_MAX];
 
105
+    char cbuf[MAXPATHLEN];
 
106
+    char cpath[MAXPATHLEN];
 
107
     int res;
 
108
-    size_t r1 = wcstombs(cpath, path, PATH_MAX);
 
109
-    if (r1 == (size_t)-1 || r1 >= PATH_MAX) {
 
110
+    size_t r1 = wcstombs(cpath, path, MAXPATHLEN);
 
111
+    if (r1 == (size_t)-1 || r1 >= MAXPATHLEN) {
 
112
        errno = EINVAL;
 
113
        return -1;
 
114
     }
 
115
-    res = (int)readlink(cpath, cbuf, PATH_MAX);
 
116
+    res = (int)readlink(cpath, cbuf, MAXPATHLEN);
 
117
     if (res == -1)
 
118
        return -1;
 
119
-    if (res == PATH_MAX) {
 
120
+    if (res == MAXPATHLEN) {
 
121
        errno = EINVAL;
 
122
        return -1;
 
123
     }
 
124
--- Modules/main.c.orig
 
125
+++ Modules/main.c
 
126
@@ -104,11 +104,11 @@
 
127
 static FILE*
 
128
 _wfopen(const wchar_t *path, const wchar_t *mode)
 
129
 {
 
130
-       char cpath[PATH_MAX];
 
131
+       char cpath[MAXPATHLEN];
 
132
        char cmode[10];
 
133
        size_t r;
 
134
-       r = wcstombs(cpath, path, PATH_MAX);
 
135
-       if (r == (size_t)-1 || r >= PATH_MAX) {
 
136
+       r = wcstombs(cpath, path, MAXPATHLEN);
 
137
+       if (r == (size_t)-1 || r >= MAXPATHLEN) {
 
138
                errno = EINVAL;
 
139
                return NULL;
 
140
        }
 
141
@@ -547,9 +547,9 @@
 
142
 
 
143
                if (sts==-1 && filename!=NULL) {
 
144
                        if ((fp = _wfopen(filename, L"r")) == NULL) {
 
145
-                               char cfilename[PATH_MAX];
 
146
-                               size_t r = wcstombs(cfilename, filename, PATH_MAX);
 
147
-                               if (r == PATH_MAX)
 
148
+                               char cfilename[MAXPATHLEN];
 
149
+                               size_t r = wcstombs(cfilename, filename, MAXPATHLEN);
 
150
+                               if (r == MAXPATHLEN)
 
151
                                        /* cfilename is not null-terminated;
 
152
                                         * forcefully null-terminating it
 
153
                                         * might break the shift state */