This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Crash after run Python interpreter from removed directory
Type: crash Stage: resolved
Components: Versions: Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: vstinner, xtreak, Игорь Никитин
Priority: normal Keywords:

Created on 2018-09-27 15:25 by Игорь Никитин, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
python_bug.png Игорь Никитин, 2018-09-27 15:25 How to repeat
Messages (4)
msg326567 - (view) Author: Игорь Никитин (Игорь Никитин) Date: 2018-09-27 15:25
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.
msg326576 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2018-09-27 17:43
Thanks for the report and steps. Can you try this on Python 3.5 ? I think this is the related issue issue22834 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!
msg326579 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2018-09-27 18:24
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 "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2222, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 2164, in _find_spec
  File "<frozen importlib._bootstrap>", line 1940, in find_spec
  File "<frozen importlib._bootstrap>", line 1911, in _get_spec
  File "<frozen importlib._bootstrap>", 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
msg368891 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-05-15 01:03
I understood that the bug was fixed in Python 3.5.

Python 3.4 and older are no longer supported, I close the issue.
History
Date User Action Args
2022-04-11 14:59:06adminsetgithub: 79002
2020-05-15 01:03:53vstinnersetstatus: open -> closed

nosy: + vstinner
messages: + msg368891

resolution: fixed
stage: resolved
2018-09-27 18:24:22xtreaksetmessages: + msg326579
2018-09-27 17:43:51xtreaksetmessages: + msg326576
2018-09-27 17:33:00xtreaksetnosy: + xtreak
2018-09-27 15:25:48Игорь Никитинcreate