pkgsrc-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[patch] lang/python2{3,4} platform checking bugs
Hello-
I was browsing through the lang/python24 package on a NetBSD 4.99 system and
was struck by something odd while reading through the patches:
| --- Lib/posixfile.py.orig Wed Aug 18 17:13:40 2004
| +++ Lib/posixfile.py
| @@ -183,10 +183,11 @@ class _posixfile_:
| # additions for AIX by Vladimir.Marangozov%imag.fr@localhost
| import sys, os
| if sys.platform in ('netbsd1',
| + 'netbsd2', 'netbsd3',
| 'openbsd2',
| 'freebsd2', 'freebsd3', 'freebsd4', 'freebsd5',
| 'freebsd6', 'bsdos2', 'bsdos3', 'bsdos4'):
... snip ...
This seems like a particularly fragile method of determining whether
we're on a BSD. It is unnecessary to require human intervention to
update this file for each release (and this is clearly not done).
It seems to me that the correct semantics should be more like:
if sys.platform[:-1] in ('netbsd', 'freebsd', 'openbsd', 'bsdos', etc):
...
Granted this is a patch and these changes should be made in Python's
sources, I think the onus is on pkgsrc to DTRT here. Please see the
attached (meta-)patches. I can confirm that test_fcntl passes on netbsd
4.x with these patches. (It fails with EINVAL[22] otherwise.)
Because 'dragonflybsd' is not currently in listed in either file (and I
don't have a test machine running dragonfly), I did not include in this
patch. It is possible (or likely?) that it, too, should be included in
these patches.
Note that these changes should be also applied to lang/python23/patches,
though lang/python25 does not seem to be effected.
Cheers,
- Oliver
Please Cc: me in any replies; I am not currently subscribed to this
list.
--- patch-ad.orig 2008-06-15 09:20:58.000000000 +0000
+++ patch-ad 2008-06-15 10:36:37.000000000 +0000
@@ -1,31 +1,31 @@
$NetBSD: patch-ad,v 1.2 2006/04/12 20:21:48 drochner Exp $
---- Lib/posixfile.py.orig Wed Aug 18 17:13:40 2004
-+++ Lib/posixfile.py
-@@ -183,10 +183,11 @@ class _posixfile_:
+--- Lib/posixfile.py.orig 2004-08-18 15:13:41.000000000 +0000
++++ Lib/posixfile.py 2008-06-15 10:34:36.000000000 +0000
+@@ -182,11 +182,9 @@
+ # Hack by davem%magnet.com@localhost to get locking to go on freebsd;
# additions for AIX by Vladimir.Marangozov%imag.fr@localhost
import sys, os
- if sys.platform in ('netbsd1',
-+ 'netbsd2', 'netbsd3',
- 'openbsd2',
- 'freebsd2', 'freebsd3', 'freebsd4', 'freebsd5',
- 'freebsd6', 'bsdos2', 'bsdos3', 'bsdos4'):
+- if sys.platform in ('netbsd1',
+- 'openbsd2',
+- 'freebsd2', 'freebsd3', 'freebsd4', 'freebsd5',
+- 'freebsd6', 'bsdos2', 'bsdos3', 'bsdos4'):
- flock = struct.pack('lxxxxlxxxxlhh', \
++ bsdPlatforms = ('netbsd', 'openbsd', 'freebsd', 'bsdos')
++ if sys.platform[:-1] in bsdPlatforms:
+ flock = struct.pack('qqihh', \
l_start, l_len, os.getpid(), l_type, l_whence)
elif sys.platform in ['aix3', 'aix4']:
flock = struct.pack('hhlllii', \
-@@ -199,11 +200,12 @@ class _posixfile_:
+@@ -198,10 +196,7 @@
+ flock = fcntl.fcntl(self._file_.fileno(), cmd, flock)
if '?' in how:
- if sys.platform in ('netbsd1',
-+ 'netbsd2', 'netbsd3',
- 'openbsd2',
- 'freebsd2', 'freebsd3', 'freebsd4',
'freebsd5',
- 'bsdos2', 'bsdos3', 'bsdos4'):
+- if sys.platform in ('netbsd1',
+- 'openbsd2',
+- 'freebsd2', 'freebsd3', 'freebsd4',
'freebsd5',
+- 'bsdos2', 'bsdos3', 'bsdos4'):
++ if sys.platform[:-1] in bsdPlatforms:
l_start, l_len, l_pid, l_type, l_whence = \
-- struct.unpack('lxxxxlxxxxlhh', flock)
-+ struct.unpack('qqihh', flock)
+ struct.unpack('lxxxxlxxxxlhh', flock)
elif sys.platform in ['aix3', 'aix4']:
- l_type, l_whence, l_start, l_len, l_sysid, l_pid, l_vfs = \
- struct.unpack('hhlllii', flock)
--- patch-ae.orig 2008-06-15 09:21:01.000000000 +0000
+++ patch-ae 2008-06-15 09:45:48.000000000 +0000
@@ -1,13 +1,17 @@
$NetBSD: patch-ae,v 1.5 2007/06/08 14:16:16 wiz Exp $
---- Lib/test/test_fcntl.py.orig 2006-10-03 13:08:57.000000000 +0000
-+++ Lib/test/test_fcntl.py
-@@ -20,7 +20,7 @@ else:
+--- Lib/test/test_fcntl.py.orig 2008-06-15 09:42:55.000000000 +0000
++++ Lib/test/test_fcntl.py 2008-06-15 09:43:00.000000000 +0000
+@@ -20,10 +20,8 @@
if sys.platform.startswith('atheos'):
start_len = "qq"
-if sys.platform in ('netbsd1', 'netbsd2', 'Darwin1.2', 'darwin',
-+if sys.platform in ('netbsd1', 'netbsd2', 'netbsd3', 'Darwin1.2', 'darwin',
- 'freebsd2', 'freebsd3', 'freebsd4', 'freebsd5',
'freebsd6',
- 'bsdos2', 'bsdos3', 'bsdos4',
- 'openbsd', 'openbsd2', 'openbsd3', 'openbsd4'):
+- 'freebsd2', 'freebsd3', 'freebsd4', 'freebsd5',
'freebsd6',
+- 'bsdos2', 'bsdos3', 'bsdos4',
+- 'openbsd', 'openbsd2', 'openbsd3', 'openbsd4'):
++if sys.platform[:-1] in ('netbsd', 'freebsd', 'bsdos', 'openbsd') \
++or sys.platform in ('Darwin1.2', 'darwin'):
+ if struct.calcsize('l') == 8:
+ off_t = 'l'
+ pid_t = 'i'
Home |
Main Index |
Thread Index |
Old Index