bugGNU Octave - Bugs: bug #61338, mkdir silent on recreating...

 
 

bug #61338: mkdir silent on recreating existing directory

Submitter:  None
Submitted:  Wed 13 Oct 2021 01:42:15 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Missed Error or Warning
Status:  Fixed Assigned to:  None
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * dev
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 13 Oct 2021 03:06:23 PM UTC, comment #1: 

Confirmed.

The issue seems to be that Matlab is trying very hard for Matlab compatibility here.  In the C++ function that is called by mkdir.m and does the real work I find


  if (fs && fs.is_dir ())
    {
      // For Matlab compatibility, return true when directory already exists.
      return ovl (true, "directory exists", "mkdir");
    }


I tested with Matlab and it allows


mkdir foo
mkdir foo
mkdir foo


repeatedly.  Matlab does issue a warning in this case, rather than an error.  I changed Octave to do the same thing in this changeset (http://hg.savannah.gnu.org/hgweb/octave/rev/120e878f343f).

Marking as fixed and closing report.

Rik <rik5>
Group administrator
Wed 13 Oct 2021 01:42:15 PM UTC, original submission:  

The command "mkdir foo" at the Octave command prompt misses an error if the directory foo already exists. The function form of mkdir returns the error correctly but the error is not printed in the command form. The return status is also 1 even if the error message is set to "directory exists". This is on Octave 7.


>> [a,b,c] = mkdir ("foo")
a = 1
b =
c =
>> [a,b,c] = mkdir ("foo")
a = 1
b = directory exists
c = mkdir
>> mkdir foo
>> mkdir foo
>>


Anonymous

 

(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 rik5 (Posted a comment)
  •  

    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
    2021-10-13 rik5 StatusNone Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-aa77.
    Corresponding source code