vstinner/python-ptrace

ptrace not works on linux 3.x kernels.

Closed this issue · 2 comments

Originally reported by: Felipe Prenholato (Bitbucket: chronossc, GitHub: chronossc)


I have a install of pythonbrew with Python 2.6.8 (without SSLv2 support) for running old applications.

This install runs Django 1.2.1.

When trying to run Django 1.2.1 server or shell, I ends with a error "UNKNOW OS!".

I checked and that happens because ptrace.os_tools don't recognize linux3 platform as Linux.

To make it work I changed code in following way:

#!diff
--- os_tools.py_original        2012-08-04 01:29:03.985275595 -0300
+++ os_tools.py 2012-08-04 01:28:55.305275224 -0300
@@ -17,7 +17,7 @@
 RUNNING_PYTHON3 = version_info[0] == 3
 RUNNING_PYPY = ("pypy" in version.lower())
 RUNNING_WINDOWS = (platform == 'win32')
-RUNNING_LINUX = (platform == 'linux2')
+RUNNING_LINUX = (platform in ('linux2', 'linux3'))
 RUNNING_FREEBSD = (platform.startswith('freebsd')
                    or platform.startswith('gnukfreebsd'))
 RUNNING_OPENBSD = platform.startswith('openbsd')

Original comment by Victor Stinner (Bitbucket: haypo, GitHub: haypo):


Thanks for the report, sorry for the delay!

Original comment by Victor Stinner (Bitbucket: haypo, GitHub: haypo):


This issue should be fixed by:

changeset: 155:be1da663b2ee
tag: tip
user: Victor Stinner victor.stinner@gmail.com
date: Sun Jun 23 03:57:30 2013 +0200
files: ptrace/os_tools.py
description:
Fix issue #5: fix os_tools.RUNNING_LINUX, support sys.platform == 'linux3'

Fix for Python 2.6.8 running on Linux kernel 3.x