Bug 1852941

Summary: python3 prints traceback when exiting on read-only file system
Product: [Fedora] Fedora Reporter: Zbigniew Jędrzejewski-Szmek <zbyszek>
Component: python3.9Assignee: Miro Hrončok <mhroncok>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: cstratak, davide, mhroncok, python-sig, torsava, vstinner
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-07-02 09:58:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Zbigniew Jędrzejewski-Szmek 2020-07-01 16:07:22 UTC
Description of problem:
$ 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. It should handle EROFS the same.

Version-Release number of selected component (if applicable):
python3-3.9.0~b3-1.fc33.x86_64

Comment 1 Miro Hrončok 2020-07-01 16:47:42 UTC
Do I assume correctly that this is not a regression of 3.9?

Would you please report this upstream?

See also https://bugs.python.org/issue15833

Comment 2 Zbigniew Jędrzejewski-Szmek 2020-07-02 09:15:03 UTC
https://bugs.python.org/issue41193

Comment 3 Victor Stinner 2020-07-02 09:58:13 UTC
> https://bugs.python.org/issue41193

I proposed a fix upstream: https://github.com/python/cpython/pull/21279 If it's merged, it will be part of the next Python 3.9 release.

I don't think that we need to backport it earlier in Fedora. We can wait until the Fedora package will be rebased to the newer Python 3.9 version. So I close the issue as UPSTREAM.

Thanks for your bug report Zbigniew Jędrzejewski-Szmek!

In the meanwhile, you can safely ignore the error. You may be able to workaround the issue by overriding the HOME directory by setting HOME environment variable: use a temporary directory which can be modified.