From 8ad01d743feb2b607b751d76014bdbb101539acc Mon Sep 17 00:00:00 2001 From: Esteban82 Date: Mon, 5 Oct 2026 08:48:53 -0300 Subject: [PATCH 1/3] Fix gmt get -Dcache looking for the hash table in the wrong directory Since 6.5.0 (#7812, #7879) gmt_hash_server.txt is stored in /, but gmt get still read /server/gmt_hash_server.txt. So -Dcache and -Dall failed with "Unable to access or read ..." (the error reported in #8895), or silently used a stale copy left in server/ by an older GMT. Co-Authored-By: Claude Sonnet 5.5 --- src/gmtget.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gmtget.c b/src/gmtget.c index 4a4fb196563..5cfbe9ac81d 100644 --- a/src/gmtget.c +++ b/src/gmtget.c @@ -308,7 +308,7 @@ EXTERN_MSC int GMT_gmtget (void *V_API, int mode, void *args) { Return (GMT_RUNTIME_ERROR); } /* Read gmt_hash_server.txt, loop over lines, call gmt_download */ - snprintf (hashpath, PATH_MAX, "%s/server/%s", GMT->session.USERDIR, GMT_HASH_SERVER_FILE); + snprintf (hashpath, PATH_MAX, "%s/%s", GMT->session.USERDIR, GMT_HASH_SERVER_FILE); if ((fp = fopen (hashpath, "r")) == NULL) { GMT_Report (API, GMT_MSG_ERROR, "Unable to access or read %s\n", hashpath); Return (GMT_RUNTIME_ERROR); From 5ce95a66472bc1c2fa4974def97cfee60ea0705c Mon Sep 17 00:00:00 2001 From: Esteban82 Date: Mon, 5 Oct 2026 08:48:53 -0300 Subject: [PATCH 2/3] gmtget: Do not download the cache when -Q is given -Q means list but do not download (gmtget.rst), yet the -Dcache and -Dall cache part ignored it. That went unnoticed because the cache part usually failed before downloading anything; with the hash table found it would fetch every cache file (about 118 MB). Co-Authored-By: Claude Sonnet 5.5 --- src/gmtget.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gmtget.c b/src/gmtget.c index 5cfbe9ac81d..63598fb59ac 100644 --- a/src/gmtget.c +++ b/src/gmtget.c @@ -300,7 +300,7 @@ EXTERN_MSC int GMT_gmtget (void *V_API, int mode, void *args) { } } } - if (!strncmp (Ctrl->D.dir, "all", 3U) || !strncmp (Ctrl->D.dir, "cache", 5U)) { /* Want cache */ + if (!Ctrl->Q.active && (!strncmp (Ctrl->D.dir, "all", 3U) || !strncmp (Ctrl->D.dir, "cache", 5U))) { /* Want cache (not when just listing) */ char line[GMT_LEN256] = {""}, hashpath[PATH_MAX] = {""}; FILE *fp = NULL; if (access (GMT->session.CACHEDIR, R_OK) && gmt_mkdir (GMT->session.CACHEDIR)) { /* Have or just made a server subdirectory */ From 4dd2438c62ed759aae2ebc66719e61a0170d33de Mon Sep 17 00:00:00 2001 From: Esteban82 Date: Tue, 6 Oct 2026 09:53:51 -0300 Subject: [PATCH 3/3] Revert "gmtget: Do not download the cache when -Q is given" Moved to its own branch (fix-gmtget-q-cache) to go in a separate PR. Co-Authored-By: Claude Sonnet 5.5 --- src/gmtget.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gmtget.c b/src/gmtget.c index 63598fb59ac..5cfbe9ac81d 100644 --- a/src/gmtget.c +++ b/src/gmtget.c @@ -300,7 +300,7 @@ EXTERN_MSC int GMT_gmtget (void *V_API, int mode, void *args) { } } } - if (!Ctrl->Q.active && (!strncmp (Ctrl->D.dir, "all", 3U) || !strncmp (Ctrl->D.dir, "cache", 5U))) { /* Want cache (not when just listing) */ + if (!strncmp (Ctrl->D.dir, "all", 3U) || !strncmp (Ctrl->D.dir, "cache", 5U)) { /* Want cache */ char line[GMT_LEN256] = {""}, hashpath[PATH_MAX] = {""}; FILE *fp = NULL; if (access (GMT->session.CACHEDIR, R_OK) && gmt_mkdir (GMT->session.CACHEDIR)) { /* Have or just made a server subdirectory */