-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
shims: add curl-config shim to fix curl-config http2 report issue for ventura builds #18773
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,35 @@ | ||||||||||||
#!/bin/bash -p | ||||||||||||
|
||||||||||||
# HOMEBREW_LIBRARY is set by bin/brew | ||||||||||||
# HOMEBREW_CURL_CONFIG is set by brew.sh | ||||||||||||
# shellcheck disable=SC2154 | ||||||||||||
source "${HOMEBREW_LIBRARY}/Homebrew/shims/utils.sh" | ||||||||||||
|
||||||||||||
# Check if HOMEBREW_CURL_CONFIG is set, fallback to system curl-config if not. | ||||||||||||
curl_config_exec="${HOMEBREW_CURL_CONFIG:-/usr/bin/curl-config}" | ||||||||||||
|
||||||||||||
# Intercept --features and append HTTP2 if needed | ||||||||||||
if [[ "$1" == "--features" ]] | ||||||||||||
then | ||||||||||||
output="$("${curl_config_exec}" "$@")" | ||||||||||||
|
||||||||||||
# Check if HTTP2 is missing but supported | ||||||||||||
if [[ ! "${output}" =~ HTTP2 ]] | ||||||||||||
then | ||||||||||||
curl_version="$("${HOMEBREW_CURL:-curl}" -V)" | ||||||||||||
if [[ "${curl_version}" =~ HTTP/2 ]] | ||||||||||||
then | ||||||||||||
output="${output} HTTP2" | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you explain why we'd want to claim HTTP2 support is present when There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
even though curl does support http2 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gotcha, thanks. I'd be tempted to just use Homebrew's There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah, that should also work. |
||||||||||||
fi | ||||||||||||
fi | ||||||||||||
Comment on lines
+16
to
+24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It might be easier and cheaper to just add an Also makes it more obvious we can remove it if we drop < macOS 14 support in the far future and means none of the hacks will run in macOS 14 and later which is safer in case there's edge cases we've missed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. make sense 👍 |
||||||||||||
|
||||||||||||
echo "${output}" | ||||||||||||
exit 0 | ||||||||||||
fi | ||||||||||||
|
||||||||||||
# Fall back to executing the original curl-config | ||||||||||||
try_exec_non_system "${curl_config_exec}" "$@" | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move this before the code above - it should not apply to non-system curl-config as only system curl-config is bugged. The bug wasn't because of |
||||||||||||
safe_exec "/usr/bin/curl-config" "$@" | ||||||||||||
|
||||||||||||
echo "Could not execute curl-config. Try HOMEBREW_FORCE_BREWED_CURL_CONFIG=1" >&2 | ||||||||||||
exit 1 | ||||||||||||
Comment on lines
+32
to
+35
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
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 don't think we need to introduce
HOMEBREW_CURL_CONFIG
.if you move the
try_exec_non_system
high enough you can hardcode/usr/bin/curl-config
(or/usr/bin/${SHIM_FILE}
) elsewhere.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.
Agreed.