From 01df259f3371552d02cff211bf9f24c578138cfb Mon Sep 17 00:00:00 2001
From: Gergely Imreh <imrehg@gmail.com>
Date: Sat, 14 Feb 2009 00:18:26 +0800
Subject: [PATCH 1/2] Fix: FS#13189, infinite variable replacement cycle

Lines such as foo=$foo in the PKGBUILD would end up in a
infinite replacement cycle when uploaded, thus the upload
times out. In these kind of lines, $foo is replaced not by
"$foo" again, but deleted (missing value for foo).
---
 web/html/pkgsubmit.php |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php
index 09f98e8..3913e69 100644
--- a/web/html/pkgsubmit.php
+++ b/web/html/pkgsubmit.php
@@ -205,7 +205,11 @@ if ($_COOKIE["AURSID"]):
 				while (preg_match($pattern_var,$v,$regs)) {
 					$pieces = explode(" ",$pkgbuild["$regs[2]"],2);
 					$pattern = '/\$'.$regs[1].$regs[2].$regs[3].'/';
-					$replacement = $pieces[0];
+					if ($regs[2] != $k) {
+						$replacement = $pieces[0];
+					} else {
+						$replacement = "";
+					}
 					$v=preg_replace($pattern, $replacement, $v);
 				}
 				$new_pkgbuild[$k] = $v;
-- 
1.6.1.3

