grdcut: segmentation fault if output extension is omitted
See forum for details: https://forum.generic-mapping-tools.org/t/error-recognizing-tif-files-from-remote-dataset/5035/7
I offer to fix it (with Joaquim guidance).
The source code should be fixed. I think I will have to edit this file: https://github.com/GenericMappingTools/gmt/blob/master/src/grdcut.c
The reason I said this one should be a simple one to fix is:
1- We have a warning message that is is easy to find 2- We have a crash that, with the right tool (a debugger), is easy to find where it occurs.
(1) Can be solved with grep but I find it much simpler to use VS code. My workflow involves having the GMT src directory all loaded in VSC Explorer. Note that this doesn't mean having all .c files loaded, only those that we want. Next with a Shift+Ctrl+F we enter the searching string in the upper left corner box and it will search it in all files.
(2) Is another story. For that one, we need to have a GMT debug build and next lunching the crashing command
gmt grdcut @earth_day_30m -R-1.5/0/44.5/45.5 -Gdaytime
in the debugger and watch where it lands. The point in this one is that I can only provide specific assistance on Windows.
Also, depending on the situation, the crashing point can be close or far from the code point that originated the error and finding the reason can be, or not, trivial. But in this case, the cause is likely close to the origin of (1).
Great Joaquim. Sorry, I didn't have time to take a look.
No worries, we have more.