bugGNU Octave - Bugs: bug #41505, Cannot save to stdout

 
 

bug #41505: Cannot save to stdout

Submitter:  David Spies <dspyz>
Submitted:  Fri 07 Feb 2014 08:12:13 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 3.8.0 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sun 09 Feb 2014 11:22:17 PM UTC, comment #13: 
Mike Miller <mtmiller>
Group Member
Sun 09 Feb 2014 10:50:50 PM UTC, comment #12: 

Alright, then why don't you go ahead and apply the patch to stable and clear up the regression.

Rik <rik5>
Group administrator
Sun 09 Feb 2014 08:45:10 PM UTC, comment #11: 

That oddball case doesn't seem to be a regression, while "save -" was. Going back to 3.4.3 and 3.6.4, "save - x" fails with the same error in both versions.

I guess this error is because the minus is being interpreted as a binary operator with "save ()" as the first argument? There's probably nothing we could do about this without recognizing it as a special case in the parser right?


octave:1> x = 5;
octave:2> save - x
error: Invalid call to save.  Correct usage is:
[...]
octave:2> save = 10;
octave:3> save - x
ans =  5


Mike Miller <mtmiller>
Group Member
Sun 09 Feb 2014 08:20:06 PM UTC, comment #10: 

Seems suitable for stable.  I applied your patch and there is still one oddball case that isn't covered.


x = [1 2 3 4];
save - x
error: Invalid call to save.  Correct usage is:

 -- Command:  save file
 -- Command:  save options file
 -- Command:  save options file V1 V2 ...
 -- Command:  save options file -struct STRUCT F1 F2 ...


It works if you use the function form of save() or add an option


save ("-", "x")
save -text - x


Rik <rik5>
Group administrator
Sat 08 Feb 2014 11:10:23 PM UTC, comment #9: 

Attached diff fixes this problem for me. Would this be suitable for stable?

(file #30491)

Mike Miller <mtmiller>
Group Member
Sat 08 Feb 2014 10:18:59 PM UTC, comment #8: 

I checked the Mercurial log on load-save.cc and I don't see anything which seems to suggest a purposeful removal of this feature.  There are several candidate changesets which might have caused this as the input processing was heavily reworked to get Matlab compatibility.

Rik <rik5>
Group administrator
Sat 08 Feb 2014 10:17:04 PM UTC, comment #7: 

I have not bisected or tested to be sure, but it looks to me like a side effect of this changeset that was made to fix bug #37502:

http://hg.savannah.gnu.org/hgweb/octave/rev/e05eafe7105a

So perhaps simply enhancing that test will restore the ability to save to "-" as file name.

Mike Miller <mtmiller>
Group Member
Sat 08 Feb 2014 05:28:32 PM UTC, comment #6: 

What changeset removed the feature and was there some justification for it, or was it accidental?

John W. Eaton <jwe>
Group administrator
Sat 08 Feb 2014 05:08:34 PM UTC, comment #5: 

The /dev/stdout option seems to do the same thing, so I guess I can do it that way as well.

Although load -text /dev/stdin

causes

error: load: unable to find file /dev/stdin

so can you leave in the (already working) option to load from stdin using - (despite the asymmetry this causes?)

David Spies <dspyz>
Sat 08 Feb 2014 04:32:44 AM UTC, comment #4: 

Is this feature particularly valuable?  It doesn't appear that Matlab supports this, and it seems like we should just change the documentation to eliminate this option.

Rik <rik5>
Group administrator
Fri 07 Feb 2014 08:44:18 PM UTC, comment #3: 

I see the docstring does indicate that this should work, and indeed it does work for me in version 3.6.4 but not in 3.8.0. Marking as a regression against version 3.8.0

In the meantime, if you need a way to do this, try


save -text /dev/stdout


Mike Miller <mtmiller>
Group Member
Fri 07 Feb 2014 08:19:53 PM UTC, comment #2: 

That just creates a file called 'a' and saves it there

David Spies <dspyz>
Fri 07 Feb 2014 08:14:14 PM UTC, comment #1: 

try save  a

Doug Stewart <dastew>
Fri 07 Feb 2014 08:12:13 PM UTC, original submission:  

octave:1> a = [1,2,3,4];
octave:2> save -text -
error: save: Unrecognized option '-'

David Spies <dspyz>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #30491:  stdout.diff added by mtmiller (412B - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by dastew (Posted a comment)
  • -email is unavailable- added by dspyz (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 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-02-09 mtmiller StatusPatch Submitted Fixed
        Open/ClosedOpen Closed
    2014-02-08 mtmiller Attached File- Added stdout.diff, #30491
        StatusConfirmed Patch Submitted
    2014-02-07 mtmiller Item GroupNone Regression
        StatusNone Confirmed
        Releasedev 3.8.0

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code