Re: grdmath problems

"Eduardo A. Suárez" <[email protected]>
Newsgroups gmane.comp.gis.gmt.user
Message-ID <[email protected]>
Hi Branden,

(only if you aren't tired of this)

* compile GMT 4.5.11 without any optimization and with debug flag.
   This is done setting CFLAGS environment variable, in bash shell:

   export CFLAGS="-g -O0"

   Then go to gmt-45-11 directory and ./configure and make (no install)

* Install valgrind in Ubuntu. Valgrind is a tool for debugging programs.
   Then with GMT freshly compiled, go to gmt-4-5-11/src directory and run
   your commands:

./grdmath -R0/10/0/10 -I1 X = 1.grd

./grdmath -R0/10/0/10 -I1 X = 2.grd

valgrind ./grdmath 1.grd DUP DUP 10 LE 0.65 MUL EXCH DUP DUP DUP 10 GT  
EXCH 20 LE MUL EXCH 10 SUB 10 DIV -0.05 MUL 0.65 ADD MUL EXCH DUP DUP  
DUP 20 GT EXCH 30 LE MUL EXCH 20 SUB 10 DIV -0.07 MUL 0.60 ADD MUL  
EXCH DUP DUP DUP 30 GT EXCH 40 LE MUL EXCH 30 SUB 10 DIV -0.08 MUL  
0.53 ADD MUL EXCH 40 GT 0.45 MUL ADD ADD ADD ADD 686 2.grd DIV EXCH  
POW MUL = 3.grd

Look that you're running under valgrind the grdmath in the src directory!

Paste and send the screen output

Eduardo.-

Quoting Branden Christensen <[email protected]>:

> Paul, Marcelo and others:
>
>
> Good day.
>
> *First, -V:*
>
> Unfortunately, -V does not appear to produce valuable output....
>
> *osop@osop-displays2:/opt$  /usr/src/gmt-4.5.11/bin/grdmath 1.grd DUP DUP
> 10 LE 0.65 MUL EXCH DUP DUP DUP 10 GT EXCH 20 LE MUL EXCH 10 SUB 10 DIV
> -0.05 MUL 0.65 ADD MUL EXCH DUP DUP DUP 20 GT EXCH 30 LE MUL EXCH 20 SUB 10
> DIV -0.07 MUL 0.60 ADD MUL EXCH DUP DUP DUP 30 GT EXCH 40 LE MUL EXCH 30
> SUB 10 DIV -0.08 MUL 0.53 ADD MUL EXCH 40 GT 0.45 MUL ADD ADD ADD ADD 686
> 2.grd DIV EXCH POW MUL = 3.grd -V*
> -bash: /usr/src/gmt-4.5.11/bin/grdmath 1.grd: No such file or directory
> *osop@osop-displays2:/opt$ /usr/src/gmt-4.5.11/bin/grdmath -V 1.grd DUP DUP
> 10 LE 0.65 MUL EXCH DUP DUP DUP 10 GT EXCH 20 LE MUL EXCH 10 SUB 10 DIV
> -0.05 MUL 0.65 ADD MUL EXCH DUP DUP DUP 20 GT EXCH 30 LE MUL EXCH 20 SUB 10
> DIV -0.07 MUL 0.60 ADD MUL EXCH DUP DUP DUP 30 GT EXCH 40 LE MUL EXCH 30
> SUB 10 DIV -0.08 MUL 0.53 ADD MUL EXCH 40 GT 0.45 MUL ADD ADD ADD ADD 686
> 2.grd DIV EXCH POW MUL = 3.grd *
> grdmath: GMT SYNTAX ERROR: 1.grd is not a number, operator or file name
>
> Maybe I am placing the flag in the wrong place...
>
> Without the flag I get the buffer overflow (as you already know):
> *osop@osop-displays2:/opt$ /usr/src/gmt-4.5.11/bin/grdmath 1.grd DUP DUP 10
> LE 0.65 MUL EXCH DUP DUP DUP 10 GT EXCH 20 LE MUL EXCH 10 SUB 10 DIV -0.05
> MUL 0.65 ADD MUL EXCH DUP DUP DUP 20 GT EXCH 30 LE MUL EXCH 20 SUB 10 DIV
> -0.07 MUL 0.60 ADD MUL EXCH DUP DUP DUP 30 GT EXCH 40 LE MUL EXCH 30 SUB 10
> DIV -0.08 MUL 0.53 ADD MUL EXCH 40 GT 0.45 MUL ADD ADD ADD ADD 686 2.grd
> DIV EXCH POW MUL = 3.grd*
> *** buffer overflow detected ***: /usr/src/gmt-4.5.11/bin/grdmath terminated
> ======= Backtrace: =========
> /lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x37)[0x7f8759adb807]
> /lib/x86_64-linux-gnu/libc.so.6(+0x109700)[0x7f8759ada700]
> /lib/x86_64-linux-gnu/libc.so.6(+0x1085d3)[0x7f8759ad95d3]
> /usr/src/gmt-4.5.11/bin/grdmath[0x41e286]
> /usr/src/gmt-4.5.11/bin/grdmath[0x40cd4a]
> /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed)[0x7f87599f276d]
> /usr/src/gmt-4.5.11/bin/grdmath[0x40f409]
> ======= Memory map: ========
> 00400000-004c9000 r-xp 00000000 08:01 9834075
>  /usr/src/gmt-4.5.11/bin/grdmath
> 006c8000-006ca000 r--p 000c8000 08:01 9834075
>  /usr/src/gmt-4.5.11/bin/grdmath
> 006ca000-006ee000 rw-p 000ca000 08:01 9834075
>  /usr/src/gmt-4.5.11/bin/grdmath
> 006ee000-0073a000 rw-p 00000000 00:00 0
> 01724000-01796000 rw-p 00000000 00:00 0
>  [heap]
> 7f874c3e5000-7f874c3ee000 r-xp 00000000 08:01 11010866
> /lib/x86_64-linux-gnu/libcrypt-2.15.so
> 7f874c3ee000-7f874c5ee000 ---p 00009000 08:01 11010866
> /lib/x86_64-linux-gnu/libcrypt-2.15.so
> 7f874c5ee000-7f874c5ef000 r--p 00009000 08:01 11010866
> /lib/x86_64-linux-gnu/libcrypt-2.15.so
> 7f874c5ef000-7f874c5f0000 rw-p 0000a000 08:01 11010866
> /lib/x86_64-linux-gnu/libcrypt-2.15.so
> 7f874c5f0000-7f874c61e000 rw-p 00000000 00:00 0
> 7f874c61e000-7f874c663000 r-xp 00000000 08:01 5773595
>  /usr/lib/x86_64-linux-gnu/libhx509.so.5.0.0
> 7f874c663000-7f874c863000 ---p 00045000 08:01 5773595
>  /usr/lib/x86_64-linux-gnu/libhx509.so.5.0.0
> 7f874c863000-7f874c865000 r--p 00045000 08:01 5773595
>  /usr/lib/x86_64-linux-gnu/libhx509.so.5.0.0
> 7f874c865000-7f874c867000 rw-p 00047000 08:01 5773595
>  /usr/lib/x86_64-linux-gnu/libhx509.so.5.0.0
> 7f874c867000-7f874c868000 rw-p 00000000 00:00 0
> 7f874c868000-7f874c876000 r-xp 00000000 08:01 5773589
>  /usr/lib/x86_64-linux-gnu/libheimbase.so.1.0.0
> 7f874c876000-7f874ca75000 ---p 0000e000 08:01 5773589
>  /usr/lib/x86_64-linux-gnu/libheimbase.so.1.0.0
> 7f874ca75000-7f874ca76000 r--p 0000d000 08:01 5773589
>  /usr/lib/x86_64-linux-gnu/libheimbase.so.1.0.0
> 7f874ca76000-7f874ca77000 rw-p 0000e000 08:01 5773589
>  /usr/lib/x86_64-linux-gnu/libheimbase.so.1.0.0
> 7f874ca77000-7f874ca9f000 r-xp 00000000 08:01 5773592
>  /usr/lib/x86_64-linux-gnu/libwind.so.0.0.0
> 7f874ca9f000-7f874cc9e000 ---p 00028000 08:01 5773592
>  /usr/lib/x86_64-linux-gnu/libwind.so.0.0.0
> 7f874cc9e000-7f874cc9f000 r--p 00027000 08:01 5773592
>  /usr/lib/x86_64-linux-gnu/libwind.so.0.0.0
> 7f874cc9f000-7f874cca0000 rw-p 00028000 08:01 5773592
>  /usr/lib/x86_64-linux-gnu/libwind.so.0.0.0
> 7f874cca0000-7f874ccd5000 r-xp 00000000 08:01 5776318
>  /usr/lib/x86_64-linux-gnu/libquadmath.so.0.0.0
> 7f874ccd5000-7f874ced4000 ---p 00035000 08:01 5776318
>  /usr/lib/x86_64-linux-gnu/libquadmath.so.0.0.0
> 7f874ced4000-7f874ced5000 r--p 00034000 08:01 5776318
>  /usr/lib/x86_64-linux-gnu/libquadmath.so.0.0.0
> 7f874ced5000-7f874ced6000 rw-p 00035000 08:01 5776318
>  /usr/lib/x86_64-linux-gnu/libquadmath.so.0.0.0
> 7f874ced6000-7f874ceea000 r-xp 00000000 08:01 5773571
>  /usr/lib/x86_64-linux-gnu/libroken.so.18.1.0
> 7f874ceea000-7f874d0e9000 ---p 00014000 08:01 5773571
>  /usr/lib/x86_64-linux-gnu/libroken.so.18.1.0
> 7f874d0e9000-7f874d0ea000 r--p 00013000 08:01 5773571
>  /usr/lib/x86_64-linux-gnu/libroken.so.18.1.0
> 7f874d0ea000-7f874d0eb000 rw-p 00014000 08:01 5773571
>  /usr/lib/x86_64-linux-gnu/libroken.so.18.1.0
> 7f874d0eb000-7f874d11c000 r-xp 00000000 08:01 5773586
>  /usr/lib/x86_64-linux-gnu/libhcrypto.so.4.1.0
> 7f874d11c000-7f874d31c000 ---p 00031000 08:01 5773586
>  /usr/lib/x86_64-linux-gnu/libhcrypto.so.4.1.0
> 7f874d31c000-7f874d31d000 r--p 00031000 08:01 5773586
>  /usr/lib/x86_64-linux-gnu/libhcrypto.so.4.1.0
> 7f874d31d000-7f874d31e000 rw-p 00032000 08:01 5773586
>  /usr/lib/x86_64-linux-gnu/libhcrypto.so.4.1.0
> 7f874d31e000-7f874d31f000 rw-p 00000000 00:00 0
> 7f874d31f000-7f874d3ba000 r-xp 00000000 08:01 5773574
>  /usr/lib/x86_64-linux-gnu/libasn1.so.8.0.0
> 7f874d3ba000-7f874d5b9000 ---p 0009b000 08:01 5773574
>  /usr/lib/x86_64-linux-gnu/libasn1.so.8.0.0
> 7f874d5b9000-7f874d5bb000 r--p 0009a000 08:01 5773574
>  /usr/lib/x86_64-linux-gnu/libasn1.so.8.0.0
> 7f874d5bb000-7f874d5bf000 rw-p 0009c000 08:01 5773574
>  /usr/lib/x86_64-linux-gnu/libasn1.so.8.0.0
> 7f874d5bf000-7f874d63f000 r-xp 00000000 08:01 5773598
>  /usr/lib/x86_64-linux-gnu/libkrb5.so.26.0.0
> 7f874d63f000-7f874d83f000 ---p 00080000 08:01 5773598
>  /usr/lib/x86_64-linux-gnu/libkrb5.so.26.0.0
> 7f874d83f000-7f874d841000 r--p 00080000 08:01 5773598
>  /usr/lib/x86_64-linux-gnu/libkrb5.so.26.0.0
> 7f874d841000-7f874d845000 rw-p 00082000 08:01 5773598
>  /usr/lib/x86_64-linux-gnu/libkrb5.so.26.0.0
> 7f874d845000-7f874d84b000 r-xp 00000000 08:01 5773601
>  /usr/lib/x86_64-linux-gnu/libheimntlm.so.0.1.0
> 7f874d84b000-7f874da4a000 ---p 00006000 08:01 5773601
>  /usr/lib/x86_64-linux-gnu/libheimntlm.so.0.1.0
> 7f874da4a000-7f874da4b000 r--p 00005000 08:01 5773601
>  /usr/lib/x86_64-linux-gnu/libheimntlm.so.0.1.0
> 7f874da4b000-7f874da4c000 rw-p 00006000 08:01 5773601
>  /usr/lib/x86_64-linux-gnu/libheimntlm.so.0.1.0
> 7f874da4c000-7f874da4f000 r-xp 00000000 08:01 11010397
> /lib/x86_64-linux-gnu/libkeyutils.so.1.4
> 7f874da4f000-7f874dc4e000 ---p 00003000 08:01 11010397
> /lib/x86_64-linux-gnu/libkeyutils.so.1.4
> 7f874dc4e000-7f874dc4f000 r--p 00002000 08:01 11010397
> /lib/x86_64-linux-gnu/libkeyutils.so.1.4
> 7f874dc4f000-7f874dc50000 rw-p 00003000 08:01 11010397
> /lib/x86_64-linux-gnu/libkeyutils.so.1.4
> 7f874dc50000-7f874edbf000 r-xp 00000000 08:01 5776023
>  /usr/lib/libicudata.so.48.1.1
> 7f874edbf000-7f874efbe000 ---p 0116f000 08:01 5776023
>  /usr/lib/libicudata.so.48.1.1
> 7f874efbe000-7f874efbf000 r--p 0116e000 08:01 5776023
>  /usr/lib/libicudata.so.48.1.1
> 7f874efbf000-7f874efc0000 rw-p 0116f000 08:01 5776023
>  /usr/lib/libicudata.so.48.1.1
> 7f874efc0000-7f874f0d4000 r-xp 00000000 08:01 5782149
>  /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0
> 7f874f0d4000-7f874f2d4000 ---p 00114000 08:01 5782149
>  /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0
> 7f874f2d4000-7f874f2d5000 r--p 00114000 08:01 5782149
>  /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0
> 7f874f2d5000-7f874f2d7000 rw-p 00115000 08:01 5782149
>  /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0
> 7f874f2d7000-7f874f2da000 r-xp 00000000 08:01 11010342
> /lib/x86_64-linux-gnu/libgpg-error.so.0.8.0
> 7f874f2da000-7f874f4d9000 ---p 00003000 08:01 11010342
> /lib/x86_64-linux-gnu/libgpg-error.so.0.8.0Aborted (core dumped)
>
>
> *Second, Debugging:*
> I created a special output file to start debugging with strace. You can
> find this file attached (grdmath.strace.out). This was generated by:
> *strace -o ~/grdmath.strace.out -t -ff /usr/src/gmt-4.5.11/bin/grdmath
> 1.grd DUP DUP 10 LE 0.65 MUL EXCH DUP DUP DUP 10 GT EXCH 20 LE MUL EXCH 10
> SUB 10 DIV -0.05 MUL 0.65 ADD MUL EXCH DUP DUP DUP 20 GT EXCH 30 LE MUL
> EXCH 20 SUB 10 DIV -0.07 MUL 0.60 ADD MUL EXCH DUP DUP DUP 30 GT EXCH 40 LE
> MUL EXCH 30 SUB 10 DIV -0.08 MUL 0.53 ADD MUL EXCH 40 GT 0.45 MUL ADD ADD
> ADD ADD 686 2.grd DIV EXCH POW MUL = 3.grd*
>
>
> Let me know if you need any additional information.
>
>
>
> Kind Regards,
>
>
> *Branden Christensen*
> The Seismo Guys Blog: http://www.osop.com.pa/blog/the-seismo-guys/
> Take a Virtual Tour: http://www.osop.com.pa/tour
> Sign up for the OSOP mailing list:
> http://www.osop.com.pa/about/osop-mailing-list/
>
>
> On Sat, Jan 25, 2014 at 12:49 AM, Paul Wessel <[email protected]> wrote:
>
>> I've running the tests in ubuntu 13.04 and no problems.  Given the various
>> strange GMT errors we have seen over the last years, always involving
>> ubuntu, especially their own package builds, makes me wonder if there is
>> something very odd with that platform.  Since I cannot even reproduce the
>> problem on ubuntu (Not to mention other os) I am afraid the original poster
>> will need to run debug on that command to see what is going on.   For
>> starters, could you add -V so you can see how far it gets (the order of the
>> operators) before it dies.  Perhaps that can give a clue.  Otherwise build
>> with debug flags and  what line it dies in.
>>
>> -p
>>
>> On Jan 24, 2014, at 9:48 AM, Paul Wessel <[email protected]> wrote:
>>
>> Cannot reproduce on OSX.  Are you able to run this in any debugger to see
>> what exactly is happening to give us a clue?
>> -p
>>
>> On Jan 24, 2014, at 2:03 AM, Marcelo Banik <[email protected]>
>> wrote:
>>
>> I tested in an ubuntu 13.10.
>>
>>
>> Following command pass:
>>
>> ~/strange_behavior$ /usr/local/GMT4.5.11/bin/grdmath 1.grd DUP DUP 10 LE
>> 0.65 MUL EXCH DUP DUP DUP 10 GT EXCH 20 LE MUL EXCH 10 SUB 10 DIV -0.05 MUL
>> 0.65 ADD MUL EXCH DUP DUP DUP 20 GT EXCH 30 LE MUL EXCH 20 SUB 10 DIV -0.07
>> MUL 0.60 ADD MUL EXCH DUP DUP DUP 30 GT EXCH 40 LE MUL EXCH 30 SUB 10 DIV
>> -0.08 MUL 0.53 ADD MUL EXCH 40 GT 0.45 MUL ADD ADD ADD ADD 686 2.grd DIV
>> EXCH POW MUL = 3.grd
>>
>>
>> But if I did:
>>
>> ~/strange_behavior$ ln -s /usr/local/GMT4.5.11/bin .
>>
>> ~/strange_behavior$ bin/grdmath 1.grd DUP DUP 10 LE 0.65 MUL EXCH DUP DUP
>> DUP 10 GT EXCH 20 LE MUL EXCH 10 SUB 10 DIV -0.05 MUL 0.65 ADD MUL EXCH DUP
>> DUP DUP 20 GT EXCH 30 LE MUL EXCH 20 SUB 10 DIV -0.07 MUL 0.60 ADD MUL EXCH
>> DUP DUP DUP 30 GT EXCH 40 LE MUL EXCH 30 SUB 10 DIV -0.08 MUL 0.53 ADD MUL
>> EXCH 40 GT 0.45 MUL ADD ADD ADD ADD 686 2.grd DIV EXCH POW MUL = 3.grd
>>
>> *** buffer overflow detected ***: bin/grdmath terminated
>>
>>
>> And if I use full path to grdmath 4.5.12_r10185 [64-bit], it fails:
>>
>> /opt/gmt/4.5.12/bin/grdmath 1.grd DUP DUP 10 LE 0.65 MUL EXCH DUP DUP DUP
>> 10 GT EXCH 20 LE MUL EXCH 10 SUB 10 DIV -0.05 MUL 0.65 ADD MUL EXCH DUP DUP
>> DUP 20 GT EXCH 30 LE MUL EXCH 20 SUB 10 DIV -0.07 MUL 0.60 ADD MUL EXCH DUP
>> DUP DUP 30 GT EXCH 40 LE MUL EXCH 30 SUB 10 DIV -0.08 MUL 0.53 ADD MUL EXCH
>> 40 GT 0.45 MUL ADD ADD ADD ADD 686 2.grd DIV EXCH POW MUL = 3.grd
>>
>> *** buffer overflow detected ***: /opt/gmt/4.5.12/bin/grdmath terminated
>>
>>
>> In both cases, it succeed if I use ./1.grd instead of 1.grd.
>>
>>
>> Could someone more reproduce these results?
>>
>>
>> Marcelo
>>
>>
>>
>>
>> On Thu, Jan 23, 2014 at 9:12 PM, Branden Christensen <
>> [email protected]> wrote:
>>
>>> Paul:
>>>
>>>
>>> Good evening.
>>>
>>> I originally had the buffer overflow problem when I installed GMT on
>>> Ubuntu 12.04 using "sudo apt-get install gmt". You recommended I install
>>> 4.5.11 from sources which I did using the attached script
>>> "siposg4511-1.sh". But the problems persists.
>>>
>>> In the end I hope to be able to execute grdmath by calling the full path.
>>>
>>>
>>>
>>> *Branden Christensen*
>>> The Seismo Guys Blog: http://www.osop.com.pa/blog/the-seismo-guys/
>>> Take a Virtual Tour: http://www.osop.com.pa/tour
>>> Sign up for the OSOP mailing list:
>>> http://www.osop.com.pa/about/osop-mailing-list/
>>>
>>>
>>> On Wed, Jan 22, 2014 at 7:06 PM, Paul Wessel <[email protected]> wrote:
>>>
>>>> Hi Brandan-
>>>>
>>>> I think I forgot how this started.  Did you build GMT yourself or
>>>> installed via ubuntu package manager? We have had lots of issues with the
>>>> ubuntu-built GMT release but people who build it themselves have   
>>>> no issues.
>>>>  I know a ticket was opened with Ubuntu so maybe in 4 years it will be
>>>> addressed...  We suspect they used some unhealthy compiler flag but we do
>>>> not know.
>>>> -p
>>>>
>>>> On Jan 22, 2014, at 9:43 AM, Branden Christensen <
>>>> [email protected]> wrote:
>>>>
>>>> Paul:
>>>>
>>>>
>>>> If you guys want access to a server running 12.04 let me know.
>>>>
>>>>
>>>> Kind Regards,
>>>>
>>>>
>>>> *Branden Christensen*
>>>> The Seismo Guys Blog: http://www.osop.com.pa/blog/the-seismo-guys/
>>>> Take a Virtual Tour: http://www.osop.com.pa/tour
>>>> Sign up for the OSOP mailing list:
>>>> http://www.osop.com.pa/about/osop-mailing-list/
>>>>
>>>>
>>>> On Wed, Jan 22, 2014 at 7:31 PM, Paul Wessel <[email protected]> wrote:
>>>>
>>>>> No, this should be good - I just need to reproduce it in Ubuntu, or
>>>>> have some of our other guys try it as well (Marcelo? Eduardo?)
>>>>>
>>>>> -p
>>>>>
>>>>> On Jan 22, 2014, at 9:16 AM, Branden Christensen <
>>>>> [email protected]> wrote:
>>>>>
>>>>> Paul:
>>>>>
>>>>>
>>>>> I get this:
>>>>> osop@osop-displays2:~$ /usr/src/gmt-4.5.11/bin/grdmath -R0/10/0/10 -I1
>>>>> X = 1.grd
>>>>> osop@osop-displays2:~$ /usr/src/gmt-4.5.11/bin/grdmath -R0/10/0/10 -I1
>>>>> X = 2.grd
>>>>> osop@osop-displays2:~$ /usr/src/gmt-4.5.11/bin/grdmath 1.grd DUP DUP
>>>>> 10 LE 0.65 MUL EXCH DUP DUP DUP 10 GT EXCH 20 LE MUL EXCH 10 SUB 10 DIV
>>>>> -0.05 MUL 0.65 ADD MUL EXCH DUP DUP DUP 20 GT EXCH 30 LE MUL   
>>>>> EXCH 20 SUB 10
>>>>> DIV -0.07 MUL 0.60 ADD MUL EXCH DUP DUP DUP 30 GT EXCH 40 LE MUL EXCH 30
>>>>> SUB 10 DIV -0.08 MUL 0.53 ADD MUL EXCH 40 GT 0.45 MUL ADD ADD ADD ADD 686
>>>>> 2.grd DIV EXCH POW MUL = 3.grd
>>>>> *** buffer overflow detected ***: /usr/src/gmt-4.5.11/bin/grdmath
>>>>> terminated
>>>>>
>>>>> So will you still need the original files if these dummy files produce
>>>>> the same error? Please let me know!
>>>>>
>>>>>
>>>>> Kind Regards,
>>>>>
>>>>>
>>>>> *Branden Christensen*
>>>>> The Seismo Guys Blog: http://www.osop.com.pa/blog/the-seismo-guys/
>>>>> Take a Virtual Tour: http://www.osop.com.pa/tour
>>>>> Sign up for the OSOP mailing list:
>>>>> http://www.osop.com.pa/about/osop-mailing-list/
>>>>>
>>>>>
>>>>> On Wed, Jan 22, 2014 at 7:05 PM, Paul Wessel <[email protected]>
>>>>> wrote:
>>>>>
>>>>>> Hi Brandan-
>>>>>>
>>>>>> Even if the input grids dont matter I will need to create dummy ones
>>>>>> with the right dimensions since grdmath is reading them to detect -R -I.
>>>>>> If I just try
>>>>>>
>>>>>> grdmath -R0/10/0/10 -I1 X = 1.grd
>>>>>> grdmath -R0/10/0/10 -I1 X = 2.grd
>>>>>> grdmath 1.grd DUP DUP 10 LE 0.65 MUL EXCH DUP DUP DUP 10 GT EXCH 20 LE
>>>>>> MUL EXCH 10 SUB 10 DIV -0.05 MUL 0.65 ADD MUL EXCH DUP DUP DUP   
>>>>>> 20 GT EXCH
>>>>>> 30 LE MUL EXCH 20 SUB 10 DIV -0.07 MUL 0.60 ADD MUL EXCH DUP   
>>>>>> DUP DUP 30 GT
>>>>>> EXCH 40 LE MUL EXCH 30 SUB 10 DIV -0.08 MUL 0.53 ADD MUL EXCH 40 GT 0.45
>>>>>> MUL ADD ADD ADD ADD 686 2.grd DIV EXCH POW MUL = 3.grd
>>>>>>
>>>>>> I get no errors.  Let me know if the above crashes for you.  I will
>>>>>> then fire up Ubuntu in parallels and see what happens there.
>>>>>> -p
>>>>>>
>>>>>> On Jan 22, 2014, at 8:51 AM, Branden Christensen <
>>>>>> [email protected]> wrote:
>>>>>>
>>>>>> > Paul:
>>>>>> >
>>>>>> >
>>>>>> > Buenas tardes.
>>>>>> >
>>>>>> > I would like to take up this issue again.
>>>>>> >
>>>>>> > The buffer overflow is caused by grdmath on a 64-bit 12.04 LTS
>>>>>> Ubuntu machine running GMT 4.5.11.
>>>>>> >
>>>>>> > Here is the complete command and resulting error:
>>>>>> >
>>>>>> > /usr/src/gmt-4.5.11/bin/grdmath
>>>>>> /opt/shakemap2/bin/../data/9583161/richter/pgv_rock.grd DUP DUP  
>>>>>>  10 LE 0.65
>>>>>> MUL EXCH DUP DUP DUP 10 GT EXCH 20 LE MUL EXCH 10 SUB 10 DIV   
>>>>>> -0.05 MUL 0.65
>>>>>> ADD MUL EXCH DUP DUP DUP 20 GT EXCH 30 LE MUL EXCH 20 SUB 10   
>>>>>> DIV -0.07 MUL
>>>>>> 0.60 ADD MUL EXCH DUP DUP DUP 30 GT EXCH 40 LE MUL EXCH 30 SUB   
>>>>>> 10 DIV -0.08
>>>>>> MUL 0.53 ADD MUL EXCH 40 GT 0.45 MUL ADD ADD ADD ADD 686
>>>>>> /opt/shakemap2/bin/../data/9583161/output/UFVS74PC0J.grd DIV   
>>>>>> EXCH POW MUL =
>>>>>> /opt/shakemap2/bin/../data/9583161/output/pgv.grd
>>>>>> > *** buffer overflow detected ***: /usr/src/gmt-4.5.11/bin/grdmath
>>>>>> terminated
>>>>>> >
>>>>>> > The input files do not matter. I created a new directory "tmp" and
>>>>>> touched 1.grd, 2.grd and 3.grd. Then:
>>>>>> > osop@osop-displays2:~/tmp$ /usr/src/gmt-4.5.11/bin/grdmath 1.grd
>>>>>> DUP DUP 10 LE 0.65 MUL EXCH DUP DUP DUP 10 GT EXCH 20 LE MUL   
>>>>>> EXCH 10 SUB 10
>>>>>> DIV -0.05 MUL 0.65 ADD MUL EXCH DUP DUP DUP 20 GT EXCH 30 LE MUL EXCH 20
>>>>>> SUB 10 DIV -0.07 MUL 0.60 ADD MUL EXCH DUP DUP DUP 30 GT EXCH 40 LE MUL
>>>>>> EXCH 30 SUB 10 DIV -0.08 MUL 0.53 ADD MUL EXCH 40 GT 0.45 MUL   
>>>>>> ADD ADD ADD
>>>>>> ADD 686 2.grd DIV EXCH POW MUL = 3.grd*** buffer overflow detected ***:
>>>>>> /usr/src/gmt-4.5.11/bin/grdmath terminated
>>>>>> >
>>>>>> >
>>>>>> > Thank you for your expertise.
>>>>>> >
>>>>>> >
>>>>>> > Kind Regards from Panama,
>>>>>> >
>>>>>> >
>>>>>> > Branden Christensen
>>>>>> > The Seismo Guys Blog: http://www.osop.com.pa/blog/the-seismo-guys/
>>>>>> > Take a Virtual Tour: http://www.osop.com.pa/tour
>>>>>> > Sign up for the OSOP mailing list:
>>>>>> http://www.osop.com.pa/about/osop-mailing-list/
>>>>>> >
>>>>>> >
>>>>>> > On Fri, Nov 29, 2013 at 9:32 AM, Paul Wessel <[email protected]>
>>>>>> wrote:
>>>>>> > Brendan-
>>>>>> >
>>>>>> > It would be helpful if you could save the files used to run the
>>>>>> grdmath command below which seems to be the first that crashes.  
>>>>>>   However,
>>>>>> that is clearly not the full grdmath command since there is no -R -I or
>>>>>> gridfile on the input side. If I am to be of any help I will   
>>>>>> need an actual
>>>>>> grdmath command line that crashes and all the input files that   
>>>>>> it requires
>>>>>> so I can try to recreate the situation here.
>>>>>> >
>>>>>> > Cheers,
>>>>>> > -p
>>>>>> >
>>>>>> >
>>>>>> >
>>>>>> > On Nov 28, 2013, at 5:54 PM, Branden Christensen <
>>>>>> [email protected]> wrote:
>>>>>> >
>>>>>> >> grdmath: (/opt/shakemap2/bin/../data/9583161/output/hwxDhIWuGY.xy)
>>>>>> PDIST 27.47 HYPOT =   
>>>>>> /opt/shakemap2/bin/../data/9583161/output/D7FwNIcwDT.grd
>>>>>> >> *** buffer overflow detected ***: /usr/lib/gmt/bin/grdmath
>>>>>> terminated
>>>>>> >
>>>>>> > To unsubscribe, send the message "signoff gmt-help" to
>>>>>> [email protected]
>>>>>> >
>>>>>> > To unsubscribe, send the message "signoff gmt-help" to
>>>>>> [email protected]
>>>>>>
>>>>>> To unsubscribe, send the message "signoff gmt-help" to
>>>>>> [email protected]
>>>>>>
>>>>>
>>>>> To unsubscribe, send the message "signoff gmt-help" to
>>>>> [email protected]
>>>>>
>>>>>
>>>>> To unsubscribe, send the message "signoff gmt-help" to
>>>>> [email protected]
>>>>>
>>>>
>>>> To unsubscribe, send the message "signoff gmt-help" to
>>>> [email protected]
>>>>
>>>>
>>>> To unsubscribe, send the message "signoff gmt-help" to
>>>> [email protected]
>>>>
>>>
>>> To unsubscribe, send the message "signoff gmt-help" to
>>> [email protected]
>>>
>>
>> To unsubscribe, send the message "signoff gmt-help" to
>> [email protected]
>>
>>
>>
>> To unsubscribe, send the message "signoff gmt-help" to
>> [email protected]
>>
>
> To unsubscribe, send the message "signoff gmt-help" to   
> [email protected]
>



-- 
Eduardo A. Suarez
Facultad de Ciencias Astronómicas y Geofísicas - UNLP
FCAG: (0221)-4236593 int. 172/Cel: (0221)-15-4557542/Casa: (0221)-4526589


----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

To unsubscribe, send the message "signoff gmt-help" to [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.