[Fusionforge-commits] FusionForge branch Branch_5_1 updated. deb656eb52310014ac9fa2cacd7df95fa1c4cf42

Thorsten Glaser mirabilos at fusionforge.org
Mon Feb 25 10:55:01 CET 2013

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, Branch_5_1 has been updated
       via  deb656eb52310014ac9fa2cacd7df95fa1c4cf42 (commit)
       via  744c38f3778c49337fe832c1cba62726da5ddfe6 (commit)
      from  2483d99502a80cecd6086421438ad56028b2b9c6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit deb656eb52310014ac9fa2cacd7df95fa1c4cf42
Merge: 744c38f 2483d99
Author: Thorsten Glaser <tg at mirbsd.org>
Date:   Mon Feb 25 10:54:54 2013 +0100

    Merge branch 'Branch_5_1' of git+ssh://scm.fusionforge.org//var/lib/gforge/chroot/scmrepos/git/fusionforge/fusionforge into Branch_5_1

commit 744c38f3778c49337fe832c1cba62726da5ddfe6
Author: Thorsten Glaser <tg at mirbsd.org>
Date:   Mon Feb 25 10:53:21 2013 +0100

    handle case where $main_repo already exists but is no git repo
    (there’s still two things: mktemp -d might fail, in which case
    we regress to the previous behaviour, and after the check the
    $main_repo can come to exist before the mv, with the same outcome,
    but since we do check the return value of the mv…)

diff --git a/src/plugins/scmgit/common/GitPlugin.class.php b/src/plugins/scmgit/common/GitPlugin.class.php
index ee96605..a8f9544 100644
--- a/src/plugins/scmgit/common/GitPlugin.class.php
+++ b/src/plugins/scmgit/common/GitPlugin.class.php
@@ -351,6 +351,14 @@ class GitPlugin extends SCMPlugin {
 				system ("chmod -R g+wX,o-rwx $tmp_repo") ;
 			$ret = true;
+			/*
+			 * $main_repo can already exist, for example if it’s
+			 * not a directory or doesn’t contain a HEAD file or
+			 * an objects or refs subdirectory… move it out of
+			 * the way in these cases
+			 */
+			system("if test -e $main_repo || test -h $main_repo; then d=\$(mktemp -d $main_repo.scmgit-moved.XXXXXXXXXX) && mv -f $main_repo \$d/; fi");
+			/* here’s still a TOCTOU but we check $ret below */
 			system("mv $tmp_repo $main_repo", $ret);
 			if (!$ret) {
 				return false;


Summary of changes:
 src/plugins/scmgit/common/GitPlugin.class.php |    8 ++++++++
 1 file changed, 8 insertions(+)


More information about the Fusionforge-commits mailing list