On Mar 30, 2008, at 1:30 AM, Dmitri A. Sergatskov wrote:
On Sat, Mar 29, 2008 at 11:42 PM, Chris Tandiono
<[EMAIL PROTECTED]> wrote:
When using the run command, the working directory is not the expected
working directory. Should this be changed? I don't really know.

octave-3.0.0:8> pwd
ans = /Users/chris/Desktop
octave-3.0.0:9> run ../checker.m
error: run: file must exist and be a valid Octave script file
error: evaluating if command near line 43, column 2
error: evaluating if command near line 39, column 5
error: evaluating if command near line 38, column 3
error: called from `run' in file `/Applications/Octave.app/Contents/
Resources/share/octave/3.0.0/m/miscellaneous/run.m'
octave-3.0.0:9> cd ..
octave-3.0.0:10> ls
*snip*
checker.m


I think there is a bug in run.m (line 43).
Instead of

        if (! exist (s, "file") ||  ! strcmp (ext, ".m"))

There should be

        if (! exist (f, "file") ||  ! strcmp (ext, ".m"))

Regards,

Dmitri.

p.s. CC to [EMAIL PROTECTED] since run.m is an octave's core function.

I thought I kill some time introducing myself to sed and create a changeset for this trivail change.

The result is attached.

Ben

# HG changeset patch
# User Ben Abbott <[EMAIL PROTECTED]>
# Date 1206890382 14400
# Node ID 5feeb33e65471b2e792463364d97c787babb9e78
# Parent  4fbaba9abec16cc2838a6ec3faaa7aed3b0291de
Fix check for file existence.

diff -r 4fbaba9abec1 -r 5feeb33e6547 ChangeLog
--- a/ChangeLog Fri Mar 28 15:53:09 2008 -0400
+++ b/ChangeLog Sun Mar 30 11:19:42 2008 -0400
@@ -1,3 +1,6 @@ 2008-03-25  Jaroslav Hajek <[EMAIL PROTECTED]
+2008-03-30 Dmitri A. Sergatskov <[EMAIL PROTECTED]>
+       * miscellaneous/run.m: Fix check for existence of file.
+
 2008-03-25  Jaroslav Hajek <[EMAIL PROTECTED]>
 
        * configure.in: Check for expm1 and log1p functions.
diff -r 4fbaba9abec1 -r 5feeb33e6547 scripts/miscellaneous/run.m
--- a/scripts/miscellaneous/run.m       Fri Mar 28 15:53:09 2008 -0400
+++ b/scripts/miscellaneous/run.m       Sun Mar 30 11:19:42 2008 -0400
@@ -40,7 +40,7 @@ function run (s)
       wd = pwd ();
       unwind_protect
        cd (d);
-       if (! exist (s, "file") ||  ! strcmp (ext, ".m"))
+       if (! exist (f, "file") ||  ! strcmp (ext, ".m"))
          error ("run: file must exist and be a valid Octave script file");
        endif
        evalin ("caller", [f, ";"], "rethrow (lasterror ())");




-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to