[issue16139] Python 3.3 fails when starting from read-only FS
Richard Oudkerk added the comment: This is more or less a duplicate of #15833 (although the errno mentioned there is EIO instead of the more sensible EROFS). -- nosy: +sbt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16139 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16139] Python 3.3 fails when starting from read-only FS
Charles-François Natali added the comment: This is more or less a duplicate of #15833 Indeed, closing as duplicate. -- resolution: - duplicate stage: - committed/rejected status: open - closed superseder: - most failures to write byte-compiled file no longer suppressed type: crash - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16139 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16139] Python 3.3 fails when starting from read-only FS
New submission from Andrew Gallagher: This occurs when python is installed on a read-only mount AND all the .pyc files are out-of-date. Therefore, when python starts and attempts to write a new .pyc file, _write_atomic in Lib/importlib/_bootstrap.py throws an OSError with an errno of EROFS, which is not handled (and ignored) and kills the interpreter. $ python Fatal Python error: Py_Initialize: Unable to get the locale encoding Traceback (most recent call last): File frozen importlib._bootstrap, line 1558, in _find_and_load File frozen importlib._bootstrap, line 1525, in _find_and_load_unlocked File frozen importlib._bootstrap, line 586, in _check_name_wrapper File frozen importlib._bootstrap, line 1023, in load_module File frozen importlib._bootstrap, line 1004, in load_module File frozen importlib._bootstrap, line 562, in module_for_loader_wrapper File frozen importlib._bootstrap, line 854, in _load_module File frozen importlib._bootstrap, line 990, in get_code File frozen importlib._bootstrap, line 1051, in _cache_bytecode File frozen importlib._bootstrap, line 1074, in set_data File frozen importlib._bootstrap, line 128, in _write_atomic OSError: [Errno 30] Read-only file system: 'read-only-mount-path/lib/python3.3/encodings/__pycache__/__init__.cpython-33.pyc.139872939267056' Aborted (core dumped) The following (hacky) patch fixes the issue for me: --- a/Python-3.3.0/Lib/importlib/_bootstrap.py +++ b/Python-3.3.0/Lib/importlib/_bootstrap.py @@ -1070,6 +1070,10 @@ class SourceFileLoader(FileLoader, SourceLoader): # If can't get proper access, then just forget about writing # the data. return +except OSError as e: +if e.errno != 30: # ignore EROFS +raise +return try: _write_atomic(path, data, _mode) _verbose_message('created {!r}', path) @@ -1077,6 +1081,9 @@ class SourceFileLoader(FileLoader, SourceLoader): # Don't worry if you can't write bytecode or someone is writing # it at the same time. pass +except OSError as e: +if e.errno != 30: # ignore EROFS +raise -- components: Library (Lib) messages: 172029 nosy: andrewjcg priority: normal severity: normal status: open title: Python 3.3 fails when starting from read-only FS type: behavior versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16139 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16139] Python 3.3 fails when starting from read-only FS
Changes by R. David Murray rdmur...@bitdance.com: -- nosy: +brett.cannon type: behavior - crash versions: +Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16139 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16139] Python 3.3 fails when starting from read-only FS
STINNER Victor added the comment: Python 3.2 logs an error to stderr (if Python is started in verbose mode) if the directory and/or the pyc file cannot be created, and continue. #ifdef MS_WINDOWS if (_mkdir(cpathname) 0 errno != EEXIST) { #else if (mkdir(cpathname, dirmode) 0 errno != EEXIST) { #endif *dirpath = saved; if (Py_VerboseFlag) PySys_WriteStderr( # cannot create cache dir %s\n, cpathname); return; } *dirpath = saved; fp = open_exclusive(cpathname, mode); if (fp == NULL) { if (Py_VerboseFlag) PySys_WriteStderr( # can't create %s\n, cpathname); return; } -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16139 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16139] Python 3.3 fails when starting from read-only FS
Antoine Pitrou added the comment: Hmm... I guess maybe we should trap all OSErrors after all (and print the error when in verbose mode). -- nosy: +neologix, pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16139 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16139] Python 3.3 fails when starting from read-only FS
Charles-François Natali added the comment: Hmm... I guess maybe we should trap all OSErrors after all (and print the error when in verbose mode). Yes. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16139 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com