This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: subprocess test cases fail with noexec-mounted /tmp
Type: Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: astrand Nosy List: astrand, calvin
Priority: normal Keywords:

Created on 2006-03-06 20:48 by calvin, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
python-subprocess-test.diff calvin, 2006-03-16 16:20
Messages (3)
msg27689 - (view) Author: Bastian Kleineidam (calvin) Date: 2006-03-06 20:48
Hi,

on my Linux box two subprocess tests always fail (see
below for a log output).
The reason is those two tests try to execute files
created with tempfile.mkstemp(), which generates files
in /tmp. And my /tmp directory forbids to execute
files, it is mounted with the "noexec" option.

What I expected from the tests is to either find a
temporary directory where execution is allowed (eg. the
directory where sys.executable lies), or simply skip
those tests.


Test output:
[...]
======================================================================
ERROR: test_args_string
(test.test_subprocess.ProcessTestCase)     
----------------------------------------------------------------------
Traceback (most recent call last):                    
            
  File
"/home/calvin/src/python-svn/Lib/test/test_subprocess.py",
line 490, in test_args_string
    p = subprocess.Popen(fname)
  File "/home/calvin/src/python-svn/Lib/subprocess.py",
line 580, in __init__
    errread, errwrite)
  File "/home/calvin/src/python-svn/Lib/subprocess.py",
line 1033, in _execute_child
    raise child_exception
OSError: [Errno 13] Permission denied

======================================================================
ERROR: test_call_string
(test.test_subprocess.ProcessTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File
"/home/calvin/src/python-svn/Lib/test/test_subprocess.py",
line 532, in test_call_string
    rc = subprocess.call(fname)
  File "/home/calvin/src/python-svn/Lib/subprocess.py",
line 431, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/home/calvin/src/python-svn/Lib/subprocess.py",
line 580, in __init__
    errread, errwrite)
  File "/home/calvin/src/python-svn/Lib/subprocess.py",
line 1033, in _execute_child
    raise child_exception
OSError: [Errno 13] Permission denied
msg27690 - (view) Author: Bastian Kleineidam (calvin) Date: 2006-03-16 16:20
Logged In: YES 
user_id=9205

I attached a patch that creates temp files in the directory
of sys.executable. This directory is guaranteed to have
executable permissions, and should also have write
permissions (since sys.executable should have been generated
from a previous make run).

With the patch the test case runs ok.
msg27691 - (view) Author: Peter Åstrand (astrand) * (Python committer) Date: 2006-07-10 20:30
Logged In: YES 
user_id=344921

The directory with sys.executable is certainly not
guaranteed to be writable. For example, when I run the test
suite with the Python shipped with my Linux distribution,
os.path.dirname(sys.executable) is /usr/bin, which I cannot
write to. So, I don't like this patch. 

Having /tmp mounted with "noexec" is just stupid, IMHO.
Which Linux distribution does this?

I do have some experience with working around "noexec"
mounts and my experience is that /tmp is "as good as it
gets". If someone can prove me wrong, then we can think of
patching test_subprocess, but until that, I'm going to close
this bug. 
History
Date User Action Args
2022-04-11 14:56:15adminsetgithub: 42989
2006-03-06 20:48:29calvincreate