tj_thompson has asked for the wisdom of the Perl Monks concerning the following question:
I'm writing some code around SVN::Client. During testing, I'd like to be able to create and delete working copies. However, I find that once I've created a working copy I am unable to cleanly delete that working copy without ending the process that created the working copy.
Here's some code that produces the warning:
use strict; use warnings; use SVN::Client; use File::Path qw(rmtree); my $repo = 'file:///nfs/pdx/disks/mdo_cttr_prod/dev/tmp/repo_test/repo +1'; my $path = '/nfs/pdx/disks/mdo_cttr_prod/dev/tmp/repo_test/wc1'; my $client = new SVN::Client( auth => [ SVN::Client::get_username_provider() ], ); # checkout a working copy my $rev = $client->checkout( $repo, $path, 'HEAD', 0 ); # eliminate the client $client = undef; # attempt to remove wc # this produces the warning for being unable to remove directory rmtree $path;
This is on Linux and this is the generated warnings:
cannot remove directory for /nfs/pdx/disks/mdo_cttr_prod/dev/tmp/repo_ +test/wc1/.svn: Directory not empty at tmp.pl line 21. cannot remove directory for /nfs/pdx/disks/mdo_cttr_prod/dev/tmp/repo_ +test/wc1: Directory not empty at tmp.pl line 21.
The problem seems to be due to this .nfs file:
plxcf4060> ls -alrt wc1/.svn total 132 -rw-r----- 1 rptrdev rptrusrs 122880 Oct 6 10:54 .nfs000000000711c5da +000000c9 drwxr-s--- 2 rptrdev rptrusrs 4096 Oct 6 10:54 . drwxr-s--- 3 rptrdev rptrusrs 4096 Oct 6 10:54 ..
Despite having undefined the client, this lock file seems to be left behind and I'm uncertain as to how to release it.
I have this comment from some old code I wrote that seems to summarize the issue. I have been unfortunately unable to dig up my source on this comment to research further (and I can't even be certain as to the accuracy of the information contained in comment)
# Currently, the below code is unable to release the sqlite # database file used to store data because SVN::Client module has # no perl code for releasing the lock it aquires on the .svn # working copy db.wc file. In order to accomplish this, it seems # that svn_wc_context_destroy must be called. This seems to be # built into the XS code written for the perl bindings, but there # does not seem to be a perl binding written to utilize it. Until # this is resolved, the only way to release the lock on the # database file is to terminate the process that acquired it.
Any ideas on how to release this working copy properly so it can be deleted between tests?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: SVN::Client -- deleting created working copy results in 'cannot remove directory'
by BrowserUk (Patriarch) on Oct 06, 2016 at 20:08 UTC | |
by tj_thompson (Monk) on Oct 06, 2016 at 21:13 UTC |