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

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

[Octave-bug-tracker] [bug #63265] rmdir fails to remove directory contai


From: Markus Mützel
Subject: [Octave-bug-tracker] [bug #63265] rmdir fails to remove directory containing read-only files
Date: Sat, 29 Oct 2022 13:15:47 -0400 (EDT)

Follow-up Comment #17, bug #63265 (project octave):

A directory cannot be removed unless it is empty (on no platform I know of).
See, e.g, [1] for the documentation of the system function `rmdir` in
Windows.

Matlab's `rmdir` with the 's' parameter removes directories even if they are
not empty. To be compatible, we need to recursively delete any files or
folders inside the directory before deleting it.
*How* that is done is an implementation detail, and a user shouldn't need to
worry about that. We are using the system function "unlink" because that works
on "normal files", hard links and symbolic links. It has also the advantage
that this function exists cross-platform.

We already established that we need to change the Octave function `rmdir` with
the 's' parameter to also remove any read-only files to be Matlab-compatible.
How *that* will be done, will also be an implementation detail. One way that
would allow us to continue using the system function "unlink" is to remove the
read-only attribute if necessary so that "unlink" can delete the file.

I'm not sure which other function you are hinting at. If you have any concrete
pointers, please let us know.

[1]:
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/rmdir-wrmdir?view=msvc-170


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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