octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #63803] Saving causes OOM, crash, and loss of


From: Markus Mützel
Subject: [Octave-bug-tracker] [bug #63803] Saving causes OOM, crash, and loss of already saved data
Date: Sat, 6 May 2023 11:02:49 -0400 (EDT)

Follow-up Comment #38, bug #63803 (project octave):

I started up my Ubuntu machine and ran the following tests for completeness:

>> mkdir file1
>> mkdir file2
>> rename file1 file2
>> mkdir file1
>> fid = fopen('file1/a', 'w'); fclose(fid);
>> fid = fopen('file2/b', 'w'); fclose(fid);
>> rename file1 file2
error: rename: operation failed: Directory not empty


Tbh, the behavior of `std::rename` on Windows seems to be a lot more
consistent than its behavior on Linux.

On Windows, the behavior is: Fail if the target already exists. Point.

On Linux, the behavior seems to be:
If the source is a regular file and the target is a regular file, overwrite
the target.
If the source is a regular file and the target is a folder, fail.
If the source is a folder and the target is a regular file, fail.
If the source is a folder and the target is an empty folder, overwrite the
target.
If the source is a folder and the target is a non-empty folder, fail.

While there might be a motivation to this mess, it still looks like a mess to
me...

Imho, a reasonable compromise to implement a common behavior across platforms
for Octave might be:
If the source is a regular file and the target is a regular file, overwrite
the target.
In all other cases where a target already exists, fail.

It would cover the issue here while keeping the logic still pretty straight.



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?63803>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]