Bug #1067

psxy - Segfault when additional blank lines are present at the end of "here" documents/input files

Added by Christian 3 months ago. Updated 2 months ago.

Status:ClosedStart date:2017-03-19
Priority:NormalDue date:
Assignee:Paul% Done:

100%

Category:-
Target version:Candidate for next bugfix release
Affected version:5.x-svn Platform:Mac OS X

Description

Hi GMT Team,

I am getting segfaults when there are blank lines present in a "here" document such as the this example:

gmt psxy -P -X4 -R0/20/2017-04-01T/2018-01-31T -JX20/-35 -BWeSN -V -S <<END > test.ps 
#--- Weekends
> -G200
10 2017-03-18 20 bb2017-03-20
> -G200
10 2017-03-25 20 bb2017-03-27
> -G200
10 2017-04-01 20 bb2017-04-03
> -G200
10 2017-04-08 20 bb2017-04-10

END

and when input files (same content as the "here" redirect above, but in separate file) are used. This is the error report:

psxy: Processing input table data
ERROR: Caught signal number 11 (Segmentation fault) at
0   libgmt.5.dylib                      0x00000001094bfb77 GMT_psxy + 25559
1   ???                                 0x000000020c4395d3 0x0 + 8795690451
Stack backtrace:
0   libgmt.5.dylib                      0x000000010920204b sig_handler + 571
1   libsystem_platform.dylib            0x00007fff8e33d5aa _sigtramp + 26
2   ???                                 0x0000000000000000 0x0 + 0
3   libgmt.5.dylib                      0x0000000109210dbc GMT_Call_Module + 412
4   gmt                                 0x00000001091fa314 main + 980
5   libdyld.dylib                       0x00007fff9081e5fd start + 1

This version without additional spaces between the last data and the END statement works fine (both in "here" documents as well as separate input files):

gmt psxy -P -X4 -R0/20/2017-04-01T/2018-01-31T -JX20/-35 -BWeSN -V -S <<END > test.ps 
#--- Weekends
> -G200
10 2017-03-18 20 bb2017-03-20
> -G200
10 2017-03-25 20 bb2017-03-27
> -G200
10 2017-04-01 20 bb2017-04-03
> -G200
10 2017-04-08 20 bb2017-04-10
END

I'm not sure whether this is intended behaviour? I would have expected that GMT/psxy simply ignores additional blank lines at the end of a file or input.

Mac OS 10.9.5 GMT r17714 (svn).

Groetjes,
Christian H

Associated revisions

Revision 17727
Added by Paul 3 months ago

Address issue #1067 at the source in gmt_io.c, undo r17725

History

#1 Updated by Joaquim 3 months ago

  • Status changed from New to Resolved

Thanks, fixed in r17725

#2 Updated by Paul 3 months ago

  • Assignee changed from Christian to Paul
  • Target version set to Candidate for next bugfix release
  • % Done changed from 0 to 100

I undid r17725 in psxy in trunk and applied the fix at the source in gmt_io.c in the 5.3 branch, then merged to trunk as well. In r17728.

#3 Updated by Paul 2 months ago

  • Status changed from Resolved to Closed

Closing this issue.

Also available in: Atom PDF