path: Force-remove files in unlink() - #130
Conversation
Path.unlink() removes a file with a plain `rm`. If the file is write-protected (e.g. -r--r--r--) but the containing directory still permits deletion, GNU rm asks an interactive confirmation question before removing it. Since tbot's channel has no way to answer that question, exec0() never sees a shell prompt again and hangs indefinitely instead of raising an error. unlink() already resolves existence/missing_ok itself before running rm, so nothing is lost by making the actual removal non-interactive as well, via -f. Fixes: Rahix#128 Signed-off-by: Martin Jocic <martin.jocic@kvaser.com>
|
Hi, thanks for the contribution! I just confirmed, Python The I just checked, busybox |
What were those about? I cannot reproduce them here and CI also seems happy... Can you open a new issue for this topic, please? |
Fixes #128.
Path.unlink()removes a file with a plainrm:If the file is write-protected (e.g.
-r--r--r--) but the containingdirectory still permits deletion, GNU
rmasks an interactiveconfirmation question before removing it:
Since tbot's channel has no way to answer that question,
exec0()never sees a shell prompt again and hangs indefinitely instead of
raising an error.
unlink()already resolves existence/missing_okitself beforerunning
rm, so nothing is lost by making the actual removalnon-interactive as well, via
-f.Testing
pre-commit's pinnedblack,flake8, andmypyall pass on thechanged file.
selftest/tests/test_path.pyhas the same pass/fail counts beforeand after this change (two pre-existing, unrelated failures in
test_rglob_errorreproduce identically on unmodifiedmaster).chmod 400file hangs(confirmed via timeout) on unmodified
master, and completes cleanlyon this branch.