From 5b01327f5776861980ec3cd923462b5f79db3fa6 Mon Sep 17 00:00:00 2001 From: Gergely Imreh Date: Sun, 11 Jan 2009 11:33:34 +0800 Subject: Fix: FS#12698 - AUR does not ignore comment lines in PKGBUILD source field. The web interface was handling comments in the PKGBUILD variable fields (such as 'source','depends',etc...) differently from makepkg, because makepkg ignores the rest of the current line if there is a # character, while the web interface parsed that as well, and listed the words of the comment as source files. Signed-off-by: Loui Chang --- web/html/pkgsubmit.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php index b4b94d2..9151253 100644 --- a/web/html/pkgsubmit.php +++ b/web/html/pkgsubmit.php @@ -73,6 +73,7 @@ if ($_COOKIE["AURSID"]): $fp = fopen($pkg_dir."/PKGBUILD", "r"); $line_no = 0; $lines = array(); + $decomment = array(); $continuation_line = 0; $current_line = ""; $paren_depth = 0; @@ -89,6 +90,8 @@ 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 { @@ -331,9 +334,11 @@ if ($_COOKIE["AURSID"]): # Insert sources $sources = explode(" ", $new_pkgbuild['source']); foreach ($sources as $src) { - $q = "INSERT INTO PackageSources (PackageID, Source) VALUES ("; - $q .= $pdata["ID"] . ", '" . mysql_real_escape_string($src) . "')"; - db_query($q, $dbh); + if ($src != "" ) { + $q = "INSERT INTO PackageSources (PackageID, Source) VALUES ("; + $q .= $pdata["ID"] . ", '" . mysql_real_escape_string($src) . "')"; + db_query($q, $dbh); + } } header('Location: packages.php?ID=' . $pdata['ID']); @@ -377,9 +382,11 @@ if ($_COOKIE["AURSID"]): # Insert sources $sources = explode(" ", $new_pkgbuild['source']); foreach ($sources as $src) { - $q = "INSERT INTO PackageSources (PackageID, Source) VALUES ("; - $q .= $packageID . ", '" . mysql_real_escape_string($src) . "')"; - db_query($q, $dbh); + if ($src != "" ) { + $q = "INSERT INTO PackageSources (PackageID, Source) VALUES ("; + $q .= $packageID . ", '" . mysql_real_escape_string($src) . "')"; + db_query($q, $dbh); + } } header('Location: packages.php?ID=' . $packageID); -- cgit v1.2.3-54-g00ecf