[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [ISSUE] Cancelling svn checkout leaves an open file handle

From: Daniel Sahlberg <daniel.l.sahlberg_at_gmail.com>
Date: Wed, 9 Sep 2020 10:48:16 +0200

Den ons 9 sep. 2020 kl 10:38 skrev Uroš Jovanović <urosh3d_at_gmail.com>:

> Hi Nathan,
> Hi Daniel,
>
> Thank you both for your replies.
>
> As a workaround I ended up doing exactly the things you mentioned. After
> the cancellation of the operation I call additional code to "cleanup".
> This code goes through open file handles held by the current process and
> closes the ones left over in .svn\tmp.
>
> That being said, I don't know how easy/hard this is to do on Linux, but
> doing this kind of stuff on Windows is a giant pain in the a**.
> It involves calling a bunch of poorly documented, low-level native methods
> from Windows' internal api.
>
> Luckily, I found some code online and modified it in order to work on both
> 32 and 64 bit apps.
> For reference, you can find this code on my github
> <https://github.com/urosjovanovic/MceController/blob/master/VmcServices/DetectOpenFiles.cs>
> .
>

GREAT, you just saved me a couple of hours of work to dig up the APIs.

>
> So the final process is as follows:
>
> 1. Perform checkout
> 2. Cancel checkout
> 3. If present, force-close the open file handle in .svn\tmp
> 4. Perform a regular svn cleanup to break locks etc.
>
> It works, but now I have an additional ~700 LOC to maintain just in order
> to detect and close those rogue file handles, hoping it will not crash the
> app. :)
>
> If you want, I can provide a test case written in C# using SharpSvn which
> will work exactly as Daniel wrote, but on Windows.
> I can also use the repo of your choice, if you have a preferred one for
> testing.
>

Do you know if SharpSvn is maintained? When I checked your previous test
code it seemed the NuGet package of SharpSvn is based on Subversion 1.9 and
any bugfix will (at maximum) be applied to 1.10 and 1.14. So maybe you are
out of luck even if we find it is a bug in Subversion and fix it.

Regarding test cases I suppose these should be plain C to make sure they
are executable on any platform.

Daniel

>
Received on 2020-09-09 10:48:30 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.