Issue 34821: Crash after run Python interpreter from removed directory (original) (raw)

How to repeat: see screen.

For example, command "lsb_release" is also not found removed directory, but there is no crash.

Python2, in this case, run without problem.

Thanks for the report and steps. Can you try this on Python 3.5 ? I think this is the related issue that was not fixed in Python 3.4 and has the same line numbers. I can't reproduce this on my Ubuntu machine with Python 3.6.5 from Anaconda though in the path

Steps to reproduce as below :

karthi@ubuntu-s-1vcpu-1gb-blr1-01:~$ ls /tmp/foo ls: cannot access '/tmp/foo': No such file or directory

Create the directory

karthi@ubuntu-s-1vcpu-1gb-blr1-01:$ mkdir /tmp/foo karthi@ubuntu-s-1vcpu-1gb-blr1-01:$ cd /tmp/foo

Load a REPL

karthi@ubuntu-s-1vcpu-1gb-blr1-01:/tmp/foo$ python3 Python 3.6.5 |Anaconda, Inc.| (default, Apr 29 2018, 16:14:56) [GCC 7.2.0] on linux Type "help", "copyright", "credits" or "license" for more information.

Delete the directory

karthi@ubuntu-s-1vcpu-1gb-blr1-01:/tmp/foo$ rm -rf /tmp/foo/ karthi@ubuntu-s-1vcpu-1gb-blr1-01:/tmp/foo$ rm -rf /tmp/foo

Load the REPL

karthi@ubuntu-s-1vcpu-1gb-blr1-01:/tmp/foo$ python3 Python 3.6.5 |Anaconda, Inc.| (default, Apr 29 2018, 16:14:56) [GCC 7.2.0] on linux Type "help", "copyright", "credits" or "license" for more information.

karthi@ubuntu-s-1vcpu-1gb-blr1-01:/tmp/foo$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 16.04.5 LTS Release: 16.04 Codename: xenial karthi@ubuntu-s-1vcpu-1gb-blr1-01:/tmp/foo$ uname -a Linux ubuntu-s-1vcpu-1gb-blr1-01 4.4.0-127-generic #153-Ubuntu SMP Sat May 19 10:58:46 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Python 2

karthi@ubuntu-s-1vcpu-1gb-blr1-01:/tmp/foo$ python2 Python 2.7.12 (default, Dec 4 2017, 14:50:18) [GCC 5.4.0 20160609] on linux2 Type "help", "copyright", "credits" or "license" for more information.

Hope it helps! Unfortunately I don't have Python 3.4 on my machine to give this a try. If you are not able to reproduce this with Python 3.5 then I propose closing this as duplicate linking to the other issue. Thanks again for the report!

Just installed Python 3.4 and can confirm this is fixed in 3.5 but exists on Python 3.4.9 though I don't receive any segfaults though as in the picture with 3.4.

karthi@ubuntu-s-1vcpu-1gb-blr1-01:$ mkdir /tmp/foo karthi@ubuntu-s-1vcpu-1gb-blr1-01:$ cd /tmp/foo karthi@ubuntu-s-1vcpu-1gb-blr1-01:/tmp/foo$ rm -rf /tmp/foo karthi@ubuntu-s-1vcpu-1gb-blr1-01:/tmp/foo$ python3.4 Python 3.4.9 (default, Aug 3 2018, 23:38:40) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. Failed calling sys.interactivehook Traceback (most recent call last): File "/usr/lib/python3.4/site.py", line 419, in register_readline import readline File "", line 2237, in _find_and_load File "", line 2222, in _find_and_load_unlocked File "", line 2164, in _find_spec File "", line 1940, in find_spec File "", line 1911, in _get_spec File "", line 1879, in _path_importer_cache FileNotFoundError: [Errno 2] No such file or directory

karthi@ubuntu-s-1vcpu-1gb-blr1-01:/tmp/foo$ python3.5 Python 3.5.2 (default, Nov 23 2017, 16:37:01) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information.

Python 3.4.9 is the latest release and Python 3.4.10 will be released in March 2019 according to https://www.python.org/dev/peps/pep-0429/#release-schedule . Looking at the patch for this issue and since 3.4 is in security fixes mode I think this fix has a less probability of getting backported which I think is an explicit decision as I can see from the issue.

Thanks