[Pharo-users] Why DirectoryIsNotEmpty on FileReference>>deleteAll ?

Alistair Grant akgrant0710 at gmail.com
Sat Feb 2 13:35:07 EST 2019

Hi Albrecht,

On Fri, 1 Feb 2019 at 19:50, Albrecht Baur via Pharo-users
<pharo-users at lists.pharo.org> wrote:
> I get a DirectoryIsNotEmpty exception on
> FileReference(AbstractFileReference)>>deleteAll.
> But deleteAll is supposed to delete children too. -> So why the exception ?

This is a bug in the FilePlugin.  When deleting directories it is
leaving the deleted directory open.  On Unix this is OK, the entry is
removed from the parent directory and actually deleted when the file
is closed.  I assume that because CIFS is a windows protocol it
doesn't handle it, and leaves the entry there until closed, causing
the problems later on.

The problem can be reduced to the following code:

| root deleteMeFolder |

root := '/path/to/cifs' asFileReference.
deleteMeFolder := root / 'delme'.
deleteMeFolder ensureCreateDirectory.
deleteMeFolder delete.

Then execute:

$ sudo lsof | grep delme

and you'll see the deleted entries.

Issue: https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/368


More information about the Pharo-users mailing list