bugGNU Octave - Bugs: bug #43237, line plot fails if a file...


bug #43237: line plot fails if a file "x.oct" exists in the current directory

Submitted by:  None
Submitted on:  Tue 16 Sep 2014 07:40:41 PM UTC  
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Works For Me Assigned to:  None
Originator Name:  Ian Hutchinson Originator Email:  -email is unavailable-
Open/Closed:  Closed Release:  3.8.1
Operating System:  GNU/Linux

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


( Jump to the original submission)

Wed 25 Nov 2015 12:50:45 AM UTC, comment #6: 

Can someone else re-test this bug?  Using 74cc8ae4e2b0 on the development branch none of the examples cause an error or crash anymore.

Rik <rik5>
Project Administrator
Thu 25 Sep 2014 12:36:14 PM UTC, comment #5: 

This does look to be a very subtle and broken name resolution problem. The existence of a global name "x" should not break the plot routine in question. I've reported a bug about the underlying issue, once that is fixed this particular error will be resolved.

Other than the particular name "x" causing a problem in this particular plot function, I don't think there are any other general problems here. As a rule, the .oct file extension should be avoided because it does hold special meaning to Octave. However, in most other cases the error should be obvious:

>> system ("echo > x.oct");
>> x
error: /home/mike/x.oct: failed to load: /home/mike/x.oct: file too short

Do you think the manual could somehow better express that .oct files should be avoided except for compiled extension functions? Right now it is only mentioned in the sections about how to create oct-files. If you are not looking for that functionality, it doesn't look like there is anything generally describing that .oct files are any different from any other name.

Mike Miller <mtmiller>
Project Administrator
Wed 17 Sep 2014 12:32:43 PM UTC, comment #4: 

Doubtless you are right, Mike. I simply meant that it had nothing to do with the file being empty. The file that caused the problem originally was in fact generated by Octave as a save of a variable (previously).

This is a really treacherous bug. It cost me an hour to figure out that my whole Octave system was not hosed, since the error message gave no indication of what the problem was. It was only by luck that I managed to discover the cause.

I've never seen a warning not to have files ".oct" in my directory. And if I had my response would have been: that's crazy. The system ought not to be able to be broken by the presence of a particular (and not terribly special) named file in one's directory.

In any case, it seems "y.oct" won't do it, so it is really weird.


Ian Hutchinson <ihutch>
Tue 16 Sep 2014 09:16:40 PM UTC, comment #3: 

Can you show how you created a valid x.oct file? If I create x.cc defining a function named "x", for example:

#include <oct.h>
DEFUN_DLD(x, args, nargout, "")
  return octave_value_list ();

and then

octave:1> mkoctfile x.cc
octave:2> x = 1:20; plot (x);

I get the correct line plot with no error. So for me it does depend on the contents of the x.oct file.

Mike Miller <mtmiller>
Project Administrator
Tue 16 Sep 2014 09:06:22 PM UTC, comment #2: 

Of course, it is nothing to do with the variable x.
Neither is it anything to do with the content of the x.oct file.
I started with a valid x.oct file that happened to be there.
I experimented and found that a null file gave the exact same
error. That's what I demonstrated.

Ian Hutchinson <ihutch>
Tue 16 Sep 2014 08:01:47 PM UTC, comment #1: 

Thanks for your bug report. I can confirm here, and the error is not actually caused by your workspace variable named x the same as x.oct. I would say this is user error, there should not be a file named x.oct in a directory that Octave can read unless it is a valid compiled oct-file.

First and foremost, do not create files named .oct on your Octave path unless they are valid oct-files (compiled Octave extension modules). It might be tempting to use .oct as a data file extension (analogous to .mat for Matlab) but .oct is actually reserved for compiled code loaded by Octave's interpreter. If it is not a compiled oct-file, bad things like this may happen. So the error checking could possible be improved, but this exact example will probably always cause some kind of error.

The error occurs in a call to cellfun from the plot scripts. The error is more simply reproduced with:

octave:1> system ("echo > x.oct");
octave:2> cellfun (@(x) x(:), {});
error: caught execution error in library function

If the cellfun call is changed to use "_x" as the lambda argument instead, it works fine. Or if I create a simple oct-file and compile it as x.oct, the error goes away also. I'm not sure what the interaction going on beyond this point is.

Mike Miller <mtmiller>
Project Administrator
Tue 16 Sep 2014 07:40:41 PM UTC, original submission:  

Title says it all: here's a terminal session to demonstrate:

hutch@hutchX1:~/src/octave$ octave
GNU Octave, version 3.8.1
Copyright (C) 2014 John W. Eaton and others.
This is free software; see the source code for copying conditions.
FITNESS FOR A PARTICULAR PURPOSE.  For details, type 'warranty'.

Octave was configured for "x86_64-pc-linux-gnu".

Additional information about Octave is available at http://www.octave.org.

Please contribute if you find this software useful.
For more information, visit http://www.octave.org/get-involved.html

Read http://www.octave.org/bugs.html to learn how to submit bug reports.
For information about changes from previous versions, type 'news'.

octave:1> x=1:20; plot(x)
octave:2> quit

hutch@hutchX1:~/src/octave$ touch x.oct
hutch@hutchX1:~/src/octave$ octave -q
octave:1> x=1:20; plot(x)
error: caught execution error in library function
error: called from:
error:   /usr/share/octave/3.8.1/m/plot/draw/private/__line__.m at line 116, column 21
error:   /usr/share/octave/3.8.1/m/plot/draw/line.m at line 54, column 8
error:   /usr/share/octave/3.8.1/m/plot/draw/private/__plt__.m at line 497, column 10
error:   /usr/share/octave/3.8.1/m/plot/draw/private/__plt__.m at line 243, column 14
error:   /usr/share/octave/3.8.1/m/plot/draw/private/__plt__.m at line 202, column 10
error:   /usr/share/octave/3.8.1/m/plot/draw/private/__plt__.m at line 118, column 17
error:   /usr/share/octave/3.8.1/m/plot/draw/plot.m at line 220, column 10
octave:1> quit



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


   bug dependencies.

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by ihutch (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-12-08 rik5 Open/ClosedOpen => Closed
    2015-11-25 rik5 StatusConfirmed => Works For Me
    2014-09-25 mtmiller Dependencies- => Depends on bugs #43299
    2014-09-16 mtmiller CategoryPlotting => Interpreter
        Item GroupSegfault, Bus Error, etc. => Incorrect Result
        StatusNone => Confirmed
        SummaryPlotting crashes if a file "x.oct" exists in the current directory => line plot fails if a file "x.oct" exists in the current directory

    Back to the top

    Powered by Savane 3.5