From f3a29356c51d2b1a56e0122f58385e7d36f9975a Mon Sep 17 00:00:00 2001 From: Gergely Imreh Date: Mon, 16 Feb 2009 11:56:23 -0500 Subject: Correct comment removal in pkgsubmit.php This only neutralises bash parameter substitution, but doesn't perform the proper replacement. Closes FS#13122. Signed-off-by: Loui Chang --- web/html/pkgsubmit.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php index 3913e697..4e106083 100644 --- a/web/html/pkgsubmit.php +++ b/web/html/pkgsubmit.php @@ -66,13 +66,12 @@ if ($_COOKIE["AURSID"]): # TODO: This needs to be completely rewritten to support stuff like arrays # and variable substitution among other things. if (!$error) { - # process PKGBIULD - remove line concatenation + # process PKGBUILD - remove line concatenation # $pkgbuild = array(); $fp = fopen($pkg_dir."/PKGBUILD", "r"); $line_no = 0; $lines = array(); - $decomment = array(); $continuation_line = 0; $current_line = ""; $paren_depth = 0; @@ -89,8 +88,6 @@ if ($_COOKIE["AURSID"]): # assumed continuation # continue appending onto existing line_no # - $decomment = explode("#",$line,2); - $line = $decomment[0]; $current_line .= $line . " "; $continuation_line = 1; } else { @@ -119,6 +116,12 @@ if ($_COOKIE["AURSID"]): # $seen_build_function = 0; while (list($k, $line) = each($lines)) { + # Neutralize parameter substitution + $line = preg_replace('/\${(\w+)#(\w*)}?/', '$1$2', $line); + + # Remove comments + $line = preg_replace('/#.*/', '', $line); + $lparts = explode("=", $line, 2); if (count($lparts) == 2) { # this is a variable/value pair, strip out -- cgit v1.2.3-24-g4f1b