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.

Author alimpfard
Recipients alimpfard
Date 2022-01-10.09:01:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1641805306.76.0.639944392664.issue46326@roundup.psfhosted.org>
In-reply-to
Content
`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.
History
Date User Action Args
2022-01-10 09:01:46alimpfardsetrecipients: + alimpfard
2022-01-10 09:01:46alimpfardsetmessageid: <1641805306.76.0.639944392664.issue46326@roundup.psfhosted.org>
2022-01-10 09:01:46alimpfardlinkissue46326 messages
2022-01-10 09:01:46alimpfardcreate