Cache data are stored in the wrong directory if GMT_DATA_SERVER is set via environmental variable or via "gmt set"

Ouverte
#8,437 7 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
48/100
Type d'issue
Bug
Clarté
Plutôt claire
Activité
À l'abandon
Stack technique
c
Domaine
cli

Piste de recherche

Reproduisez le problème avec GMT_DATA_SERVER=static et avec gmt configuré, en utilisant gmt which et gmt get -Dcache avec une sortie détaillée. Suivez la manière dont le serveur de données sélectionné détermine les chemins de téléchargement et de cache, puis vérifiez que les fichiers téléchargés et gmt_hash_server.txt sont enregistrés et lus de manière cohérente dans le répertoire du serveur statique.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

bug

When GMT is built with the default GMT_DATA_SERVER settings, the default data server is oceania.

$ gmt --version
6.6.0_6d36f98_2024.04.09

$ gmt --show-dataserver
http://oceania.generic-mapping-tools.org

For testing, we want to use the static data server, so that the GMT tests won't fail due to updates of cache files or remote files. This can be done by either setting the environmental variable GMT_DATA_SERVER or via CLI option --GMT_DATA_SERVER=static, but it doesn't work well.

$ export GMT_DATA_SERVER=static   # Set via environmental variable

$ gmt --show-dataserver
http://static.generic-mapping-tools.org   # The URL is correct

Now running gmt which to download a remote file. The debug messages are long, but the most important messages are shown below:

$ gmt which -Ga @earth_relief_01d_g -Vd
...
gmtwhich [DEBUG]: Get remote file http://static.generic-mapping-tools.org/server/earth/earth_relief/earth_relief_01d_g.grd and write to /Users/seisman/.gmt/server/earth/earth_relief/earth_relief_01d_g.grd
gmtwhich [DEBUG]: Download http://static.generic-mapping-tools.org/server/earth/earth_relief/earth_relief_01d_g.grd to /Users/seisman/.gmt/server/earth/earth_relief/earth_relief_01d_g.grd
gmtwhich [NOTICE]: Remote data courtesy of GMT data server static [http://static.generic-mapping-tools.org]
...

As you can see, GMT tries to download from the static data server, but save the file into ~/.gmt/server/ rather than ~/.gmt/static/server.

The same thing happens when set GMT_DATA_SERVER configuration:

$ gmt set GMT_DATA_SERVER=static
$ gmt --show-dataserver
http://static.generic-mapping-tools.org

$ gmt which -Ga @earth_relief_01d_g -Vd
$ gmt which -Ga @earth_relief_01d_g -Vd --GMT_DATA_SERVER=static

Similarly,

export GMT_DATA_SERVER=static
$ gmt get -Dcache -V
gmtget [INFORMATION]: Downloading file http://static.generic-mapping-tools.org/gmt_data_server.txt ...
gmtget [INFORMATION]: Downloading file http://static.generic-mapping-tools.org/gmt_hash_server.txt ...
gmtget [ERROR]: Unable to access or read /Users/seisman/.gmt/server/gmt_hash_server.txt

gmt_hash_server.txt is downloaded to ~/.gmt/gmt_hash_server.txt, but GMT tries to read it in ~/.gmt/server/gmt_hash_server.txt.

I think this explains why @joa-quim has trouble using the static server https://github.com/GenericMappingTools/gmt/pull/8425#issuecomment-2040848702.

Langage dominant
C
Étoiles
997
Forks
420
Merge moyen
13 h 27 min
PR mergées (30 j)
47

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de GenericMappingTools/gmt

Toutes les issues de GenericMappingTools/gmt

Issues similaires

Plus d'issues C

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.