[Fusionforge-commits] FusionForge branch Branch_5_2 updated. 544455f7a0d37c6837c8d97812edfe28310d276e

Roland Mas lolando at fusionforge.org
Wed Feb 27 09:45:02 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_2 has been updated
       via  544455f7a0d37c6837c8d97812edfe28310d276e (commit)
      from  e9f8b71d863ed72e6ae0d5cb2bc09b8798cc1518 (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 544455f7a0d37c6837c8d97812edfe28310d276e
Author: Roland Mas <lolando at debian.org>
Date:   Wed Feb 27 09:44:54 2013 +0100

    Merged from 5.1

diff --git a/src/common/include/utils.php b/src/common/include/utils.php
index 854ccb7..bbeeab2 100644
--- a/src/common/include/utils.php
+++ b/src/common/include/utils.php
@@ -1638,6 +1638,7 @@ function util_create_file_with_contents($path, $contents) {
 	}
 	fwrite($handle, $contents);
 	fclose($handle);
+	return true;
 }
 
 /**
diff --git a/src/plugins/scmgit/common/GitPlugin.class.php b/src/plugins/scmgit/common/GitPlugin.class.php
index 56d9091..1bd055d 100644
--- a/src/plugins/scmgit/common/GitPlugin.class.php
+++ b/src/plugins/scmgit/common/GitPlugin.class.php
@@ -327,7 +327,8 @@ class GitPlugin extends SCMPlugin {
 		}
 
 		$main_repo = $root . '/' .  $project_name . '.git' ;
-		if (!is_file ("$main_repo/HEAD") && !is_dir("$main_repo/objects") && !is_dir("$main_repo/refs")) {
+		if (!is_dir($main_repo) || (!is_file("$main_repo/HEAD") &&
+		    !is_dir("$main_repo/objects") && !is_dir("$main_repo/refs"))) {
 			$tmp_repo = util_mkdtemp('.git', $project_name);
 			if ($tmp_repo == false) {
 				return false;
@@ -359,6 +360,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 != 0) {
 				return false;

-----------------------------------------------------------------------

Summary of changes:
 src/common/include/utils.php                  |    1 +
 src/plugins/scmgit/common/GitPlugin.class.php |   11 ++++++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list