[Pkg-octave-devel] Bug#725442: octave: Incorrect results after editing m-file
Dmitry Borisyuk
q1werty at i.com.ua
Sat Oct 5 21:29:42 UTC 2013
Package: octave
Version: 3.6.2-5+deb7u1
Severity: normal
Tags: patch
Dear Maintainers,
I have found that, if I repeatedly edit and run some m-file,
at some (almost random) moment Octave produces incorrect results.
I use version 3.6.2 from stable, but the bug is present
in 3.6.4 from unstable as well.
After trying to "purify" the bug I arrive at the following.
Place the attached file bug.m in $(pwd), run Octave and type:
octave:1> bug
octave:2> system('sed -i "s/QQ log/QQ];% log/" bug.m');
octave:3> bug
octave:4> system('sed -i "/%%%$/ a \ " bug.m');
octave:5> bug
octave:6> system('sed -i "/%%%$/ { n; d }; s/QQ];% log/QQ log/" bug.m');
octave:7> bug
error: assert (c == size (mm, 2)) failed
error: called from:
error: /usr/share/octave/3.6.2/m/testfun/assert.m at line 72, column 1
error: /home/kot/bug.m at line 20, column 1
error: /home/kot/bug.m at line 6, column 1
Instead of using sed you may edit m-file by hand, but if you place
all commands in the script, the bug will not show up.
Note that after those three edits m-file returns to its initial state,
but now it does not work!
However, after you do "clear -f" or even "touch bug.m",
it will run normally, as before.
Using "dbstop" and "dbstep" I've found that just before the error occurs,
the interpreter behaves strangely... It looks like it is not executing
actual commands from the m-file, but is executing something else :)
The dump of symbol table is also very strange:
octave:8> __dump_symtab_info__("functions")
...
check []
subfunction: /home/kot/bug.m [75]
subfunction: /home/kot/bug.m [76]
subfunction: /home/kot/bug.m [82]
...
octave:8> __dump_symtab_info__(75)
error: unable to find symbol_table object for scope 75!
Evidently, the subfunctions are not deleted from the table
when deleting parent function. I don't know if there is a reason
for doing so, but I feel the bug is related to this.
After I've changed the destructor of octave_user_function
so as to delete subfunctions (see attached diff), the bug goes away.
I'm not sure that such change does not break something else,
but at least Octave compiles and passes all tests successfully.
-- System Information:
Debian Release: 7.1
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 3.2.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages octave depends on:
ii libamd2.2.0 1:3.4.0-3
ii libarpack2 3.1.1-2.1
ii libatlas3-base [liblapack.so.3] 3.8.4-9
ii libblas3 [libblas.so.3] 1.2.20110419-5
ii libc6 2.13-38
ii libcamd2.2.0 1:3.4.0-3
ii libccolamd2.7.1 1:3.4.0-3
ii libcholmod1.7.1 1:3.4.0-3
ii libcolamd2.7.1 1:3.4.0-3
ii libcurl3-gnutls 7.26.0-1+wheezy3
ii libcxsparse2.2.3 1:3.4.0-3
ii libfftw3-3 3.3.2-3.1
ii libfltk1.1 1.1.10-14
ii libfreetype6 2.4.9-1.1
ii libgcc1 1:4.7.2-5
ii libgl1-mesa-glx [libgl1] 8.0.5-4+deb7u2
ii libglpk0 4.45-1
ii libgomp1 4.7.2-5
ii libgraphicsmagick++3 1.3.16-1.1
ii libgraphicsmagick3 1.3.16-1.1
ii liblapack3 [liblapack.so.3] 3.4.1+dfsg-1+deb70u1
ii liboctave1 3.6.2-5+deb7u1
ii libpcre3 1:8.30-5
ii libqhull5 2009.1-3
ii libqrupdate1 1.1.1-1
ii libstdc++6 4.7.2-5
ii libumfpack5.4.0 1:3.4.0-3
ii octave-common 3.6.2-5+deb7u1
ii texinfo 4.13a.dfsg.1-10
ii zlib1g 1:1.2.7.dfsg-13
Versions of packages octave recommends:
ii gnuplot-x11 4.6.0-8
ii libatlas3-base 3.8.4-9
Versions of packages octave suggests:
pn octave-doc <none>
pn octave-htmldoc <none>
pn octave-info <none>
-- no debconf information
-------------- next part --------------
function bug;
global mm QQ ee;
ee = QQ = (1:10)';
mm = fmtx(ee,QQ);
check(size(mm,2));
function emtx = femtx(ee)% %%%
emtx = [ee ee.^2 ee.^3];
function Qmtx = fQmtx(QQ)
Qmtx = [QQ log(QQ)];
function mtx = fmtx(ee,QQ)
mtx = [femtx(ee) fQmtx(QQ)];
function check(c)
global mm QQ ee;
mm = fmtx(ee,QQ);
assert(c==size(mm,2));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: diff
Type: text/x-diff
Size: 1031 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-octave-devel/attachments/20131006/ffd71b62/attachment.diff>
More information about the Pkg-octave-devel
mailing list