Bug #768

Incorrect behavior of option --GMT_HISTORY

Added by Michael over 1 year ago. Updated over 1 year ago.

Status:In ProgressStart date:2015-09-20
Priority:NormalDue date:
Assignee:Paul% Done:

0%

Category:-
Target version:Candidate for next minor release
Affected version:5.1.x Platform:

Description

Creation of file gmt.history can be ruled only by setting in the configuration file, command line option --GMT_HISTORY is ignored.
This problem exists for API and stand-alone tools.

Example code shows, that problem localized in the function GMT_Destroy_Session
#include <gmt.h>
int main() {
void* gmtapi;
char* args="-R130/160/40/60 -JM12c -Xa2c -Ya2c -B5/5/swNE --GMT_HISTORY=f";
gmtapi=GMT_Create_Session("GMT",2,0,0);
GMT_Call_Module(gmtapi,"psbasemap",GMT_MODULE_CMD,args);
GMT_Destroy_Session(gmtapi); // gmt.history created in this call!
return 0;
}

As I understand, --GMT_HISTORY contols only behavior of GMT_Call_Module, but GMT_Destroy_Session use settings from config file.

History

#1 Updated by Paul over 1 year ago

  • Status changed from New to In Progress

Thanks, we are considering our options.

#2 Updated by Paul over 1 year ago

  • Assignee set to Paul
  • Target version set to Candidate for next minor release

To clarify, the issue is that the GMT session is created before the fist module with the --GMT_HISTORY=f option is processed. Create_Session will parse gmt.conf and pick up whatever GMT_HISTORY setting is there, but the later GMT_HISTORY switch on the module command line is not affecting the session defaults, only the module defaults. We have a few options here:

  1. Let --GMT_HISTORY be a special setting whose effect is allowed to survive the module and thus affect session settings
  2. Consider this an aspect that should be controlled at the Create_Session stage and thus supply a bit flag to control gmt.history behavior for the entire session.

My gut says option 2 but before taking action we need to review gmt.conf for any other options that may have a session-wide consequence and then see what is the best course of action. In the meantime the workaround is to make sure your gmt.conf has the requested GMT_HISTORY setting before starting the session.

Also available in: Atom PDF