New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exiting Python REPL prompt with user without home directory throws error in atexit._run_exitfuncs #64090
Comments
$ sudo adduser --no-create-home cutecat
Adding user `cutecat' ...
Adding new group `cutecat' (1007) ...
Adding new user `cutecat' (1005) with group `cutecat' ...
Not creating home directory `/home/cutecat'.
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for cutecat
Enter the new value, or press ENTER for the default
Full Name []:
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [Y/n] Y
$ su cutecat
Password: $ ./python
Python 3.4.0b1 (default:1f1498fe50e5, Dec 5 2013, 09:48:25)
[GCC 4.7.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
Error in atexit._run_exitfuncs:
FileNotFoundError: [Errno 2] No such file or directory
$ Python 2.7 and 3.3 do not throw error. $ ./python
Python 3.3.3+ (3.3:07425df887b5+, Dec 2 2013, 12:27:06)
[GCC 4.7.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
[60778 refs]
[41580 refs]
$
$ ./python
Python 2.7.6+ (2.7:181ced5bf0be, Dec 4 2013, 11:23:42)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
$ |
This is presumably due to the new default enabling of readline, where it is trying to save the history file when it exits. |
For the record, why did you close as invalid? |
Not sure who you meant by 'you', but just in case you meant me, Vajrasky was the one who closed it. |
I closed it because I could not reproduce it anymore. I think, it worked again after $ ./python -S I will open it again if I can consistently reproduce this bug. |
Okay, this bug is valid. I can reproduce it in Ubuntu and Fedora. bash-4.2$ ./python
Python 3.4.0b1 (default:7a668179d691, Dec 6 2013, 21:44:31)
[GCC 4.7.2 20121109 (Red Hat 4.7.2-8)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
Error in atexit._run_exitfuncs:
FileNotFoundError: [Errno 2] No such file or directory
bash-4.2$ ./python -S
Python 3.4.0b1 (default:7a668179d691, Dec 6 2013, 21:44:31)
[GCC 4.7.2 20121109 (Red Hat 4.7.2-8)] on linux
>>>
bash-4.2$ |
Additional information: When I created /home/cutecat with another user account. bash-4.2$ ./python
Python 3.4.0b1 (default:7a668179d691, Dec 6 2013, 21:44:31)
[GCC 4.7.2 20121109 (Red Hat 4.7.2-8)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
Error in atexit._run_exitfuncs:
PermissionError: [Errno 13] Permission denied Of course, so I change the ownership of /home/cutecat to cutecat. Then it works. bash-4.2$ ./python
Python 3.4.0b1 (default:7a668179d691, Dec 6 2013, 21:44:31)
[GCC 4.7.2 20121109 (Red Hat 4.7.2-8)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
bash-4.2$ So what did it try to do in /home/cutecat? [sky@localhost cpython]$ ls -la /home/cutecat/ So I leave to core Python developers to decide whether this ticket is valid or not. |
The main question here is whether "interactive user without a home directory" is a valid / common use case. I think silencing the FileNotFoundError would be ok. (however, the "home directory with wrong permissions" case sounds crazy) |
I'm getting the same PermissionError 13: Error in atexit._run_exitfuncs: My case is: I'm running Python 3.4.0 as a non-root user in a docker.io container built on ubuntu 14.04. This user was created during the creation (Dockerfile) of the container. The user has a home directory and that directory appears to have the usual/proper permissions. When I exit the python3 REPL I get this error even if all I did was start python3 from the command line and then immediately exit. So maybe the cause is other, or more subtle, than just a user with no home dir or home dir with unusual perms? |
I can easily reproduce the problem with Docker, $ docker run -ti --rm --user="7777:7777" python:3.6.3-jessie bash -c "python3"
Python 3.6.3 (default, Oct 10 2017, 02:29:16)
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
Error in atexit._run_exitfuncs:
PermissionError: [Errno 13] Permission denied
$ docker run -ti --rm --user="7777:7777" python:3.6.3-jessie bash -c "HOME=/tmp python3; ls -lta /tmp"
Python 3.6.3 (default, Oct 10 2017, 02:29:16)
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
total 8
drwxrwxrwt 2 root root 4096 Oct 28 14:10 .
drwxr-xr-x 55 root root 4096 Oct 28 14:10 ..
-rw------- 1 7777 7777 0 Oct 28 14:10 .python_history |
I was able to reproduce both the $ docker run --user 123:123 -ti python python
Python 3.7.0 (default, Jul 17 2018, 11:04:33)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
Error in atexit._run_exitfuncs:
PermissionError: [Errno 13] Permission denied
$ docker run --user nobody -ti python python
Python 3.7.0 (default, Jul 17 2018, 11:04:33)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
Error in atexit._run_exitfuncs:
FileNotFoundError: [Errno 2] No such file or directory In the former, the home directory is My patch addresses both of these errors. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: