Why DirectoryIsNotEmpty on FileReference>>deleteAll ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Why DirectoryIsNotEmpty on FileReference>>deleteAll ?

Pharo Smalltalk Users mailing list
I get a DirectoryIsNotEmpty exception on
FileReference(AbstractFileReference)>>deleteAll.

But deleteAll is supposed to delete children too. -> So why the exception ?

I can reproduce it with:

---

| sourceFolder deleteMeFolder numberOfRetries |

sourceFolder := '/network-drive-mounted-via-cifs/delme-tmpl/'.
deleteMeFolder := '/network-drive-mounted-via-cifs/delme/'.

"copy sourceFolder to deleteMeFolder:"
sourceFolder asFileReference copyAllTo: deleteMeFolder asFileReference .

"delete deleteMeFolder again:"
numberOfRetries := 0.
[    deleteMeFolder asFileReference deleteAll ] on: DirectoryIsNotEmpty
do: [:ex|
     (numberOfRetries := numberOfRetries + 1) < 5
         ifTrue: [ ex retry ]    ].
Transcript crLog .
Transcript show: 'Retries: ', numberOfRetries asString .

---

---> numberOfRetries is now = 1 !

BUT: this only happens when sourceFolder and deleteMeFolder are on a
network drive mounted via cifs.

(linux fstab entry like: //host/share /network-drive-mounted-via-cifs/
cifs credentials=...,uid=... 0 0 )

How do I handle such situations when working with the file library on
network drives?

(My "retry on exception" workaround seems hackish to me.)

Thanks,

Albrecht




Reply | Threaded
Open this post in threaded view
|

Re: Why DirectoryIsNotEmpty on FileReference>>deleteAll ?

alistairgrant
Hi Albrecht,

On Fri, 1 Feb 2019 at 19:50, Albrecht Baur via Pharo-users
<[hidden email]> 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

Cheers,
Alistair

Reply | Threaded
Open this post in threaded view
|

Re: Why DirectoryIsNotEmpty on FileReference>>deleteAll ?

alistairgrant
In reply to this post by Pharo Smalltalk Users mailing list
Hi Albrecht,

On Fri, 1 Feb 2019 at 19:50, Albrecht Baur via Pharo-users
<[hidden email]> wrote:
>
> I get a DirectoryIsNotEmpty exception on
> FileReference(AbstractFileReference)>>deleteAll.

Would you please confirm which version of the VM and Pharo you're
using?  (copy the output of System -> System Reporter default page)

Thanks,
Alistair

Reply | Threaded
Open this post in threaded view
|

Re: Why DirectoryIsNotEmpty on FileReference>>deleteAll ?

alistairgrant
Hi Albrecht,

On Tue, 5 Feb 2019 at 15:26, Albrecht Baur <[hidden email]> wrote:
>
> Hi Alistair,
>
> here the system report output:
>
> ...

Thanks for the info.  Please see:

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

Assuming the CI build passes, I'll wait a day or so to give the VM
guys a chance to review the changes and comment before merging.

Cheers,
Alistair

Reply | Threaded
Open this post in threaded view
|

Re: Why DirectoryIsNotEmpty on FileReference>>deleteAll ?

Pharo Smalltalk Users mailing list
thank you! That is good news.

best,

Albrecht

On 06.02.19 09:34, Alistair Grant wrote:

> Hi Albrecht,
>
> On Tue, 5 Feb 2019 at 15:26, Albrecht Baur <[hidden email]> wrote:
>> Hi Alistair,
>>
>> here the system report output:
>>
>> ...
> Thanks for the info.  Please see:
>
> Issue: https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/368
> PR: https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/371
>
> Assuming the CI build passes, I'll wait a day or so to give the VM
> guys a chance to review the changes and comment before merging.
>
> Cheers,
> Alistair
>

Reply | Threaded
Open this post in threaded view
|

Re: Why DirectoryIsNotEmpty on FileReference>>deleteAll ?

alistairgrant
Hi Albrecht,

On Wed, 6 Feb 2019 at 19:51, Albrecht Baur via Pharo-users
<[hidden email]> wrote:
>
> thank you! That is good news.
>
> best,
>
> Albrecht

Would you please download the latest VM and confirm that it resolves the issue:

curl get.pharo.org/64/vmLatest80 | bash

The Pharo 8 VM works with Pharo 7 images.

Thanks,
Alistair


> On 06.02.19 09:34, Alistair Grant wrote:
> > Hi Albrecht,
> >
> > On Tue, 5 Feb 2019 at 15:26, Albrecht Baur <[hidden email]> wrote:
> >> Hi Alistair,
> >>
> >> here the system report output:
> >>
> >> ...
> > Thanks for the info.  Please see:
> >
> > Issue: https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/368
> > PR: https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/371
> >
> > Assuming the CI build passes, I'll wait a day or so to give the VM
> > guys a chance to review the changes and comment before merging.
> >
> > Cheers,
> > Alistair
> >
>

Reply | Threaded
Open this post in threaded view
|

Re: Why DirectoryIsNotEmpty on FileReference>>deleteAll ?

Pharo Smalltalk Users mailing list
Hi Alistair,

I have tested it and works with the latest VM.

thanks,

Albrecht

On 07.02.19 07:56, Alistair Grant wrote:

> Hi Albrecht,
>
> On Wed, 6 Feb 2019 at 19:51, Albrecht Baur via Pharo-users
> <[hidden email]> wrote:
>> thank you! That is good news.
>>
>> best,
>>
>> Albrecht
> Would you please download the latest VM and confirm that it resolves the issue:
>
> curl get.pharo.org/64/vmLatest80 | bash
>
> The Pharo 8 VM works with Pharo 7 images.
>
> Thanks,
> Alistair
>
>
>> On 06.02.19 09:34, Alistair Grant wrote:
>>> Hi Albrecht,
>>>
>>> On Tue, 5 Feb 2019 at 15:26, Albrecht Baur <[hidden email]> wrote:
>>>> Hi Alistair,
>>>>
>>>> here the system report output:
>>>>
>>>> ...
>>> Thanks for the info.  Please see:
>>>
>>> Issue: https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/368
>>> PR: https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/371
>>>
>>> Assuming the CI build passes, I'll wait a day or so to give the VM
>>> guys a chance to review the changes and comment before merging.
>>>
>>> Cheers,
>>> Alistair
>>>

Reply | Threaded
Open this post in threaded view
|

Re: Why DirectoryIsNotEmpty on FileReference>>deleteAll ?

alistairgrant
In reply to this post by alistairgrant
On Thu, 7 Feb 2019 at 09:08, Albrecht Baur <[hidden email]> wrote:
>
> Hi Alistair,
>
> I have tested it and works with the latest VM.

Great, thanks for the confirmation.

Cheers,
Alistair



> thanks,
>
> Albrecht
>
> On 07.02.19 07:56, Alistair Grant wrote:
> > Hi Albrecht,
> >
> > On Wed, 6 Feb 2019 at 19:51, Albrecht Baur via Pharo-users
> > <[hidden email]> wrote:
> >> thank you! That is good news.
> >>
> >> best,
> >>
> >> Albrecht
> > Would you please download the latest VM and confirm that it resolves the issue:
> >
> > curl get.pharo.org/64/vmLatest80 | bash
> >
> > The Pharo 8 VM works with Pharo 7 images.
> >
> > Thanks,
> > Alistair
> >
> >
> >> On 06.02.19 09:34, Alistair Grant wrote:
> >>> Hi Albrecht,
> >>>
> >>> On Tue, 5 Feb 2019 at 15:26, Albrecht Baur <[hidden email]> wrote:
> >>>> Hi Alistair,
> >>>>
> >>>> here the system report output:
> >>>>
> >>>> ...
> >>> Thanks for the info.  Please see:
> >>>
> >>> Issue: https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/368
> >>> PR: https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/371
> >>>
> >>> Assuming the CI build passes, I'll wait a day or so to give the VM
> >>> guys a chance to review the changes and comment before merging.
> >>>
> >>> Cheers,
> >>> Alistair
> >>>

Reply | Threaded
Open this post in threaded view
|

Re: Why DirectoryIsNotEmpty on FileReference>>deleteAll ?

EstebanLM
Means we will need a new stable for Pharo 7/8 ?

Esteban

> On 7 Feb 2019, at 09:23, Alistair Grant <[hidden email]> wrote:
>
> On Thu, 7 Feb 2019 at 09:08, Albrecht Baur <[hidden email]> wrote:
>>
>> Hi Alistair,
>>
>> I have tested it and works with the latest VM.
>
> Great, thanks for the confirmation.
>
> Cheers,
> Alistair
>
>
>
>> thanks,
>>
>> Albrecht
>>
>> On 07.02.19 07:56, Alistair Grant wrote:
>>> Hi Albrecht,
>>>
>>> On Wed, 6 Feb 2019 at 19:51, Albrecht Baur via Pharo-users
>>> <[hidden email]> wrote:
>>>> thank you! That is good news.
>>>>
>>>> best,
>>>>
>>>> Albrecht
>>> Would you please download the latest VM and confirm that it resolves the issue:
>>>
>>> curl get.pharo.org/64/vmLatest80 | bash
>>>
>>> The Pharo 8 VM works with Pharo 7 images.
>>>
>>> Thanks,
>>> Alistair
>>>
>>>
>>>> On 06.02.19 09:34, Alistair Grant wrote:
>>>>> Hi Albrecht,
>>>>>
>>>>> On Tue, 5 Feb 2019 at 15:26, Albrecht Baur <[hidden email]> wrote:
>>>>>> Hi Alistair,
>>>>>>
>>>>>> here the system report output:
>>>>>>
>>>>>> ...
>>>>> Thanks for the info.  Please see:
>>>>>
>>>>> Issue: https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/368
>>>>> PR: https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/371
>>>>>
>>>>> Assuming the CI build passes, I'll wait a day or so to give the VM
>>>>> guys a chance to review the changes and comment before merging.
>>>>>
>>>>> Cheers,
>>>>> Alistair
>>>>>
>


Reply | Threaded
Open this post in threaded view
|

Re: Why DirectoryIsNotEmpty on FileReference>>deleteAll ?

alistairgrant
Hi Esteban,

On Thu, 7 Feb 2019 at 09:41, Esteban Lorenzano <[hidden email]> wrote:
>
> Means we will need a new stable for Pharo 7/8 ?
>
> Esteban

Albrecht will obviously be the one to say how urgent it is for him, or
whether he can get by with vmLatest80.  From my perspective: the issue
has been there "forever" (2010 or earlier) and has only just been
reported.  I expect that we'll eventually update the Pharo 7 VM
anyway, and this can probably wait until then.  Pharo 8 can wait as
well, for the same reasons.

Cheers,
Alistair



> > On 7 Feb 2019, at 09:23, Alistair Grant <[hidden email]> wrote:
> >
> > On Thu, 7 Feb 2019 at 09:08, Albrecht Baur <[hidden email]> wrote:
> >>
> >> Hi Alistair,
> >>
> >> I have tested it and works with the latest VM.
> >
> > Great, thanks for the confirmation.
> >
> > Cheers,
> > Alistair
> >
> >
> >
> >> thanks,
> >>
> >> Albrecht
> >>
> >> On 07.02.19 07:56, Alistair Grant wrote:
> >>> Hi Albrecht,
> >>>
> >>> On Wed, 6 Feb 2019 at 19:51, Albrecht Baur via Pharo-users
> >>> <[hidden email]> wrote:
> >>>> thank you! That is good news.
> >>>>
> >>>> best,
> >>>>
> >>>> Albrecht
> >>> Would you please download the latest VM and confirm that it resolves the issue:
> >>>
> >>> curl get.pharo.org/64/vmLatest80 | bash
> >>>
> >>> The Pharo 8 VM works with Pharo 7 images.
> >>>
> >>> Thanks,
> >>> Alistair
> >>>
> >>>
> >>>> On 06.02.19 09:34, Alistair Grant wrote:
> >>>>> Hi Albrecht,
> >>>>>
> >>>>> On Tue, 5 Feb 2019 at 15:26, Albrecht Baur <[hidden email]> wrote:
> >>>>>> Hi Alistair,
> >>>>>>
> >>>>>> here the system report output:
> >>>>>>
> >>>>>> ...
> >>>>> Thanks for the info.  Please see:
> >>>>>
> >>>>> Issue: https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/368
> >>>>> PR: https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/371
> >>>>>
> >>>>> Assuming the CI build passes, I'll wait a day or so to give the VM
> >>>>> guys a chance to review the changes and comment before merging.
> >>>>>
> >>>>> Cheers,
> >>>>> Alistair
> >>>>>
> >
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Why DirectoryIsNotEmpty on FileReference>>deleteAll ?

Pharo Smalltalk Users mailing list
it is not urgent for me - I have a workaround.

So for me it can wait until the next stable is released.

Albrecht


On 07.02.19 09:58, Alistair Grant wrote:

> Hi Esteban,
>
> On Thu, 7 Feb 2019 at 09:41, Esteban Lorenzano <[hidden email]> wrote:
>> Means we will need a new stable for Pharo 7/8 ?
>>
>> Esteban
> Albrecht will obviously be the one to say how urgent it is for him, or
> whether he can get by with vmLatest80.  From my perspective: the issue
> has been there "forever" (2010 or earlier) and has only just been
> reported.  I expect that we'll eventually update the Pharo 7 VM
> anyway, and this can probably wait until then.  Pharo 8 can wait as
> well, for the same reasons.
>
> Cheers,
> Alistair
>
>
>
>>> On 7 Feb 2019, at 09:23, Alistair Grant <[hidden email]> wrote:
>>>
>>> On Thu, 7 Feb 2019 at 09:08, Albrecht Baur <[hidden email]> wrote:
>>>> Hi Alistair,
>>>>
>>>> I have tested it and works with the latest VM.
>>> Great, thanks for the confirmation.
>>>
>>> Cheers,
>>> Alistair
>>>
>>>
>>>
>>>> thanks,
>>>>
>>>> Albrecht
>>>>
>>>> On 07.02.19 07:56, Alistair Grant wrote:
>>>>> Hi Albrecht,
>>>>>
>>>>> On Wed, 6 Feb 2019 at 19:51, Albrecht Baur via Pharo-users
>>>>> <[hidden email]> wrote:
>>>>>> thank you! That is good news.
>>>>>>
>>>>>> best,
>>>>>>
>>>>>> Albrecht
>>>>> Would you please download the latest VM and confirm that it resolves the issue:
>>>>>
>>>>> curl get.pharo.org/64/vmLatest80 | bash
>>>>>
>>>>> The Pharo 8 VM works with Pharo 7 images.
>>>>>
>>>>> Thanks,
>>>>> Alistair
>>>>>
>>>>>
>>>>>> On 06.02.19 09:34, Alistair Grant wrote:
>>>>>>> Hi Albrecht,
>>>>>>>
>>>>>>> On Tue, 5 Feb 2019 at 15:26, Albrecht Baur <[hidden email]> wrote:
>>>>>>>> Hi Alistair,
>>>>>>>>
>>>>>>>> here the system report output:
>>>>>>>>
>>>>>>>> ...
>>>>>>> Thanks for the info.  Please see:
>>>>>>>
>>>>>>> Issue: https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/368
>>>>>>> PR: https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/371
>>>>>>>
>>>>>>> Assuming the CI build passes, I'll wait a day or so to give the VM
>>>>>>> guys a chance to review the changes and comment before merging.
>>>>>>>
>>>>>>> Cheers,
>>>>>>> Alistair
>>>>>>>
>>