classification
Title: traceback when exiting on read-only file system
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.10, Python 3.9, Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: asottile, miss-islington, vstinner, zbysz
Priority: normal Keywords: patch

Created on 2020-07-02 09:13 by zbysz, last changed 2020-07-02 12:13 by vstinner. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 21279 merged vstinner, 2020-07-02 09:55
PR 21280 merged miss-islington, 2020-07-02 10:43
PR 21281 merged miss-islington, 2020-07-02 10:43
Messages (7)
msg372832 - (view) Author: Zbyszek Jędrzejewski-Szmek (zbysz) * Date: 2020-07-02 09:13
[Originally reported as https://bugzilla.redhat.com/show_bug.cgi?id=1852941.]

$ touch ~/foo
touch: cannot touch '/home/fedora/foo': Read-only file system
$ python
Python 3.9.0b3 (default, Jun 10 2020, 00:00:00) 
[GCC 10.1.1 20200507 (Red Hat 10.1.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> ^D
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/usr/lib64/python3.9/site.py", line 462, in write_history
    readline.write_history_file(history)
OSError: [Errno 30] Read-only file system

Looking at /usr/lib64/python3.9/site.py, it already silently skips
PermissionError. If a user is running with the file system in ro mode,
they almost certainly are aware of the fact, since this is done either
on purpose or as a result of disk corruption, and the traceback from
python is not useful. Suppression of PermissionError was added in b2499669ef2e6dc9a2cdb49b4dc498e078167e26.

Version-Release number of selected component (if applicable):
python3-3.9.0~b3-1.fc33.x86_64
msg372840 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-07-02 10:43
New changeset 0ab917e07ed64c6bfde6f6e791f9b28acc97b510 by Victor Stinner in branch 'master':
bpo-41193: Ignore OSError in readline write_history() (GH-21279)
https://github.com/python/cpython/commit/0ab917e07ed64c6bfde6f6e791f9b28acc97b510
msg372845 - (view) Author: miss-islington (miss-islington) Date: 2020-07-02 11:02
New changeset 53d2b715d10e5c81cb9c86fd25e88ace4e41bc25 by Miss Islington (bot) in branch '3.8':
bpo-41193: Ignore OSError in readline write_history() (GH-21279)
https://github.com/python/cpython/commit/53d2b715d10e5c81cb9c86fd25e88ace4e41bc25
msg372846 - (view) Author: miss-islington (miss-islington) Date: 2020-07-02 11:02
New changeset 0b4c87ef8f88a4c4c325e964fa4919cef3997605 by Miss Islington (bot) in branch '3.9':
bpo-41193: Ignore OSError in readline write_history() (GH-21279)
https://github.com/python/cpython/commit/0b4c87ef8f88a4c4c325e964fa4919cef3997605
msg372847 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-07-02 11:07
Thanks Zbyszek for your bug report. It's now fixed in 3.8, 3.9 and master branches.
msg372848 - (view) Author: Zbyszek Jędrzejewski-Szmek (zbysz) * Date: 2020-07-02 11:57
Wow, that was quick. Thanks!
msg372849 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-07-02 12:13
Well, two errors were already ignored (bpo-19891). I just made the "except" more generic. I don't think that we can do anything more useless than ignoring the error if the filesystem is read-only. I don't think that a warning would be useful.
History
Date User Action Args
2020-07-02 12:13:19vstinnersetmessages: + msg372849
2020-07-02 11:57:43zbyszsetmessages: + msg372848
2020-07-02 11:07:04vstinnersetstatus: open -> closed
messages: + msg372847

components: + Library (Lib)
resolution: fixed
stage: patch review -> resolved
2020-07-02 11:02:30miss-islingtonsetmessages: + msg372846
2020-07-02 11:02:30miss-islingtonsetmessages: + msg372845
2020-07-02 10:43:47miss-islingtonsetpull_requests: + pull_request20430
2020-07-02 10:43:40miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request20429
2020-07-02 10:43:32vstinnersetmessages: + msg372840
2020-07-02 09:55:01vstinnersetkeywords: + patch
nosy: + vstinner

pull_requests: + pull_request20428
stage: patch review
2020-07-02 09:14:20zbyszsetnosy: + asottile
2020-07-02 09:13:51zbyszcreate