Repository navigation
Conversation
Stage the tested Commands.hs replacement on the fix branch before moving it into its final path. Co-authored-by: generaltony007 <144252170+GeneralTony007@users.noreply.github.com>
Remove the original path before moving the staged tested replacement into place. Co-authored-by: generaltony007 <144252170+GeneralTony007@users.noreply.github.com>
Move the tested replacement into the Commands.hs path. Nonrecursive rm can delete files in system directories and unlink system-directory symlinks. Keep the existing path and guarded-variable handling. Add regression coverage for literal, glob, brace and unguarded-variable cases, with guarded-variable and ordinary-path controls. Co-authored-by: generaltony007 <144252170+GeneralTony007@users.noreply.github.com>
Author
|
Could a maintainer review this warning for nonrecursive rm on important system paths? Please let me know if this warning is in scope or if the path selection or cases need changing before review. Thanks. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3600.
checkCatastrophicRmonly inspectedrmarguments when a recursive flag was present. That misses bothrm /bin/*, which deletes the directory's files without recursion, andrm /bin, which can unlink the symlink on a merged-/usr system.Remove the recursive-flag gate while keeping the existing important-path list, brace expansion, path normalization and guarded-variable handling. Add nine regression properties covering literal paths, globs, brace expansion and an unguarded variable, plus guarded-variable and ordinary-path controls.
Validation on Linux with GHC 9.6.3:
stack test --fastandcabal v1-testsuites pass; the executable builds.git diff --checkis clean. No destructivermcommands were executed.This deliberately warns on important literal paths even on hosts where they are real directories and nonrecursive
rmwould fail, since those same paths can be symlinks on other hosts. Path normalization is unchanged; #3614 addresses that separate behavior.