New submission from Ali Mohammad Pur <ali.mpf...@gmail.com>:
`virtualenv --clear` is extremely eager to delete the passed directory without any sort of confirmation, leading to possible data-loss (e.g. with a mistyped command, or a misunderstanding of what it actually does). Simply deleting an entire directory tree with a command that's extremely prone to misunderstanding should not be virtualenv's job, but as it has decided to make this its job, then it should take proper precautions to avoid unintentional `rm -fr some-directory` by *at least* asking for confirmation. The previous behaviour can of course, stay behind a `--force` flag for uses in CI or similar, but this should *not* be the default behaviour. related: https://github.com/pypa/virtualenv/issues/1890 mentions that "[it is not] good practice to put non-virtual environment-related files into a virtual environment", which is sensible, and so virtualenv should then simply refuse to be instantiated in a non-empty directory. On a more subjetive note, `virtualenv --clear <dir>` sounds like a way to purge the virtual environment files from a directory (yes, I understand what the help says, but that hardly changes anything), so perhaps a more verbose flag like "--clear-contents" would be more appropriate, but I digress. ---------- messages: 410192 nosy: alimpfard priority: normal severity: normal status: open title: 'virtualenv --clear' should prompt user before nuking entire directory type: behavior _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue46326> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com