From 5719f2f1af9000a4129748ce85656c7964b76c31 Mon Sep 17 00:00:00 2001 From: Joseph Ferguson Date: Mon, 24 Aug 2026 11:23:51 -0700 Subject: [PATCH] Add timeouts to curl and wget --- 12/Dockerfile | 7 +++++-- 13/Dockerfile | 7 +++++-- 14/Dockerfile | 7 +++++-- 15/Dockerfile | 7 +++++-- 16/Dockerfile | 7 +++++-- Dockerfile.template | 7 +++++-- 6 files changed, 30 insertions(+), 12 deletions(-) diff --git a/12/Dockerfile b/12/Dockerfile index 4917100cce7..5c0830b931a 100644 --- a/12/Dockerfile +++ b/12/Dockerfile @@ -62,7 +62,9 @@ RUN set -ex; \ local fetch="$1"; shift; \ local file="$1"; shift; \ for mirror in $GCC_MIRRORS; do \ - if curl -fL "$mirror/$fetch" -o "$file"; then \ + # add connect-timeout: default 60 + # https://curl.se/docs/manpage.html#--connect-timeout + if curl -fL "$mirror/$fetch" --connect-timeout 30 -o "$file"; then \ return 0; \ fi; \ done; \ @@ -92,7 +94,8 @@ RUN set -ex; \ \ # explicitly update autoconf config.guess and config.sub so they support more arches/libcs for f in config.guess config.sub; do \ - wget -O "$f" "https://git.savannah.gnu.org/cgit/config.git/plain/$f?id=7d3d27baf8107b630586c962c057e22149653deb"; \ + # these files are small, so the default 900 second timeout is excessive + wget --timeout 30 -O "$f" "https://git.savannah.gnu.org/cgit/config.git/plain/$f?id=7d3d27baf8107b630586c962c057e22149653deb"; \ # find any more (shallow) copies of the file we grabbed and update them too find -mindepth 2 -name "$f" -exec cp -v "$f" '{}' ';'; \ done; \ diff --git a/13/Dockerfile b/13/Dockerfile index 58d3530c850..8695d8b5b73 100644 --- a/13/Dockerfile +++ b/13/Dockerfile @@ -62,7 +62,9 @@ RUN set -ex; \ local fetch="$1"; shift; \ local file="$1"; shift; \ for mirror in $GCC_MIRRORS; do \ - if curl -fL "$mirror/$fetch" -o "$file"; then \ + # add connect-timeout: default 60 + # https://curl.se/docs/manpage.html#--connect-timeout + if curl -fL "$mirror/$fetch" --connect-timeout 30 -o "$file"; then \ return 0; \ fi; \ done; \ @@ -92,7 +94,8 @@ RUN set -ex; \ \ # explicitly update autoconf config.guess and config.sub so they support more arches/libcs for f in config.guess config.sub; do \ - wget -O "$f" "https://git.savannah.gnu.org/cgit/config.git/plain/$f?id=7d3d27baf8107b630586c962c057e22149653deb"; \ + # these files are small, so the default 900 second timeout is excessive + wget --timeout 30 -O "$f" "https://git.savannah.gnu.org/cgit/config.git/plain/$f?id=7d3d27baf8107b630586c962c057e22149653deb"; \ # find any more (shallow) copies of the file we grabbed and update them too find -mindepth 2 -name "$f" -exec cp -v "$f" '{}' ';'; \ done; \ diff --git a/14/Dockerfile b/14/Dockerfile index cba3b301f00..4d7f8b0b19c 100644 --- a/14/Dockerfile +++ b/14/Dockerfile @@ -62,7 +62,9 @@ RUN set -ex; \ local fetch="$1"; shift; \ local file="$1"; shift; \ for mirror in $GCC_MIRRORS; do \ - if curl -fL "$mirror/$fetch" -o "$file"; then \ + # add connect-timeout: default 60 + # https://curl.se/docs/manpage.html#--connect-timeout + if curl -fL "$mirror/$fetch" --connect-timeout 30 -o "$file"; then \ return 0; \ fi; \ done; \ @@ -92,7 +94,8 @@ RUN set -ex; \ \ # explicitly update autoconf config.guess and config.sub so they support more arches/libcs for f in config.guess config.sub; do \ - wget -O "$f" "https://git.savannah.gnu.org/cgit/config.git/plain/$f?id=7d3d27baf8107b630586c962c057e22149653deb"; \ + # these files are small, so the default 900 second timeout is excessive + wget --timeout 30 -O "$f" "https://git.savannah.gnu.org/cgit/config.git/plain/$f?id=7d3d27baf8107b630586c962c057e22149653deb"; \ # find any more (shallow) copies of the file we grabbed and update them too find -mindepth 2 -name "$f" -exec cp -v "$f" '{}' ';'; \ done; \ diff --git a/15/Dockerfile b/15/Dockerfile index be71ae941d4..73b8a02d56f 100644 --- a/15/Dockerfile +++ b/15/Dockerfile @@ -62,7 +62,9 @@ RUN set -ex; \ local fetch="$1"; shift; \ local file="$1"; shift; \ for mirror in $GCC_MIRRORS; do \ - if curl -fL "$mirror/$fetch" -o "$file"; then \ + # add connect-timeout: default 60 + # https://curl.se/docs/manpage.html#--connect-timeout + if curl -fL "$mirror/$fetch" --connect-timeout 30 -o "$file"; then \ return 0; \ fi; \ done; \ @@ -92,7 +94,8 @@ RUN set -ex; \ \ # explicitly update autoconf config.guess and config.sub so they support more arches/libcs for f in config.guess config.sub; do \ - wget -O "$f" "https://git.savannah.gnu.org/cgit/config.git/plain/$f?id=7d3d27baf8107b630586c962c057e22149653deb"; \ + # these files are small, so the default 900 second timeout is excessive + wget --timeout 30 -O "$f" "https://git.savannah.gnu.org/cgit/config.git/plain/$f?id=7d3d27baf8107b630586c962c057e22149653deb"; \ # find any more (shallow) copies of the file we grabbed and update them too find -mindepth 2 -name "$f" -exec cp -v "$f" '{}' ';'; \ done; \ diff --git a/16/Dockerfile b/16/Dockerfile index 78cd7eb549d..26ce08f3d31 100644 --- a/16/Dockerfile +++ b/16/Dockerfile @@ -62,7 +62,9 @@ RUN set -ex; \ local fetch="$1"; shift; \ local file="$1"; shift; \ for mirror in $GCC_MIRRORS; do \ - if curl -fL "$mirror/$fetch" -o "$file"; then \ + # add connect-timeout: default 60 + # https://curl.se/docs/manpage.html#--connect-timeout + if curl -fL "$mirror/$fetch" --connect-timeout 30 -o "$file"; then \ return 0; \ fi; \ done; \ @@ -92,7 +94,8 @@ RUN set -ex; \ \ # explicitly update autoconf config.guess and config.sub so they support more arches/libcs for f in config.guess config.sub; do \ - wget -O "$f" "https://git.savannah.gnu.org/cgit/config.git/plain/$f?id=7d3d27baf8107b630586c962c057e22149653deb"; \ + # these files are small, so the default 900 second timeout is excessive + wget --timeout 30 -O "$f" "https://git.savannah.gnu.org/cgit/config.git/plain/$f?id=7d3d27baf8107b630586c962c057e22149653deb"; \ # find any more (shallow) copies of the file we grabbed and update them too find -mindepth 2 -name "$f" -exec cp -v "$f" '{}' ';'; \ done; \ diff --git a/Dockerfile.template b/Dockerfile.template index 4b79c35e5a9..c50affe7e0e 100644 --- a/Dockerfile.template +++ b/Dockerfile.template @@ -56,7 +56,9 @@ RUN set -ex; \ local fetch="$1"; shift; \ local file="$1"; shift; \ for mirror in $GCC_MIRRORS; do \ - if curl -fL "$mirror/$fetch" -o "$file"; then \ + # add connect-timeout: default 60 + # https://curl.se/docs/manpage.html#--connect-timeout + if curl -fL "$mirror/$fetch" --connect-timeout 30 -o "$file"; then \ return 0; \ fi; \ done; \ @@ -86,7 +88,8 @@ RUN set -ex; \ \ # explicitly update autoconf config.guess and config.sub so they support more arches/libcs for f in config.guess config.sub; do \ - wget -O "$f" "https://git.savannah.gnu.org/cgit/config.git/plain/$f?id=7d3d27baf8107b630586c962c057e22149653deb"; \ + # these files are small, so the default 900 second timeout is excessive + wget --timeout 30 -O "$f" "https://git.savannah.gnu.org/cgit/config.git/plain/$f?id=7d3d27baf8107b630586c962c057e22149653deb"; \ # find any more (shallow) copies of the file we grabbed and update them too find -mindepth 2 -name "$f" -exec cp -v "$f" '{}' ';'; \ done; \