[aur-dev] patch: FS#13122 - Comments are parsed during upload
Gergely Imreh
imrehg at gmail.com
Sat May 30 02:40:47 EDT 2009
Hi,
Checking out the FS#13122 bug report (once again), it seems that the
comments weren't removed early enough during package submission. That
caused problem with the bracket matching.
This should solve the issue. I tested with a few commented PKGBUILDs
(and with the ones mentioned in the bug report), and seems to work.
Cheers,
Greg
>From 72ff00dd84902802b43b2dd4859803a3ccc76334 Mon Sep 17 00:00:00 2001
From: Gergely Imreh <imrehg at gmail.com>
Date: Sat, 30 May 2009 14:35:08 +0800
Subject: [PATCH] fix FS#13122 (again): removing comment removal as
early as possible
comments need to be removed before concatenating lines, otherwise
not matched brackets can cause problems on submit
Signed-off-by: Gergely Imreh <imrehg at gmail.com>
---
web/html/pkgsubmit.php | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php
index 383a769..b2c7c0e 100644
--- a/web/html/pkgsubmit.php
+++ b/web/html/pkgsubmit.php
@@ -77,6 +77,9 @@ if ($_COOKIE["AURSID"]):
$paren_depth = 0;
while (!feof($fp)) {
$line = trim(fgets($fp));
+ # Remove comments
+ $line = preg_replace('/\s*#.*/', '', $line);
+
$char_counts = count_chars($line, 0);
$paren_depth += $char_counts[ord('(')] - $char_counts[ord(')')];
if (substr($line, strlen($line)-1) == "\\") {
@@ -119,9 +122,6 @@ if ($_COOKIE["AURSID"]):
# Neutralize parameter substitution
$line = preg_replace('/\${(\w+)#(\w*)}?/', '$1$2', $line);
- # Remove comments
- $line = preg_replace('/\s*#.*/', '', $line);
-
$lparts = Array();
# Match variable assignment only.
if (preg_match('/^\s*[_\w]+=[^=].*/', $line, $matches)) {
--
1.6.3.1
More information about the aur-dev
mailing list