bugGNU Octave - Bugs: bug #49695, Invalid FID and fopen(FID)

 
 

bug #49695: Invalid FID and fopen(FID)

Submitted by:  Guillaume <gyom>
Submitted on:  Thu 24 Nov 2016 11:15:27 AM UTC  
 
Category: Octave FunctionSeverity: 2 - Minor
Priority: 3 - LowItem Group: Matlab Compatibility
Status: FixedAssigned to: None
Originator Name: GuillaumeOpen/Closed: Closed
Release: devOperating System: Any

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 Jump to the original submission)

Tue 29 Nov 2016 10:05:40 AM UTC, comment #6:

Thanks Rik, it now works as expected!

Guillaume <gyom>
Mon 28 Nov 2016 08:21:42 PM UTC, comment #5:

I checked in a change for this on the development branch (http://hg.savannah.gnu.org/hgweb/octave/rev/b125351d4243). Fixed, closing report.

Rik <rik5>
Project Administrator
Sat 26 Nov 2016 04:13:02 AM UTC, comment #4:

My mistake. I thought you were trying to open a file, not query its status. When simply querying there should be no halt in execution of an Octave script.

Rik <rik5>
Project Administrator
Fri 25 Nov 2016 05:40:08 PM UTC, comment #3:

I think this is probably fair to fix in our implementation of fopen. Since Matlab treats this calling form as a "query any open file descriptor", it makes sense that the user may be looking up an invalid file descriptor to see whether it is open or what file it points to if it is open, and not expecting an error to be raised.

Mike Miller <mtmiller>
Project Administrator
Thu 24 Nov 2016 05:09:56 PM UTC, comment #2:

While I agree with you in spirit, this behavior is explicitly described in the Matlab documentation:

so I wonder if we shouldn't therefore match it nevertheless. I would entirely agree with you if it were for fread or fwrite but this is here a very specific syntax with fopen.

Guillaume <gyom>
Thu 24 Nov 2016 02:42:38 PM UTC, comment #1:

I'm not sure we will implement this. Octave generally tries to validate its inputs much more carefully then Matlab. The idea is to prevent Garbage In/Garbage Out calculations. In this case, by not throwing an error when something has gone wrong Matlab is forcing programmers to spend a lot of time checking return codes. The alternative is not to check return codes, but then the eventual error in the code may be far away from the actual error which was the failure to open the file. This makes things difficult to debug.

Rik <rik5>
Project Administrator
Thu 24 Nov 2016 11:15:27 AM UTC, original submission:

If FID is an invalid handle, fopen(FID) should return an empty string instead of throwing an error, for compatibility with Matlab:

vs

See https://www.mathworks.com/help/matlab/ref/fopen.html#description

Guillaume <gyom>

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by mtmiller (Posted a comment)
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by gyom (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 28 Nov 2016 08:21:42 PM UTCrik5StatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
    Fri 25 Nov 2016 05:40:08 PM UTCmtmillerStatusWont Fix=>Confirmed
    Thu 24 Nov 2016 02:42:38 PM UTCrik5Severity3 - Normal=>2 - Minor
      Priority5 - Normal=>3 - Low
      StatusNone=>Wont Fix

    Back to the top


    Powered by Savane 3.1-cleanup1