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 <louipc.ist@gmail.com>
This commit is contained in:
Gergely Imreh 2009-02-16 11:56:23 -05:00 committed by Loui Chang
parent efc1713787
commit f3a29356c5

View file

@ -66,13 +66,12 @@ if ($_COOKIE["AURSID"]):
# TODO: This needs to be completely rewritten to support stuff like arrays # TODO: This needs to be completely rewritten to support stuff like arrays
# and variable substitution among other things. # and variable substitution among other things.
if (!$error) { if (!$error) {
# process PKGBIULD - remove line concatenation # process PKGBUILD - remove line concatenation
# #
$pkgbuild = array(); $pkgbuild = array();
$fp = fopen($pkg_dir."/PKGBUILD", "r"); $fp = fopen($pkg_dir."/PKGBUILD", "r");
$line_no = 0; $line_no = 0;
$lines = array(); $lines = array();
$decomment = array();
$continuation_line = 0; $continuation_line = 0;
$current_line = ""; $current_line = "";
$paren_depth = 0; $paren_depth = 0;
@ -89,8 +88,6 @@ if ($_COOKIE["AURSID"]):
# assumed continuation # assumed continuation
# continue appending onto existing line_no # continue appending onto existing line_no
# #
$decomment = explode("#",$line,2);
$line = $decomment[0];
$current_line .= $line . " "; $current_line .= $line . " ";
$continuation_line = 1; $continuation_line = 1;
} else { } else {
@ -119,6 +116,12 @@ if ($_COOKIE["AURSID"]):
# #
$seen_build_function = 0; $seen_build_function = 0;
while (list($k, $line) = each($lines)) { 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); $lparts = explode("=", $line, 2);
if (count($lparts) == 2) { if (count($lparts) == 2) {
# this is a variable/value pair, strip out # this is a variable/value pair, strip out