proto: add curl fallback and validate downloaded status.proto#622
proto: add curl fallback and validate downloaded status.proto#622Devansh-567 wants to merge 1 commit into
Conversation
Signed-off-by: Devansh-567 <devansh.jay.singh@gmail.com>
|
Could you explain why curl over wget is more robust? |
|
What motivated this PR, did you experience real failures or is this just trying to incorporate best practices? |
Thanks for the question! To clarify, the change isn't about curl being inherently more robust than wget, both are reliable tools. The intent is: curl is preferred first because it's already the more commonly available tool in minimal CI/container images (and is used elsewhere in this repo's scripts), so preferring it keeps behavior consistent across the codebase. wget is kept as a fallback so the script still works on systems where only wget is installed. If neither tool is present, the script now fails fast with a clear error instead of silently proceeding or failing with a confusing message later on. So this is less "curl > wget" and more "support both, prefer the one used elsewhere in the repo, and fail clearly if neither exists." |
@chrispsommers, this wasn't prompted by a specific failure I hit personally. It's a defensive/best-practices improvement: The original script assumed curl was always present, which isn't guaranteed on all dev/CI environments. It also overwrote status.proto directly during download, so a partial/failed download (e.g., network hiccup, HTTP error page instead of the proto) could silently corrupt the checked-in file. This PR downloads to a temp file first and does a basic sanity check (that it looks like a valid .proto file) before replacing the real file, so a bad download fails loudly instead of quietly breaking the repo. I don't have a specific incident to point to, but this pattern (fallback + validate-before-replace) is already used elsewhere in the repo, so this brings update_google_rpc_status.sh in line with that convention. Happy to add more detail to the PR description if that's helpful for review. 😊 |
Summary
Improve
proto/update_google_rpc_status.shby making the download process more robust.Changes
curlwhen available and fall back towgetstatus.proto.protobefore overwriting the existing fileThis helps prevent invalid downloads from replacing
status.protoand aligns the script with the download fallback pattern used elsewhere in the repository.