diff options
author | Gergely Imreh <imrehg@gmail.com> | 2009-02-16 11:56:23 -0500 |
---|---|---|
committer | Loui Chang <louipc.ist@gmail.com> | 2009-02-16 11:56:23 -0500 |
commit | f3a29356c51d2b1a56e0122f58385e7d36f9975a (patch) | |
tree | a1d8b0133c206dd242ee970e01493a993b882380 | |
parent | efc171378761b5f18312fe904361be230143e237 (diff) |
Correct comment removal in pkgsubmit.php1.5.6.1
This only neutralises bash parameter substitution, but doesn't perform
the proper replacement.
Closes FS#13122.
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
-rw-r--r-- | web/html/pkgsubmit.php | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php index 3913e69..4e10608 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 |