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

[PATCH] svn_load_dirs.pl: fix broken cleanup

From: Geoffrey Alary <geoffrey.alary_at_gmail.com>
Date: Sat, 20 Jul 2019 01:39:34 +1200

Hi,

When svn_load_dirs.pl is run without the -t option, cleanup on exit
fails with the following error:
"cannot remove path when cwd is
/tmp/svn_load_dirs_ATrGGCJoWv/my_import_wc for
/tmp/svn_load_dirs_ATrGGCJoWv"

The only mention of the bug I have found was at the bottom of this forum post:
https://www.svnforum.org/forum/ubersvn-community/ubersvn-help-and-support/9843-import-snapshot-folders-requesting-step-by-step-guide-for-using-svn_load_dirs-pl?p=49562#post49562

The fix is very simple: change the working directory to the parent of
the directory to remove. Thus we ensure that the cwd is not inside the
path we attempt to remove. This change has no other side effect
because this code only runs just before exiting the program.

Log message:
[[[
Fix broken cleanup in svn_load_dirs.pl.

* contrib/client-side/svn_load_dirs/svn_load_dirs.pl.in (DESTROY):
  Change cwd to the parent of the directory to remove.
]]]

Index: contrib/client-side/svn_load_dirs/svn_load_dirs.pl.in
===================================================================
--- contrib/client-side/svn_load_dirs/svn_load_dirs.pl.in
+++ contrib/client-side/svn_load_dirs/svn_load_dirs.pl.in

@@ -2073,5 +2073,6 @@
 sub DESTROY
 {
   print "Cleaning up $temp_dir\n";
+ chdir( $temp_dir . "/.." );
   File::Path::rmtree([$temp_dir], 0, 0);
 }
Received on 2019-07-19 15:39:36 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.