cmake: replace deprecated remove command with rm and pass arg safely#22193
Closed
vszakats wants to merge 5 commits into
Closed
cmake: replace deprecated remove command with rm and pass arg safely#22193vszakats wants to merge 5 commits into
remove command with rm and pass arg safely#22193vszakats wants to merge 5 commits into
Conversation
remove command with rm and pass arg securelyremove command with rm and pass arg safely
…curely All curl-supported CMake versions support the modern method, along with the `--` marker. Refs: https://cmake.org/cmake/help/latest/manual/cmake.1.html#cmdoption-cmake-E-arg-remove https://cmake.org/cmake/help/v3.18/manual/cmake.1.html#run-a-command-line-tool
``` cmake -E rm test-ca.cacert test-ca.crt test-ca.key test-client-cert.crl test-client-cert.crt test-client-cert.key test-client-cert.pem test-client-cert.pub.der test-client-cert.pub.pem test-client-eku-only.crl test-client-eku-only.crt test-client-eku-only.key test-client-eku-only.pem test-client-eku-only.pub.der test-client-eku-only.pub.pem test-localhost-san-first.crl test-localhost-san-first.crt test-localhost-san-first.key test-localhost-san-first.pem test-localhost-san-first.pub.der test-localhost-san-first.pub.pem test-localhost-san-last.crl test-localhost-san-last.crt test-localhost-san-last.key test-localhost-san-last.pem test-localhost-san-last.pub.der test-localhost-san-last.pub.pem test-localhost.crl test-localhost.crt test-localhost.key test-localhost.nn.crl test-localhost.nn.crt test-localhost.nn.key test-localhost.nn.pem test-localhost.nn.pub.der test-localhost.nn.pub.pem test-localhost.pem test-localhost.pub.der test-localhost.pub.pem test-localhost0h.crl test-localhost0h.crt test-localhost0h.key test-localhost0h.pem test-localhost0h.pub.der test-localhost0h.pub.pem test-*.csr test-*.der test-*.keyenc test-ca.cnt* test-ca.db* test-ca.raw* test-ca.srl CMake Error: File to remove does not exist and force is not set: test-client-cert.pub.der CMake Error: File to remove does not exist and force is not set: test-client-eku-only.pub.der CMake Error: File to remove does not exist and force is not set: test-localhost-san-first.pub.der CMake Error: File to remove does not exist and force is not set: test-localhost-san-last.pub.der CMake Error: File to remove does not exist and force is not set: test-localhost.nn.pub.der CMake Error: File to remove does not exist and force is not set: test-localhost.pub.der CMake Error: File to remove does not exist and force is not set: test-localhost0h.pub.der ```
There was a problem hiding this comment.
Pull request overview
This PR modernizes CMake “clean/uninstall” behaviors by switching from the deprecated cmake -E remove to cmake -E rm, improving argument handling, and adding CI coverage for the clean targets in the Linux GitHub Actions workflow.
Changes:
- Replace
cmake -E removewithcmake -E rm -ffor cert cleanup and uninstall script behavior. - Add
--end-of-options marker for safer argument passing in the uninstall script. - Extend the Linux GHA aws-lc CMake job to exercise
curl_uninstallandclean-certstargets.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/certs/CMakeLists.txt | Switch clean target to cmake -E rm -f for generated cert artifacts. |
| CMake/cmake_uninstall.in.cmake | Update uninstall removal command to cmake -E rm -f -- and adjust messaging/handling. |
| .github/workflows/linux.yml | Add a CMake aws-lc matrix entry that runs uninstall and cert cleanup targets in CI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
vszakats
added a commit
that referenced
this pull request
Jun 27, 2026
- reduce log noise by showing 'Uninstalling' message only if the file exists. (and a different message otherwise) - replace cmake `rm` command with `file(REMOVE)`. For efficiency. Show manual message if the file could not be deleted. Ref: https://cmake.org/cmake/help/v3.18/command/file.html#remove Follow-up to 6d00835 #22193 - reduce log noise by showing 'Uninstalled' only if the deletion was successful. (and a different message otherwise) - display `DESTDIR` env value if set. - drop checking, setting and showing `CMAKE_INSTALL_PREFIX`. The value was never predefined, also not used, besides showing it, and showing it is misleading because `--prefix` may override the configure-time value, and also superfluous because the filenames are showing the actual prefix anyway. Follow-up to 27e2a47 Closes #22201
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.
All curl-supported CMake versions support the modern method, along with
the
--marker.Also:
-fto not fail if the file is missing, as beforethis patch.
OUTPUT_QUIET,ERROR_QUIETand error handlingin
cmake_uninstall.Refs:
https://cmake.org/cmake/help/v4.4/manual/cmake.1.html#cmdoption-cmake-E-arg-remove
https://cmake.org/cmake/help/v3.18/manual/cmake.1.html#run-a-command-line-tool