octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #54636] path is not be reinitialized if a clas


From: Adam Dodd
Subject: [Octave-bug-tracker] [bug #54636] path is not be reinitialized if a class directory is modified
Date: Sun, 9 Sep 2018 12:30:56 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36

URL:
  <https://savannah.gnu.org/bugs/?54636>

                 Summary: path is not be reinitialized if a class directory is
modified
                 Project: GNU Octave
            Submitted by: adamd1008
            Submitted on: Sun 09 Sep 2018 04:30:55 PM UTC
                Category: Interpreter
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Other
                  Status: None
             Assigned to: None
         Originator Name: Adam Dodd
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.4.1
        Operating System: Any

    _______________________________________________________

Details:

Octave has a bug where removal of a class function script file will cause a
"no such file" error to be thrown.

Please note that the attached patch fixes this bug as well as bug #46282. It
incorporates a fix to bug #46281 and #53856 committed in changeset
25374:c8f49ee7a687.

To reproduce, I used the current head of the Mercurial repo:


address@hidden octave-hg2]$ hg summary
parent: 25869:462066384af3 tip
 fix minimum size of console widget in gui (bug54620)
<snip>


Do the following:


address@hidden ~]$ cd `mktemp -d`
address@hidden tmp.SxVxOnqAot]$ mkdir @myobj
address@hidden tmp.SxVxOnqAot]$ mkdir @myobj
address@hidden tmp.SxVxOnqAot]$ cat > @myobj/myobj.m
function c = myobj(arg = "hi")
    s.arg = arg;
    c = class(s, "myobj");
end
address@hidden tmp.SxVxOnqAot]$ cat > @myobj/display.m
function display(obj)
    printf("%s = <arg = \"%s\">\n", inputname(1), obj.arg);
end
address@hidden tmp.SxVxOnqAot]$ /opt/dbg-octave2/bin/octave-cli
GNU Octave, version 5.0.0
<snip>
octave:1> o = myobj()
o = <arg = "hi">


Now, using another terminal:


address@hidden tmp.SxVxOnqAot]$ mv @myobj/display.m{,.bck}


Returning to Octave terminal:


octave:2> o = myobj()
error: no such file, '/tmp/tmp.SxVxOnqAot/@myobj/display.m'


A similar approach can be taken to reproduce bug #46282. Foo/bar example taken
from that bug.


octave:1> Foo.bar
Hello from Foo.bar
octave:2> Foo.bar
error: no such file, '/tmp/tmp.SxVxOnqAot/+Foo/bar.m'


The issue is that load_path::dir_info::update checks the top directory's
timestamp (in this case /tmp/tmp.SxVxOnqAot), when it's the @myobj or +Foo
folder which has its timestamp updated.

My patch fixes these:


octave:1> o = myobj()
o = <arg = "hi">
octave:2> o = myobj()
o =

  <class myobj>

octave:3> o = myobj()
o = <arg = "hi">
octave:4> Foo.bar
Hello from Foo.bar
octave:5> Foo.bar
error: member `bar' in package `Foo' does not exist
octave:5> Foo.bar
Hello from Foo.bar


In each case, I renamed the file for the second call and reinstated it for the
third.



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Sun 09 Sep 2018 04:30:55 PM UTC  Name: mypatch.patch  Size: 4KiB   By:
adamd1008
Patch file
<http://savannah.gnu.org/bugs/download.php?file_id=44960>

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?54636>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]