[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug in pkg, untar
From: |
John W. Eaton |
Subject: |
bug in pkg, untar |
Date: |
Sat, 28 Apr 2007 15:46:53 -0400 |
On 28-Apr-2007, Tom Holroyd (NIH/NIMH) [E] wrote:
| The current cvs pkg doesn't work. At the end of untar.m, the result of unpack
is placed in
| a cell array of length 0, which fails. It's doing something like:
|
| v = cell(1,0);
| [v{:}] = {'a', 'b'};
|
| which results in
|
| error: A(:) = X: A must be the same size as X
Yes, that's not valid, but I don't think that's exactly what untar is
doing.
| Currently, untar is called with nargout equal to 0.
|
| It's not clear to me why the above isn't just:
|
| v = {'a', 'b'};
|
| or why it used to work. Did something change with zero length cell arrays?
The code in untar is
varargout = cell (1, nargout);
[varargout{:}] = unpack (files, outputdir, mfilename ());
If you write this as
varargout = unpack (files, outputdir, mfilename ());
then unpack will always see nargout == 1.
For now I checked in the following change.
Thanks,
jwe
scripts/ChangeLog:
2007-04-28 John W. Eaton <address@hidden>
* miscellaneous/unzip.m, miscellaneous/untar.m,
miscellaneous/bunzip2.m, miscellaneous/gunzip.m:
Special case nargout == 0.
Index: scripts/miscellaneous/bunzip2.m
===================================================================
RCS file: /cvs/octave/scripts/miscellaneous/bunzip2.m,v
retrieving revision 1.2
diff -u -u -r1.2 bunzip2.m
--- scripts/miscellaneous/bunzip2.m 22 Jan 2007 17:29:53 -0000 1.2
+++ scripts/miscellaneous/bunzip2.m 28 Apr 2007 19:45:57 -0000
@@ -35,7 +35,12 @@
if (nargin == 1)
outputdir = ".";
endif
- varargout = cell (1, nargout);
- [varargout{:}] = unpack (files, outputdir, mfilename ());
+
+ if (nargout > 0)
+ varargout = cell (1, nargout);
+ [varargout{:}] = unpack (files, outputdir, mfilename ());
+ else
+ unpack (files, outputdir, mfilename ());
+ endif
endfunction
Index: scripts/miscellaneous/gunzip.m
===================================================================
RCS file: /cvs/octave/scripts/miscellaneous/gunzip.m,v
retrieving revision 1.2
diff -u -u -r1.2 gunzip.m
--- scripts/miscellaneous/gunzip.m 22 Jan 2007 17:29:53 -0000 1.2
+++ scripts/miscellaneous/gunzip.m 28 Apr 2007 19:45:57 -0000
@@ -37,7 +37,12 @@
if (nargin == 1)
outputdir = ".";
endif
- varargout = cell (1, nargout);
- [varargout{:}] = unpack (files, outputdir, mfilename ());
+
+ if (nargout > 0)
+ varargout = cell (1, nargout);
+ [varargout{:}] = unpack (files, outputdir, mfilename ());
+ else
+ unpack (files, outputdir, mfilename ());
+ endif
endfunction
Index: scripts/miscellaneous/untar.m
===================================================================
RCS file: /cvs/octave/scripts/miscellaneous/untar.m,v
retrieving revision 1.7
diff -u -u -r1.7 untar.m
--- scripts/miscellaneous/untar.m 22 Jan 2007 17:29:53 -0000 1.7
+++ scripts/miscellaneous/untar.m 28 Apr 2007 19:45:57 -0000
@@ -36,7 +36,12 @@
if (nargin == 1)
outputdir = ".";
endif
- varargout = cell (1, nargout);
- [varargout{:}] = unpack (files, outputdir, mfilename ());
+
+ if (nargout > 0)
+ varargout = cell (1, nargout);
+ [varargout{:}] = unpack (files, outputdir, mfilename ());
+ else
+ unpack (files, outputdir, mfilename ());
+ endif
endfunction
Index: scripts/miscellaneous/unzip.m
===================================================================
RCS file: /cvs/octave/scripts/miscellaneous/unzip.m,v
retrieving revision 1.6
diff -u -u -r1.6 unzip.m
--- scripts/miscellaneous/unzip.m 22 Jan 2007 17:29:53 -0000 1.6
+++ scripts/miscellaneous/unzip.m 28 Apr 2007 19:45:57 -0000
@@ -36,7 +36,12 @@
if (nargin == 1)
outputdir = ".";
endif
- varargout = cell (1, nargout);
- [varargout{:}] = unpack (files, outputdir, mfilename ());
+
+ if (nargout > 0)
+ varargout = cell (1, nargout);
+ [varargout{:}] = unpack (files, outputdir, mfilename ());
+ else
+ unpack (files, outputdir, mfilename ());
+ endif
endfunction