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).

Signed-off-by: Loui Chang <louipc.ist@gmail.com>
This commit is contained in:
Gergely Imreh 2009-02-14 00:18:26 +08:00 committed by Loui Chang
parent 0caa949e41
commit efc1713787

View file

@ -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;