`run(('rm', '-rf', venv_path))` is worrisome
See original GitHub issuerun(('rm', '-rf', venv_path))
I was considering putting some checks around this line to ensure that we don’t delete something important, like /
, or .
, or ..
.
thoughts?
Issue Analytics
- State:
- Created 9 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Easiest way to rm -rf in Python - Stack Overflow
I was running into instances where API would fail and the directory was not deleted. The most robust approach I've found is: import...
Read more >How to work with VS Code and Virtual Environments in Python
Then In VS Code, open the Command Palette (View > Command Palette or (Ctrl+Shift+P)). Then, select the Python: Select Interpreter command ...
Read more >2018-December.txt - Python mailing list
I came home and tried to run a twitterscraper command in cmd ? without success. ... 1})")) rm -rf / CompletedProcess(args='echo rm -rf...
Read more >How to delete virtual env? #3690 - python-poetry/poetry - GitHub
Run poetry env list (this will show you the venv for that project); Then run poetry env remove whatever-WhATeVs-py3.9 to delete it. Running...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I think a similar scenario would be very easy to imagine. The solution doesn’t need to be complicated either, a simple
assert(path and path not in ('/', '.', '..'))
would be sufficient.In that case, it force-removes an empty-string file, resulting in no change, unless you somehow had a file named empty-string. Actually, it would have to be a directory, since this is guarded by isdir.
isdir('')
is usually false.