[pacman-dev] [PATCH] libalpm: Log URLs when retrying
Allow finding which mirror was used to fetch a file. This makes it a bit easier to debug situations in which mirrors serve bad files with HTTP 200. Signed-off-by: Vladimir Panteleev <archlinux@cy.md> --- lib/libalpm/dload.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c index 4322318b..022bc7fd 100644 --- a/lib/libalpm/dload.c +++ b/lib/libalpm/dload.c @@ -427,6 +427,9 @@ static int curl_retry_next_server(CURLM *curlm, CURL *curl, struct dload_payload len = strlen(server) + strlen(payload->filepath) + 2; MALLOC(payload->fileurl, len, RET_ERR(handle, ALPM_ERR_MEMORY, -1)); snprintf(payload->fileurl, len, "%s/%s", server, payload->filepath); + _alpm_log(handle, ALPM_LOG_DEBUG, + "%s: retrying from %s\n", + payload->remote_name, payload->fileurl); fflush(payload->localf); -- 2.33.0
On 09/09/2021 09:41, Vladimir Panteleev via pacman-dev wrote:
Allow finding which mirror was used to fetch a file.
This makes it a bit easier to debug situations in which mirrors serve bad files with HTTP 200.
Signed-off-by: Vladimir Panteleev <archlinux@cy.md> --- lib/libalpm/dload.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c index 4322318b..022bc7fd 100644 --- a/lib/libalpm/dload.c +++ b/lib/libalpm/dload.c @@ -427,6 +427,9 @@ static int curl_retry_next_server(CURLM *curlm, CURL *curl, struct dload_payload len = strlen(server) + strlen(payload->filepath) + 2; MALLOC(payload->fileurl, len, RET_ERR(handle, ALPM_ERR_MEMORY, -1)); snprintf(payload->fileurl, len, "%s/%s", server, payload->filepath); + _alpm_log(handle, ALPM_LOG_DEBUG, + "%s: retrying from %s\n", + payload->remote_name, payload->fileurl);
fflush(payload->localf);
Doesn't pacman already do this though? :: Retrieving packages... glibc-2.33-5-x86_64 downloading... debug: glibc-2.33-5-x86_64.pkg.tar.zst: url is http://test.com/glibc-2.33-5-x86_64.pkg.tar.zst debug: glibc-2.33-5-x86_64.pkg.tar.zst: maxsize 10303557 debug: glibc-2.33-5-x86_64.pkg.tar.zst: opened tempfile for download: /var/cache/pacman/pkg/glibc-2.33-5-x86_64.pkg.tar.zst.part (wb) debug: glibc-2.33-5-x86_64.pkg.tar.zst: curl returned result 28 from transfer error: failed retrieving file 'glibc-2.33-5-x86_64.pkg.tar.zst' from test.com : Connection timeout after 10001 ms debug: glibc-2.33-5-x86_64.pkg.tar.zst: tempfile found, attempting continuation from 0 bytes debug: glibc-2.33-5-x86_64.pkg.tar.zst: curl returned result 0 from transfer debug: glibc-2.33-5-x86_64.pkg.tar.zst: response code 200 debug: glibc-2.33-5-x86_64.pkg.tar.zst.sig: url is http://mirror.bytemark.co.uk/archlinux/core/os/x86_64/glibc-2.33-5-x86_64.pk... debug: glibc-2.33-5-x86_64.pkg.tar.zst.sig: maxsize 16384 debug: glibc-2.33-5-x86_64.pkg.tar.zst.sig: opened tempfile for download: /var/cache/pacman/pkg/glibc-2.33-5-x86_64.pkg.tar.zst.sig.part (wb) debug: glibc-2.33-5-x86_64.pkg.tar.zst.sig: curl returned result 0 from transfer debug: glibc-2.33-5-x86_64.pkg.tar.zst.sig: response code 200
participants (2)
-
Morgan Adamiec
-
Vladimir Panteleev