classification
Title: test_site fails when the user does not have a home directory
Type: behavior Stage: needs patch
Components: Tests Versions: Python 3.6, Python 3.5, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: christian.heimes Nosy List: christian.heimes, doko, koobs, pitrou, python-dev, terry.reedy, tshepang, vstinner
Priority: normal Keywords:

Created on 2013-04-16 13:51 by doko, last changed 2016-03-15 09:14 by vstinner. This issue is now closed.

Messages (9)
msg187078 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2013-04-16 13:51
seen when running the testsuite as user nobody, with
test_site fails when the user's home directory does not exist, and is not creatable (e.g. /nonexistent).

FAILED (failures=3)
test test_pydoc failed
Re-running test 'test_site' in verbose mode
test test_site crashed -- Traceback (most recent call last):
  File "/usr/lib/python3.3/test/regrtest.py", line 1213, in runtest_inner
    the_package = __import__(abstest, globals(), locals(), [])
  File "/usr/lib/python3.3/test/test_site.py", line 29, in <module>
    os.makedirs(site.USER_SITE)
  File "/usr/lib/python3.3/os.py", line 258, in makedirs
    makedirs(head, mode, exist_ok)
  File "/usr/lib/python3.3/os.py", line 258, in makedirs
    makedirs(head, mode, exist_ok)
  File "/usr/lib/python3.3/os.py", line 258, in makedirs
    makedirs(head, mode, exist_ok)
  File "/usr/lib/python3.3/os.py", line 258, in makedirs
    makedirs(head, mode, exist_ok)
  File "/usr/lib/python3.3/os.py", line 269, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/nonexistent'
msg187149 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-04-17 09:15
As a sidenote, I find it a bit scary that test_site even *tries* to create USER_SITE. The test suite shouldn't touch anything outside of test-specific temp files.
msg187150 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2013-04-17 09:56
Don't be scared ... :)

I'll think about a solution.
msg251027 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2015-09-18 21:05
Unfixed for 2 years.  How about skipping the test if
    os.makedirs(site.USER_SITE)
fails?
msg261768 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-03-14 16:48
New changeset 0a583e60c406 by Victor Stinner in branch '3.5':
Skip test_site if USER_SITE cannot be created
https://hg.python.org/cpython/rev/0a583e60c406
msg261770 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-03-14 16:50
New changeset 1a40ee2bad6a by Victor Stinner in branch '2.7':
Skip test_site if USER_SITE cannot be created
https://hg.python.org/cpython/rev/1a40ee2bad6a
msg261771 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-03-14 16:51
"Unfixed for 2 years.  How about skipping the test if os.makedirs(site.USER_SITE) fails?"

Let's do that ;-)

@Christian: Feel free to open a new issue if you have a solution to not write outside temporary directories in test_site ;-)

@doko: Thanks for the bug report! Sorry for the delay :-/ I recall this issue because I just saw it on some FreeBSD buildbots.
msg261802 - (view) Author: Kubilay Kocak (koobs) (Python triager) Date: 2016-03-15 08:29
@Victor, it would be nice if this test could instead use/fake/mock what it needs in the build directory, or is this not possible because it needs an 'actual' user/group context to work?
msg261803 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-03-15 09:14
Everything is possible. It's just a matter of priorities. Do you want to
work on a patch. I'm not really interested. If you consider that it'd
worth, open a new issue.

I close this issue since the iniyal bug is closed.
History
Date User Action Args
2016-03-15 09:14:14vstinnersetmessages: + msg261803
2016-03-15 08:29:50koobssetnosy: + koobs
messages: + msg261802
2016-03-14 16:51:25vstinnersetstatus: open -> closed
versions: + Python 3.5, Python 3.6, - Python 3.3, Python 3.4
nosy: + vstinner

messages: + msg261771

resolution: fixed
2016-03-14 16:50:12python-devsetmessages: + msg261770
2016-03-14 16:48:45python-devsetnosy: + python-dev
messages: + msg261768
2015-09-18 21:05:41terry.reedysetnosy: + terry.reedy
messages: + msg251027
2013-04-19 18:31:10tshepangsetnosy: + tshepang
2013-04-17 09:56:31christian.heimessetassignee: christian.heimes
messages: + msg187150
2013-04-17 09:15:03pitrousetversions: + Python 2.7
nosy: + christian.heimes, pitrou

messages: + msg187149

type: enhancement -> behavior
2013-04-16 13:52:22dokolinkissue17750 dependencies
2013-04-16 13:51:19dokocreate