FS#40361 - [pacman-dev] Text with `)' or `#' is either broken or disallowed

Attached to Project: Pacman
Opened by Michael Witten (mfwitten) - Wednesday, 14 May 2014, 14:40 GMT
Last edited by Allan McRae (Allan) - Saturday, 09 August 2014, 06:17 GMT
Task Type Bug Report
Category General
Status Closed
Assigned To Allan McRae (Allan)
Architecture All
Severity Medium
Priority Normal
Reported Version 4.1.2
Due in Version 4.2.0
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

If the text of this report has been mangled, then please refer to the attached file.

------------

This issue was originally raised in the mailing list thread starting here:

https://projects.archlinux.org/pacman.git/plain/scripts/makepkg.sh.in?id=912ea363dec9038e9226a619364e16709720cac3

In `makepkg', specifically:

https://projects.archlinux.org/pacman.git/tree/scripts/makepkg.sh.in

the following exist:

local provides_list=()
eval $(awk '/^[[:space:]]*provides=/,/\)/' "$BUILDFILE" | \
sed -e "s/provides=/provides_list+=/" -e "s/#.*//" -e 's/\\$//')
...
local backup_list=()
eval $(awk '/^[[:space:]]*backup=/,/\)/' "$BUILDFILE" | \
sed -e "s/backup=/backup_list+=/" -e "s/#.*//" -e 's/\\$//')
...
local optdepends_list=()
eval $(awk '/^[[:space:]]*optdepends=\(/,/\)[[:space:]]*(#.*)?$/' "$BUILDFILE" | \
sed -e "s/optdepends=/optdepends_list+=/" -e "s/#.*//" -e 's/\\$//')
...
local known kopt options_list
eval $(awk '/^[[:space:]]*options=/,/\)/' "$BUILDFILE" | \
sed -e "s/options=/options_list+=/" -e "s/#.*//" -e 's/\\$//')

Perhaps there are more.

As you can plainly see, this ruins the ability to include comments that use the `)' character, as in the following:

options=(
'!strip'
'!makeflags' # Apparently, there are issues with concurrency (`-j2', etc.)
)

As explicitly pointed out by contributor lolilolicon, it also ruins seemingly valid usages of the `#' character. For instance:

optdepends=('hashtag: A program that parses #hashtags')

Perhaps there are other ramifications.
   q (1.4 KiB)
This task depends upon

Closed by  Allan McRae (Allan)
Saturday, 09 August 2014, 06:17 GMT
Reason for closing:  Fixed
Additional comments about closing:  git commit cbd6c300
Comment by Phillip Smith (fukawi2) - Thursday, 15 May 2014, 00:07 GMT
Attached patch I believe would resolve this -- submitted to the mail list for feedback, none received. Attaching here to avoid it being lost.
Comment by I Said Socks (socks) - Thursday, 15 May 2014, 05:28 GMT
Stripping comments by sed/awk isn't so easy though. If you read the ML thread carefully, there is an indirect feedback from me (lolilolicon).

Fortunately, Dave has worked something up which could properly resolve this issue once incorporated:

https://github.com/falconindy/pkgbuild-introspection
Comment by Phillip Smith (fukawi2) - Thursday, 15 May 2014, 05:59 GMT
Yeah, it's not a perfect solution. It seemed like it would resolve the "basic" case, esp that which was originally reported on the ML :)

Loading...