Skip to content

-D parsing in psscale (colorbar) may fail to check if refpoint is set#8918

Merged
Chuan1937 merged 5 commits intoGenericMappingTools:masterfrom
Chuan1937:psscale
Mar 12, 2026
Merged

-D parsing in psscale (colorbar) may fail to check if refpoint is set#8918
Chuan1937 merged 5 commits intoGenericMappingTools:masterfrom
Chuan1937:psscale

Conversation

@Chuan1937
Copy link
Member

@Chuan1937 Chuan1937 commented Mar 10, 2026

When the -D parameter of psscale uses an invalid alignment code (e.g., -DJ+e), the gmt_just_decode function returns -99. However, gmt_get_refpoint passes this return value directly to subsequent code without checking it, resulting in the mysterious warning gmt_flip_justify called with incorrect argument (-99).

The fix involves checking immediately after calling gmt_just_decode whether the return value is -99. If so, it outputs the clear error message Invalid justification code
and returns NULL, thereby providing users with explicit error guidance.

Fixes #8864

Local test successful:

      Start 847: test/psscale/autoscale.sh
 1/29 Test #847: test/psscale/autoscale.sh .........   Passed    1.03 sec
      Start 848: test/psscale/categoricalcpt.sh
 2/29 Test #848: test/psscale/categoricalcpt.sh ....   Passed    0.76 sec
      Start 849: test/psscale/catlabels.sh
 3/29 Test #849: test/psscale/catlabels.sh .........   Passed    1.29 sec
      Start 850: test/psscale/cbarfontsize.sh
 4/29 Test #850: test/psscale/cbarfontsize.sh ......   Passed    0.86 sec
      Start 851: test/psscale/cbars.sh
 5/29 Test #851: test/psscale/cbars.sh .............   Passed    0.96 sec
      Start 852: test/psscale/colorbar-nans-h.sh
 6/29 Test #852: test/psscale/colorbar-nans-h.sh ...   Passed    1.18 sec
      Start 853: test/psscale/colorbar-nans-v.sh
 7/29 Test #853: test/psscale/colorbar-nans-v.sh ...   Passed    1.29 sec
      Start 854: test/psscale/cpthinges.sh
 8/29 Test #854: test/psscale/cpthinges.sh .........   Passed    1.85 sec
      Start 855: test/psscale/cptmix.sh
 9/29 Test #855: test/psscale/cptmix.sh ............   Passed    0.95 sec
      Start 856: test/psscale/cpttime.sh
10/29 Test #856: test/psscale/cpttime.sh ...........   Passed    0.59 sec
      Start 857: test/psscale/customwidths.sh
11/29 Test #857: test/psscale/customwidths.sh ......   Passed    0.85 sec
      Start 858: test/psscale/cyclecpt.sh
12/29 Test #858: test/psscale/cyclecpt.sh ..........   Passed    0.96 sec
      Start 859: test/psscale/hardsoft.sh
13/29 Test #859: test/psscale/hardsoft.sh ..........   Passed    1.88 sec
      Start 860: test/psscale/horizontal.sh
14/29 Test #860: test/psscale/horizontal.sh ........   Passed    1.47 sec
      Start 861: test/psscale/horsclpanel.sh
15/29 Test #861: test/psscale/horsclpanel.sh .......   Passed    1.09 sec
      Start 862: test/psscale/interval-panel.sh
16/29 Test #862: test/psscale/interval-panel.sh ....   Passed    1.03 sec
      Start 863: test/psscale/pattern.sh
17/29 Test #863: test/psscale/pattern.sh ...........   Passed    0.97 sec
      Start 864: test/psscale/placebars.sh
18/29 Test #864: test/psscale/placebars.sh .........   Passed    1.48 sec
      Start 865: test/psscale/psscale-l2s.sh
19/29 Test #865: test/psscale/psscale-l2s.sh .......   Passed    0.92 sec
      Start 866: test/psscale/psscale.sh
20/29 Test #866: test/psscale/psscale.sh ...........   Passed    1.58 sec
      Start 867: test/psscale/scale_percent.sh
21/29 Test #867: test/psscale/scale_percent.sh .....   Passed    1.01 sec
      Start 868: test/psscale/scales.sh
22/29 Test #868: test/psscale/scales.sh ............   Passed    1.04 sec
      Start 869: test/psscale/scalings.sh
23/29 Test #869: test/psscale/scalings.sh ..........   Passed    1.76 sec
      Start 870: test/psscale/seis.sh
24/29 Test #870: test/psscale/seis.sh ..............   Passed    1.43 sec
      Start 871: test/psscale/slant_annot.sh
25/29 Test #871: test/psscale/slant_annot.sh .......   Passed    1.43 sec
      Start 872: test/psscale/transp_scale.sh
26/29 Test #872: test/psscale/transp_scale.sh ......   Passed    1.15 sec
      Start 873: test/psscale/versclpanel.sh
27/29 Test #873: test/psscale/versclpanel.sh .......   Passed    1.26 sec
      Start 874: test/psscale/vertcustannot.sh
28/29 Test #874: test/psscale/vertcustannot.sh .....   Passed    1.00 sec
      Start 875: test/psscale/vertical.sh
29/29 Test #875: test/psscale/vertical.sh ..........   Passed    1.37 sec

100% tests passed, 0 tests failed out of 29

Total Test time (real) =  34.49 sec

@Chuan1937 Chuan1937 added this to the 6.7.0 milestone Mar 10, 2026
@Chuan1937 Chuan1937 added the bug Something isn't working label Mar 10, 2026
@Chuan1937 Chuan1937 self-assigned this Mar 10, 2026
@Chuan1937 Chuan1937 requested a review from joa-quim March 10, 2026 14:19
@Chuan1937 Chuan1937 merged commit f0ba782 into GenericMappingTools:master Mar 12, 2026
10 of 13 checks passed
@Chuan1937 Chuan1937 deleted the psscale branch March 12, 2026 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

-D parsing in psscale (colorbar) may fail to check if refpoint is set

2 participants