bugGNU Octave - Bugs: bug #53951, Exit status after error running...

 
 

bug #53951: Exit status after error running file from command line

Submitter:  Jenny Harlow <jennyh>
Submitted:  Sun 20 May 2018 06:16:51 PM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Missed Error or Warning
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 4.2.1 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 20 May 2018 09:39:07 PM UTC, comment #1: 

Thank you for your detailed bug report about this issue. This was indeed an issue with both --eval and script files in Octave 4.2. Fortunately this has already been fixed in the latest release Octave 4.4, for both --eval and a script file argument.

I have started a small independent regression test project to make sure Octave command line syntax continues to work as expected, feel free to submit ideas for additional test cases: https://github.com/mtmiller/octave-test-suite

Mike Miller <mtmiller>
Group Member
Sun 20 May 2018 06:16:51 PM UTC, original submission:  

There seems to be a change between 4.0.0 and 4.2.1 in how the exit status reflects a runtime error when running a code (.m) file from the command line.  Running the same (flawed) code from a file in 4.0.0 I get a non-zero exit status but using 4.2.1 I get a zero exit status. 

Example
Given a file blah.m containing


x = y;
disp(x);


the bash command


if octave --silent blah.m; then echo 'OK'; else  echo 'Failed'; fi


outputs


error: 'y' undefined near line 1 column 5
error: execution exception in blah.m
OK


(ie, OK means zero exit status).

With Octave 4.0.0 the output is instead


error: 'y' undefined near line 1 column 5
error: called from
    blah.m at line 1 column 3
Failed


(ie, non-zero exit status)

Comments
It seems very similar to the issue in 4.2.0 using --eval
http://octave.1599824.n4.nabble.com/Octave-s-exit-status-td4680966.html

which was fixed in 4.2.1.  With that fix in 4.2.1, I get a non-zero exit status if I run the flawed code above directly from the command line using the --eval code option, compared to the zero exit status when I run from the file, which seems a bit inconsistent.

The same behaviour applies with a parse error rather than a runtime error.

Apologies if this has already been reported.  I have not posted here before so this is a bit daunting but I have looked through the bug reports and cannot find anything that looks like this issue.  Also apologies if this differentiation between command line results using file and --eval code is a 4.2.1 feature rather than a bug.

Jenny Harlow <jennyh>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-05-20 mtmiller StatusNone Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code