bugGNU Octave - Bugs: bug #49632, evalc does not capture all of the...

 
 

bug #49632: evalc does not capture all of the stdout stream

Submitter:  Ray Zimmerman <rdzman>
Submitted:  Thu 17 Nov 2016 03:26:55 PM UTC
   
 
Category:  Octave Function Severity:  1 - Wish
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Confirmed Assigned to:  None
Originator Name:  rdzman Open/Closed:  * Open
Release:  * dev Operating System:  * Microsoft Windows
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 17 Nov 2016 08:02:29 PM UTC, comment #3: 

I can call it Matlab compatibility, the bug metadata doesn't really change whether or not someone will be interested or find the time to work on it.

If you are interested in helping to improve evalc and have the ability and time, please consider submitting a patch for this feature.

Mike Miller <mtmiller>
Group Member
Thu 17 Nov 2016 07:57:02 PM UTC, comment #2: 

Matlab does seem to capture everything sent to stdout, at least for the following it does:


evalc('system(''ls -l'')');


And it also captures the output of a GLPK MEX file called from Matlab.

Does that mean this can be re-classified as a bug?

Ray Zimmerman <rdzman>
Thu 17 Nov 2016 06:57:04 PM UTC, comment #1: 

Confirmed, this is because the glpk library writes to the stdout stream directly, which Octave is not currently attempting to capture completely. Octave only captures the output that its functions produce, which is the same as would be captured by the "more" and "diary" functions.

The same occurs if I write a compiled oct file that writes to stdout directly, or run a subprocess that writes to stdout:


>> evalc ("system('ls -l')");
## output of ls is displayed on the terminal anyway

>> saysomething  ## saysomething calls printf to stdout
hello
>> evalc ("saysomething");
hello
## output is still printed on the terminal and not captured



Retagging this as an enhancement that someone might want to work on. I have no idea whether Matlab's evalc captures everything sent to stdout, including library code and subprocesses, or only output from Matlab itself.

Mike Miller <mtmiller>
Group Member
Thu 17 Nov 2016 03:26:55 PM UTC, original submission:  

I use evalc() to attempt to extract the version number of GLPK, using the following line of code ...


str = evalc('glpk(1, 1, 1, 1, 1, ''U'', ''C'', -1, struct(''msglev'', 3))');


However, it prints the following to the console ...


GLPK Simplex Optimizer, v4.60
1 row, 1 column, 1 non-zero
Preprocessing...
~     0: obj =   1.000000000e+00  infeas =  0.000e+00
OPTIMAL SOLUTION FOUND BY LP PREPROCESSOR


... while capturing only the following ...


octave:2> str
str = ans =  1


Identical behavior observed on 4.2.0 on Windows 7 in running in a VM and on 4.2.0-rc4 on macOS Sierra 10.12.1 using a MacPorts build of octave-devel (octave-devel @4.2.0-rc4_0+accelerate+app+docs+fltk+gfortran+graphicsmagick+qt5+sound).

Ray Zimmerman <rdzman>

 

(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 rdzman (Submitted the item)
  • -email is unavailable- added by rdzman
  •  

    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 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-11-17 mtmiller Item GroupFeature Request Matlab Compatibility
    2016-11-17 mtmiller Summaryevalc() not capturing output from glpk() evalc does not capture all of the stdout stream
    2016-11-17 mtmiller Severity3 - Normal 1 - Wish
        Item GroupIncorrect Result Feature Request
        StatusNone Confirmed
        Release4.2.0 dev
    2016-11-17 rdzman Carbon-Copy- Added rdzman

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code