Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Sanity-check :clean-targets #1458

Closed
cemerick opened this Issue · 7 comments

4 participants

@cemerick
Collaborator

Right now, you can put anything in :clean-targets, including clearly absurd things like "..", "/", and so on.

I'd like to suggest that we do some minimal sanity-checking before deleting anything. As a (hopefully) uncontroversial straw-man, perhaps :clean-targets should be limited to:

  • paths within the current project root
  • paths that aren't within known source roots

FWIW, context.

Discuss?

@technomancy
Owner
@cpmcdaniel

I'll take a stab at this. Should it complain loudly, or ignore the invalid targets?

@technomancy
Owner

Thanks! It should definitely just abort.

@cpmcdaniel

About ready to submit a pull. Some tests are failing in the repl namespace, but I don't think this is my doing:

lein test :only leiningen.test.repl/test-connect-string

FAIL in (test-connect-string) (repl.clj:82)
expected: (re-find #"Port is required" (lthelper/abort-msg connect-string {} []))
actual: (not (re-find #"Port is required" ""))

lein test :only leiningen.test.repl/test-connect-string

FAIL in (test-connect-string) (repl.clj:82)
expected: (is (re-find #"Port is required" (lthelper/abort-msg connect-string {} [])))
actual: nil

I'll spend a little bit of time confirming this (checking out an old rev and making sure the same tests fail) before I submit the pull.

@cpmcdaniel cpmcdaniel referenced this issue from a commit in cpmcdaniel/leiningen
@cpmcdaniel cpmcdaniel Fix for #1458: clean-targets sanity checks. b19b803
@cpmcdaniel

I've confirmed that the two test failures are from before I touched the code. Sending the pull request...

@cpmcdaniel cpmcdaniel referenced this issue from a commit in cpmcdaniel/leiningen
@cpmcdaniel cpmcdaniel Making new methods private for issue #1458 d4bedc9
@cpmcdaniel cpmcdaniel referenced this issue from a commit in cpmcdaniel/leiningen
@cpmcdaniel cpmcdaniel Support for overriding :clean-targets sanity checking (issue #1458).
Also made unit tests safer and faster using with-redefs to mock out
calls to delete-file-recursively.
Better error messages when a path is being protected.
a5cf442
@cpmcdaniel

Can this be closed now?

@hyPiRion
Collaborator

Right, this should be closed, as #1461 is merged in.

@hyPiRion hyPiRion closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.