SAVE and RESTORE

Help
Alain C.
2009-10-08
2013-09-17
  • Alain C.

    Alain C. - 2009-10-08

    SAVE and RESTORE must work again (e.g. CVS version of GDL since today), even with the last version of CMSVLIB library (extensions of original SAVE/RESTORE), delivered 05 may 2009 by Craig M.

    Please remember that you must donwload this library by yourself, we cannot put it in GDL CVS (bad licence due to ITT)

    Please report here or in bug tracker any trouble around SAVE/RESTORE if and only if you test on the current CVS version

    Alain

     
  • Sylwester Arabas

    That's what I get when running the CMSV_TEST script shipped with the library using the current CVS version (both the gdl binary and the .pro files). I'll look into it during weekend.

    Sylwester

        GDL> cmsv_test
        % Compiled module: CMSV_TEST.
        % Compiled module: CMSVLIB.
        % Compiled module: CMSV_OPEN.
        CMSV_TEST - $Id: cmsv_test.pro,v 1.8 2002/05/13 06:41:10 craigm Exp $
        --------------------------
        Fri Oct 09 12:58:37 2009
        ** Structure !VERSION, 8 tags, data length=28:
           ARCH            STRING    'i386'
           OS              STRING    'Darwin'
           OS_FAMILY       STRING    'unix'
           OS_NAME         STRING    'Darwin'
           RELEASE         STRING    '6.0'
           BUILD_DATE      STRING    'Jul 07 2005'
           MEMORY_BITS     INT             32
           FILE_OFFSET_BITS
                           INT             64
        Testing SAVE and RESTORE…
          SAVEing data…% Compiled module: SAVE.
        % Compiled module: CMSAVE.
        % Compiled module: CMSV_PTRSUM.
        % Compiled module: CMSV_WREC.
        % Compiled module: CMSV_RREC.
        % Compiled module: CMSV_WRAW.
        % Compiled module: CMSV_WVTYPE.
        % Compiled module: CMSV_WDATA.
        % Compiled module: TAGSIZE.
        % Compiled module: STR_SEP.
        % Compiled module: STRSPLIT.
        done
          RESTOREing data…% Compiled module: RESTORE.
        % Compiled module: CMRESTORE.
        % Compiled module: CMSV_RRAW.
        % Compiled module: CMSV_RVTYPE.
        % Compiled module: CMSV_RDATA.
       
        Program received signal EXC_BAD_ACCESS, Could not access memory.
        Reason: KERN_PROTECTION_FAILURE at address: 0x00000000
        0x000a63d6 in lib::routine_names (e=0x1ae8490) at basic_fun_jmg.cpp:798
        798             BaseGDL* res = e->GetPar( 1)->Dup();

     
  • Alain C.

    Alain C. - 2009-10-11

    You are rigth, I mixed up my tests (too much cross cases with different GL_PATH ) before putting the changes in CVS.

    I just revert the CVS (file src/pro/restore.pro)

    2 importants points:

    • current version does not work with last version of CMSV library (I will write to Craig with the hope he will accept to do a change for GDL)

    • the bug which creates your crash is due to EXECUTE, which apparently do not check wether the value exists or not

    Sorry

    Alain

    PS: news here ASAP

     
  • Sylwester Arabas

    Hello Alain,

    Please send me / post here / post on a tracker an example code that crashes GDL using the bug in EXECUTE you've mentioned.

    How does the CMSV lib need to be changed?

    Currently the behaviour of CMSV_TEST is as follows:

        GDL> cmsv_test
        % Compiled module: CMSV_TEST.
        % Compiled module: CMSVLIB.
        % Compiled module: CMSV_OPEN.
        CMSV_TEST - $Id: cmsv_test.pro,v 1.8 2002/05/13 06:41:10 craigm Exp $
        --------------------------
        Sun Oct 11 11:33:10 2009
        ** Structure !VERSION, 8 tags, data length=28:
           ARCH            STRING    'i386'
           OS              STRING    'Darwin'
           OS_FAMILY       STRING    'unix'
           OS_NAME         STRING    'Darwin'
           RELEASE         STRING    '6.0'
           BUILD_DATE      STRING    'Jul 07 2005'
           MEMORY_BITS     INT             32
           FILE_OFFSET_BITS
                           INT             64
        Testing SAVE and RESTORE…
          SAVEing data…% Compiled module: SAVE.
        % Compiled module: CMSAVE.
        % Compiled module: CMSV_PTRSUM.
        % Compiled module: CMSV_WREC.
        % Compiled module: CMSV_RREC.
        % Compiled module: CMSV_WRAW.
        % Compiled module: CMSV_WVTYPE.
        % Compiled module: CMSV_WDATA.
        % Compiled module: TAGSIZE.
        % Compiled module: STR_SEP.
        % Compiled module: STRSPLIT.
        done
          RESTOREing data…% Compiled module: RESTORE.
        % Compiled module: CMRESTORE.
        % Compiled module: CMSV_RRAW.
        % Compiled module: CMSV_RVTYPE.
        % CMRESTORE: WARNING: the following variables were not found: UNDEFINED UNDEFINED UNDEFINED UNDEFINED UNDEFINED UNDEFINED UNDEFINED UNDEFINED UNDEFINED UNDEFINED UNDEFINED UNDEFINED UNDEFINED UNDEFINED UNDEFINED UNDEFINED UNDEFINED UNDEFINED UNDEFINED UNDEFINED UNDEFINED UNDEFINED UNDEFINED UNDEFINED UNDEFINED UNDEFINED UNDEFINED UNDEFINED UNDEFINED UNDEFINED.
        done
          Comparing results…FAILED test a:typ
       
        Testing CMSAVEDIR
        % Compiled module: CMSAVEDIR.
        % Compiled module: CMSV_RDATA.
        % Compiled module: HELPFORM.
        % CMSV_TEST:   ** Variable "A" type incorrect
        % Execution halted at: CMSV_TEST              /usr/local/share/gnudatalanguage/cmsvlib/cmsv_test.pro
        %                      $MAIN$ 

    … which is what Orion Popławski described in a tracker item:
    https://sourceforge.net/tracker/?func=detail&aid=2787462&group_id=97659&atid=618683

    tracking down the problem to an issue with ROUTINE_NAMES.

    I've just posted a new tracker item with a minimal code to show it:

    https://sourceforge.net/tracker/?func=detail&aid=2876439&group_id=97659&atid=618683

    Best,
    Sylwester

     
  • Alain C.

    Alain C. - 2009-10-12

    may be we have a problem with ROUTINE_NAMES and around CMSV lib.

    but I succeed to crash with the minimal code (derivated from my modified RESTORE before reversion in CVS):

        pro minicrash
        _nme_=
        for i=0,n_elements(_nme_)-1 do begin
        p = strcompress('p' + string(i), /remove_all)
        print, 'here 1'
        parm = 'dummy=routine_names(_nme__,' + p + ',store=-1)'
        print, 'here 2'
        stat = execute(parm)
        print, 'here 3'
        endfor
        print, 'ok'
        end

    please notice this code don't crash if no "pro minicrash"

    Alain

    PS: on my side, with a simple modif in CMRESTORE.pro (version of 090505), RESTORE and CMSV_TEST both work fine _

     
  • Sylwester Arabas

    Thanks for the reply.

    I've shortened a bit the minicrash.pro and posted it on the tracker.

    Marc has fixed yesterday the above-mentioned bug in ROUTINE_NAMES (thanks!)
    but it's not enough for the CMSV_TEST to work, i.e.:

        GDL> cmsv_test
        % Compiled module: CMSV_TEST.
        % Compiled module: CMSVLIB.
        % Compiled module: CMSV_OPEN.
        CMSV_TEST - $Id: cmsv_test.pro,v 1.8 2002/05/13 06:41:10 craigm Exp $
        --------------------------
        Tue Oct 13 18:28:22 2009
        ** Structure !VERSION, 8 tags, data length=52:
           ARCH            STRING    'x86_64'
           OS              STRING    'Linux'
           OS_FAMILY       STRING    'unix'
           OS_NAME         STRING    'Linux'
           RELEASE         STRING    '6.0'
           BUILD_DATE      STRING    'Jul 07 2005'
           MEMORY_BITS     INT             32
           FILE_OFFSET_BITS
                           INT             64
        Testing SAVE and RESTORE…
          SAVEing data…% Compiled module: SAVE.
        % Compiled module: CMSAVE.
        % Compiled module: CMSV_PTRSUM.
        % Compiled module: CMSV_WREC.
        % Compiled module: CMSV_RREC.
        % Compiled module: CMSV_WRAW.
        % Compiled module: CMSV_WVTYPE.
        % Compiled module: CMSV_WDATA.
        % Compiled module: TAGSIZE.
        % Compiled module: STR_SEP.
        % Compiled module: STRSPLIT.
        done
          RESTOREing data…% Compiled module: RESTORE.
        % Compiled module: CMRESTORE.
        % Compiled module: CMSV_RRAW.
        % Compiled module: CMSV_RVTYPE.
        % CMRESTORE: WARNING: the following variables were not found: P0 P1 P2 P3 P4 P5 P6 P7 P8 P9 P10 P11 P12 P13 P14 P15 P16 P17 P18 P19 P20 P21 P22 P23 P24 P25 P26 P27 P28 P29.
        done
          Comparing results…FAILED test a:typ
       
        Testing CMSAVEDIR
        % Compiled module: CMSAVEDIR.
        % Compiled module: CMSV_RDATA.
        % Compiled module: HELPFORM.
        % CMSV_TEST:   ** Variable "A" type incorrect
        % Execution halted at: CMSV_TEST              /EXPORT/gdl/Linux-x86_64/share/gnudatalanguage/cmsvlib/cmsv_test.pro
        %                      $MAIN$

    Sylwester

     
  • Alain C.

    Alain C. - 2009-10-14

    Yes, you need to make a very small change in CMRESTORE file, lines
    286c279

        bad <   if nnames EQ 0 AND n_par EQ 0 then kall = 1
        --
        good >   if nnames EQ 0 then kall = 1

    I asked to Craig to make a small change in the "offical" code

     
  • Sylwester Arabas

    After making this change the CMSV_TEST still fails on one of the tests:

        …
        Testing CMSAVE
          Using ARG method…succeeded
          Using POINTER method…FAILED test a:dim
        …

    Sylwester

     
  • Marc Schellens

    Marc Schellens - 2009-10-19

    Here is what I get (with both versions of CMRESTORE).
    (Please look in the bug tracker, here the layout is spoiled)
    What am I missing? Why does GDL need the change?
    Marc

     
  • Sylwester Arabas

    One new clue: the file created during the failing 'POINTER' method test has mismatched variable names:

        419   if ver GE 5D then begin
        420       cmsv_test_set, a, b, c, d, e
        421       print, '  Using POINTER method…', format='(A,$)'
        422       pheap =
        423
        424       cmsave, file=filename, data=pheap, names=, $
        425         status=status, errmsg=errmsg, /nocatch
        426       if status EQ 0 then begin
        427           print, 'FAILED'
        428           message, errmsg, /info
        429       endif else begin
        430 print, ''
        431 help, 'in ', a, b, c, d, e
        432           restore, filename
        433 help, 'out', a, b, c, d, e
        434           cmsv_test_comp, a, b, c, d, e, result, failed
        435           if result EQ 0 then print, 'FAILED test '+failed $
        436           else print, 'succeeded'
        437       endelse
        438       if total(ptr_valid(pheap)) GT 0 then $
        439         ptr_free, pheap
        440   endif

    results in:

        Testing CMSAVE
          Using ARG method…succeeded
          Using POINTER method…
        <STRING    ('in ')>
                        STRING    = 'in '
        A               INT       =        1
        B               FLOAT     = Array
        C               DOUBLE    = Array
        D               STRUCT    = -> <Anonymous> Array
        E               DCOMPLEX  = Array
        <STRING    ('out')>
                        STRING    = 'out'
        A               FLOAT     = Array
        B               DOUBLE    = Array
        C               STRUCT    = -> <Anonymous> Array
        D               DCOMPLEX  = Array
        E               INT       =        1
        FAILED test a:dim

    (e.g. E has the value od A etc)

    Sylwester

     
  • Sylwester Arabas

    The current CVS version should work fine (except for the above-mentioned problem with the POINTER method, but it apparently does not affect SAVE/RESTORE routines in GDL).

    S.

     
  • Sylwester Arabas

    Trying to get a shortest possible code to reveal the POINTER-method problem I've reached:

    pro cmsv_test, u=u
      a = 1
      cmsave, file=f, data=, names=
      restore, f
      print, 'a should equal 1 but… a=', a
      cmsave, file='b'
    end

    which results with:

    $ gdl -quiet -e cmsv_test
    % Compiled module: CMSV_TEST.
    % Compiled module: CMSAVE.
    % Compiled module: CMSVLIB.
    % Compiled module: CMSV_OPEN.
    % Compiled module: CMSV_PTRSUM.
    % Compiled module: CMSV_WREC.
    % Compiled module: CMSV_RREC.
    % Compiled module: CMSV_WRAW.
    % Compiled module: CMSV_WVTYPE.
    % Compiled module: CMSV_WDATA.
    Out of scope (garbage collected): <PtrHeapVar1>
    % Compiled module: RESTORE.
    % Compiled module: CMRESTORE.
    % Compiled module: CMSV_RRAW.
    % Compiled module: CMSV_RVTYPE.
    % Compiled module: CMSV_RDATA.
    a should equal 1 but… a=cmsave.sav
    terminate called after throwing an instance of 'std::length_error'
      what():  basic_string::_S_create

    (I've just added the 2984189 tracker item concerning a problem in routine_names() which apparently is related)

    S.

     
  • Sylwester Arabas

    Trying to get a shortest possible code to reveal the POINTER-method problem I've reached:

    pro cmsv_test, u=u 
      a = 1 
      cmsave, file=f, data=[ptr_new(a)], names=['A']
      restore, f
      print, 'a should equal 1 but... a=', a
      cmsave, file='b'
    end
    

    which results with:

    $ gdl -quiet -e cmsv_test
    % Compiled module: CMSV_TEST.
    % Compiled module: CMSAVE.
    % Compiled module: CMSVLIB.
    % Compiled module: CMSV_OPEN.
    % Compiled module: CMSV_PTRSUM.
    % Compiled module: CMSV_WREC.
    % Compiled module: CMSV_RREC.
    % Compiled module: CMSV_WRAW.
    % Compiled module: CMSV_WVTYPE.
    % Compiled module: CMSV_WDATA.
    Out of scope (garbage collected): <PtrHeapVar1>
    % Compiled module: RESTORE.
    % Compiled module: CMRESTORE.
    % Compiled module: CMSV_RRAW.
    % Compiled module: CMSV_RVTYPE.
    % Compiled module: CMSV_RDATA.
    a should equal 1 but... a=cmsave.sav
    terminate called after throwing an instance of 'std::length_error'
      what():  basic_string::_S_create
    

    (I've just added the 2984189 tracker item concerning a problem in routine_names() which apparently is related)

    S.

     
  • Sylwester Arabas

    Trying to get a shortest possible code to reveal the POINTER-method problem I've reached:

    pro cmsv_test, u=u
      a = 1
      cmsave, file=f, data=, names=
      restore, f
      print, 'a should equal 1 but… a=', a
      cmsave, file='b'
    end

    which results with:

    $ gdl -quiet -e cmsv_test
    % Compiled module: CMSV_TEST.
    % Compiled module: CMSAVE.
    % Compiled module: CMSVLIB.
    % Compiled module: CMSV_OPEN.
    % Compiled module: CMSV_PTRSUM.
    % Compiled module: CMSV_WREC.
    % Compiled module: CMSV_RREC.
    % Compiled module: CMSV_WRAW.
    % Compiled module: CMSV_WVTYPE.
    % Compiled module: CMSV_WDATA.
    Out of scope (garbage collected): <PtrHeapVar1>
    % Compiled module: RESTORE.
    % Compiled module: CMRESTORE.
    % Compiled module: CMSV_RRAW.
    % Compiled module: CMSV_RVTYPE.
    % Compiled module: CMSV_RDATA.
    a should equal 1 but… a=cmsave.sav
    terminate called after throwing an instance of 'std::length_error'
      what():  basic_string::_S_create

    (I've just added the 2984189 tracker item concerning a problem in routine_names() which apparently is related)

    S.

     
  • Sylwester Arabas

    … no luck with SF auto-formatting - I'll add it as a comment to the 2984189 tracker item

     
  • Mark Booth

    Mark Booth - 2013-09-17

    Hi, I'm not sure whether this is the correct place to report this so let me know if I should be putting this elsewhere, but I've encountered a bug when restoring certain files. I have some files that are a mix of structures and float arrays and I receive the following error messages when trying to restore them:

    % CMSV_RSTRUCTDESC: Scalar subscript out of range [>].c
    % Error occurred at: CMSV_RSTRUCTDESC 314 /media/DATA/Research/IDL/idlrepos/other-packages/markwardt/CMSVLIB/cmsv_rvtype.pro

    I've been in contact with Craig Markwardt and we've figured out that the problem is not with CMSVLIB as it works fine in IDL. Do you know what the problem is here?

    Thanks,
    Mark

     

Log in to post a comment.