bugGNU Octave - Bugs: bug #35318, Unclear precedence between --eval,...

 
 

bug #35318: Unclear precedence between --eval, script file, and stdin

Submitted by:  Muhali <muhali>
Submitted on:  Mon 16 Jan 2012 07:40:16 PM UTC  
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Documentation
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  Closed
Release:  dev 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)

Sun 04 Jan 2015 03:19:51 AM UTC, comment #12: 

Well, one thing that would be easy would be to add the .NOTPARALLEL directive to Makefile.am in doc/interpreter.  This forces the directory in question to be built with the equivalent of 'make -j1'. 

Rik <rik5>
Project Administrator
Sat 03 Jan 2015 05:53:05 PM UTC, comment #11: 

Andreas' analysis is certainly correct.  I put in some printf statements to stderr and in a group of make subprocesses spawned at the same time only one of the instances has isatty true.  This could be because isatty is not re-entrant, or it could be that stdin isn't getting dup'ed to the child processes, or there is a race condition.

In any case, I don't think many people try to invoke octave with both a redirect and an --eval or script file.  I don't want to spend more time on this bug than it is worth so I simply took out the tests in this cset (http://hg.savannah.gnu.org/hgweb/octave/rev/65f4d9e1206c).

Rik <rik5>
Project Administrator
Sat 03 Jan 2015 03:58:14 PM UTC, comment #10: 

It's described here: https://www.gnu.org/software/make/manual/html_node/Parallel-Input.html#Parallel-Input

We should somehow check for the "broken pipe" condition.

Andreas Weber <andy1978>
Project Member
Sat 03 Jan 2015 03:25:55 PM UTC, comment #9: 

@Andy: Yes I was parallel building using "make -j4", and I can confirm using "make" lets the doc build as expected.

I also can confirm that running your "Makefile_check" with two jobs triggers the error in the second job:

Pantxo Diribarne <pantxo>
Project Member
Sat 03 Jan 2015 02:18:09 PM UTC, comment #8: 

I made some checks

bool redir_input = ! gnulib::isatty (fileno (stdin));

when run from "make -j3" with multiple independent targets returns one false, two true.

Run attached Makefile with "make -j2 -f Makefile_check" to trigger the bug.

(file #32752)

Andreas Weber <andy1978>
Project Member
Sat 03 Jan 2015 01:51:08 PM UTC, comment #7: 

@Pantxo: You were parallel building with "make -j4" or something, right?

I can see this too but only with parallel build. Is it possible that

+verbatim
bool stdin_is_tty = gnulib::isatty (fileno (stdin));
-verbatim-

returns false if called from make during a parallel build?

Andreas Weber <andy1978>
Project Member
Sat 03 Jan 2015 11:38:23 AM UTC, comment #6: 

Hi,

I can't build the doc anymore:

Making all in interpreter
make[3]: entrant dans le répertoire « /media/pantxo/dev/octavebuild/doc/interpreter »
../../run-octave -f -q -H -p ../../../octaveclone/doc/interpreter --eval "genpropdoc ('axes', 'plot-axesproperties.texi');" || { rm -f plot-axesproperties.texi; exit 1; }
../../run-octave -f -q -H -p ../../../octaveclone/doc/interpreter --eval "genpropdoc ('figure', 'plot-figureproperties.texi');" || { rm -f plot-figureproperties.texi; exit 1; }
../../run-octave -f -q -H -p ../../../octaveclone/doc/interpreter --eval "genpropdoc ('image', 'plot-imageproperties.texi');" || { rm -f plot-imageproperties.texi; exit 1; }
../../run-octave -f -q -H -p ../../../octaveclone/doc/interpreter --eval "genpropdoc ('patch', 'plot-patchproperties.texi');" || { rm -f plot-patchproperties.texi; exit 1; }
error: --eval "CODE" and '< script' are mutually exclusive options

@Rik: I suppose this is due to your last changeset. Do you have an idea how should the command line call to "run-octave" be tweaked in order to have it work again?

Pantxo Diribarne <pantxo>
Project Member
Sat 03 Jan 2015 02:19:25 AM UTC, comment #5: 

I made the 3 options of --eval CODE, script file, and '< script' mutually exclusive in this changeset (http://hg.savannah.gnu.org/hgweb/octave/rev/18377fc879d0).  Closing report.

Rik <rik5>
Project Administrator
Sat 20 Apr 2013 08:29:44 PM UTC, comment #4: 

Changing status and retitling for clarity.

Mike Miller <mtmiller>
Project Administrator
Wed 11 Apr 2012 06:29:22 PM UTC, comment #3: 

Okay.  I see the issue now.  I think it would be clearer if --eval and supplying a file or raw code on stdin were mutually exclusive options.  I'll take a look at that.

Rik <rik5>
Project Administrator
Wed 11 Apr 2012 05:15:17 PM UTC, comment #2: 

no change (using current tip of April 11).

Note that this is not about staying in octave or not, but about whether 'disp(e)' is executed.

Muhali <muhali>
Wed 11 Apr 2012 06:46:07 AM UTC, comment #1: 

This works for me.  I tested both versions in both Bourne sh and in tcsh and they exit without staying in Octave.  This is for a recent tip (4/10/12).

Could you reverify that this behavior still exists for you?  Also, to make sure it is nothing in your .octaverc try adding '-f' to the command line so it reads

octave -f -q --eval 'x=1;' foo.m

Rik <rik5>
Project Administrator
Mon 16 Jan 2012 07:40:16 PM UTC, original submission:  

The help on command line options has

`--eval CODE'
     Evaluate CODE and exit when done unless `--persist' is also
     specified.

but octave does not exit when invoked with a script file, such as

# foo.m
disp(e) ;

It does exit when the script is invoked from stdin:

%> octave -q --eval 'x=1;' foo.m
2.72
%> octave -q --eval 'x=1;' < foo.m
%>

I suggest a phrase like 'and exit if FILE is empty' as help text.

Muhali <muhali>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #32752:  Makefile_check added by andy1978 (372B - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by andy1978 (Posted a comment)
  • -email is unavailable- added by pantxo (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by muhali (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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-01-03 andy1978 Attached File- => Added Makefile_check, #32752
    2015-01-03 rik5 StatusConfirmed => Fixed
        Open/ClosedOpen => Closed
    2013-04-20 mtmiller StatusWorks For Me => Confirmed
        Summaryexit octave after --eval CODE ? => Unclear precedence between --eval, script file, and stdin
    2012-04-11 rik5 StatusNone => Works For Me

    Back to the top


    Powered by Savane 3.5