-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Improve submodule error messages for Github archives #9571
Improve submodule error messages for Github archives #9571
Conversation
7b6ef73
to
91f7ce6
Compare
CMakeLists.txt
Outdated
@@ -301,7 +301,11 @@ if(LIB_INSTALL_DIR) | |||
endif() | |||
|
|||
if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/framework/CMakeLists.txt") | |||
message(FATAL_ERROR "${CMAKE_CURRENT_SOURCE_DIR}/framework/CMakeLists.txt not found. Run `git submodule update --init` from the source tree to fetch the submodule contents.") | |||
if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git/") | |||
message(FATAL_ERROR "${CMAKE_CURRENT_SOURCE_DIR}/.git/ not found. Please ensure you have downloaded a release version of MBedTLS from Github.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
message(FATAL_ERROR "${CMAKE_CURRENT_SOURCE_DIR}/.git/ not found. Please ensure you have downloaded a release version of MBedTLS from Github.") | |
message(FATAL_ERROR "${CMAKE_CURRENT_SOURCE_DIR}/.git/ not found. Please ensure you have downloaded a release version of Mbed TLS from GitHub.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I have fixed this now.
Makefile
Outdated
ifeq (,$(wildcard .git)) | ||
define error_message | ||
$(MBEDTLS_PATH)/.git/ not found. | ||
Please ensure you have downloaded a release version of MbedTLS from Github. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In most of our docs we have Mbed TLS (with a space), might be good to keep it consistent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I have fixed this now.
ef0d38b
to
9dbc616
Compare
9dbc616
to
4544666
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
This commit improves the error messages informing users that have downloaded Github archives to instead download a release archive. This is due to Github not supporting submodules within archives and no trivial way for users to use git to download them. Signed-off-by: Harry Ramsey <[email protected]>
4544666
to
e05cf2e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
CMakeLists.txt
Outdated
@@ -323,7 +323,11 @@ if(LIB_INSTALL_DIR) | |||
endif() | |||
|
|||
if (NOT EXISTS "${MBEDTLS_FRAMEWORK_DIR}/CMakeLists.txt") | |||
message(FATAL_ERROR "${MBEDTLS_FRAMEWORK_DIR}/CMakeLists.txt not found. Run `git submodule update --init` from the source tree to fetch the submodule contents.") | |||
if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git/") | |||
message(FATAL_ERROR "${CMAKE_CURRENT_SOURCE_DIR}/.git/ not found. Please ensure you have downloaded a release version of Mbed TLS from GitHub.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about the ".git not found" part of this error message, from a user's perspective: if I go and download a release tarball, it won't contain a .git
subdirectory either, so there seems to be a mismatch between reported problem and suggested solution.
Suggestion: start this message with ""${MBEDTLS_FRAMEWORK_DIR}/CMakeLists.txt not found (and this does not appear to be a git checkout)." - and add "(and this appears to be a git checkout)" to the other one.
Not sure about the 2nd sentence either: most likely this will happen because people have downloaded an archive from github, except they've picked the wrong one. So I think the message should be more precise, like "Please ensure you have downloaded the right archive from the release page on github."
@@ -11,6 +11,19 @@ $(MBEDTLS_PATH)/framework/exported.make not found. | |||
Run `git submodule update --init` to fetch the submodule contents. | |||
This is a fatal error | |||
endef | |||
ifeq (,$(wildcard .git)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the definition above (lines 9-13) is redundant with the one on lines 21-25. I'd keep only the second one.
It appears @mpg has some suggested changes
This commit further improves error message clarity. Signed-off-by: Harry Ramsey <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I think it might be a good time to start on the backport
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for addressing my feedback!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed something earlier - only notice while looking at the 3.6 backport.
Makefile
Outdated
Run `git submodule update --init` to fetch the submodule contents. | ||
ifeq (,$(wildcard .git)) | ||
define error_message | ||
${MBEDTLS_FRAMEWORK_DIR}/CMakeLists.txt not found (and does appear to be a git checkout). Run `git submodule update --init` from the source tree to fetch the submodule contents. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I failed to noticed earlier: this should be framework/exported.make
in order to match what we actually tested above.
This commit improves the makefile error message when using make, it no longer incorrectly reports that CMakeLists.txt cannot be found instead of exported.make. Signed-off-by: Harry Ramsey <[email protected]>
51b75a5
to
66ce986
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not there yet. I think we should manually test the error messages to make sure they work. I'm not sure what the consequence of trying to use ${MBEDTLS_FRAMEWORK_DIR}
would be, but we don't want to find out from user reporting about confusing errors ;)
Makefile
Outdated
Run `git submodule update --init` to fetch the submodule contents. | ||
ifeq (,$(wildcard .git)) | ||
define error_message | ||
${MBEDTLS_FRAMEWORK_DIR}/exported.make not found (and does appear to be a git checkout). Run `git submodule update --init` from the source tree to fetch the submodule contents. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
${MBEDTLS_FRAMEWORK_DIR}
is a cmake variable, not a make variable. The old message used $(MBEDTLS_PATH)/framework/exported.make
which looks right to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hopefully all resolved now, thanks
This commit replaces an undefined variable ${MBEDTLS_FRAMEWORK_DIR} for ${MBEDTLS_PATH}. Signed-off-by: Harry Ramsey <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
@Harry-Ramsey A few minor points on PR management:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
define error_message | ||
$(MBEDTLS_PATH)/framework/exported.make not found. | ||
Run `git submodule update --init` to fetch the submodule contents. | ||
ifeq (,$(wildcard .git)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is something wrong with the error message selection? #9809 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After testing and some initial digging, this seems to be an issue with Make wildcard checks. It appears that they are not useful for checking if a directory exists and instead a different approach will be needed. I shall investigate a bit further in the morning about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That test looks right for checking whether .git
exists in the current directory. But isn't the condition inverted? $(wildcard .git)
is empty when .git
is missing. Also, do we want .git
or $(MBEDTLS_PATH)/.git
at this point?
This commit improves the error messages informing users that have downloaded Github archives to instead download a release archive. This is due to Github not supporting submodules within archives and no trivial way for users to use git to download them.
Issue: #9538.
PR checklist
Please remove the segment/s on either side of the | symbol as appropriate, and add any relevant link/s to the end of the line.
If the provided content is part of the present PR remove the # symbol.
Notes for the submitter
Please refer to the contributing guidelines, especially the
checklist for PR contributors.
Help make review efficient: