bug in gunzip / strange line numbers in error message / keyboard weirdness

Søren Hauberg soren at hauberg.org
Sun Nov 2 04:38:47 CST 2008


Thorsten Meyer skrev:
> Hi,
>
> with octave built from the current tip, I get:
>
> octave:1> tmpdir=tmpnam;
> octave:2> tmpfile=tmpnam;
> octave:3> dummy=1;
> octave:4> save(tmpfile, "dummy")
> octave:5> mkdir(tmpdir)
> ans =  1
> octave:6> gzfile=gzip(tmpfile, tmpdir)
> gzfile =
>
> {
>   [1,1] = /tmp/oct-rZOZFQ/oct-OLjAWz.gz
> }
>
> octave:7> gunzip(gzfile)
> error: `ext' undefined near line 145 column 30
> error: evaluating argument list element number 1
> error: evaluating argument list element number 1
> error: called from:
> error:   /home/thorsten/hg/octave/scripts/miscellaneous/unpack.m at line 145, column 12
> error:   /home/thorsten/hg/octave/scripts/miscellaneous/gunzip.m at line 47, column 5
>
>
> I tried to debug this and added a line containing "ext" to unpack.m. Strangely, even if I place this
> command right before the "endfunction" statement of "function unpack" the correct value of ext gets
> printed and then the error message is displayed. Also the gz file gets unzipped correctly, so the
> bug has to be after the system call. So where is the error located?
>
> Also, the line numbers in the error message seem to be off. line 47 of gunzip.m is the last line
> there, and line 145 in unpack.m is way before the system call.
>
> I also tried to add a keyboard command to gunzip.m. But within the debug mode I cannot see any
> variables except the function arguments:
>
> keyboard: stopped in /home/thorsten/hg/octave/scripts/miscellaneous/unpack.m
> debug> whos
> Variables in the current scope:
>
>   Attr Name           Size                     Bytes  Class
>   ==== ====           ====                     =====  =====
>        argn           1x6                          6  char
>    f   files          1x1                         29  cell
>    f   outputdir      1x1                          1  char
>
> Total is 8 elements using 36 bytes
>
> debug>
>
>
> Can someone help?
>
> thanks
>
> Thorsten
>
>   
I quick look at 'unpack.m' brings the following to my attention:

  if (ischar (file))
    if (isdir (file))
      if (isempty (filetype))
        error ("unpack: filetype must be given for a directory");
      elseif (! any (strcmpi (filetype, "gunzip")))
        error ("unpack: filetype must be gunzip for a directory");
      endif
    else
      [pathstr, name, ext] = fileparts (file);


So, if 'file' is a directory, we don't really do anything with it. I 
some cases we raise errors, but sometimes we just do nothing. I'm 
guessing this is the source of the problem.

Søren


More information about the Bug-octave mailing list