Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle conan.cmake download failures gracefully #36

Closed
wants to merge 1 commit into from

Conversation

fghzxm
Copy link

@fghzxm fghzxm commented Oct 13, 2023

This patch adds code to CMakeLists.txt to detect failure to download conan.cmake and handle it gracefully.

CMake's file(DOWNLOAD ...) command appears to retain an empty or corrupt file even when the download failed, and it does this silently without issuing any sort of errors or warnings. Currently, once the download failed, subsequent configures and reconfigures will all read from this bad conan.cmake until the build directory is wiped (not even deleting the cache helps). To fix this, we detect download failures explicitly, remove the bad file, and report the error to the user.

Also added a SHA256 check to the download command; this is usually redundant with TLS_VERIFY ON, but can be helpful against very bad MITM actors (sometimes seen in corporate environments).

This patch adds code to CMakeLists.txt to detect failure to download
conan.cmake and handle it gracefully.

CMake's `file(DOWNLOAD ...)` command [appears to retain][so] an empty or
corrupt file even when the download failed, and it does this silently
without issuing any sort of errors or warnings. Currently, once the
download failed, subsequent configures and reconfigures will all read
from this bad conan.cmake until the build directory is wiped (not even
deleting the cache helps). To fix this, we detect download failures
explicitly, remove the bad file, and report the error to the user.

Also added a SHA256 check to the download command; this is usually
redundant with `TLS_VERIFY ON`, but can be helpful against very bad MITM
actors (sometimes seen in corporate environments).

[so]: https://stackoverflow.com/q/61255773
@mattgodbolt
Copy link
Member

Sorry we never got to this; seems the underlying CMake setup changed substantially and uses a newer way of accessing conan.

@mattgodbolt mattgodbolt closed this Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants