On Mon, May 12, 2014 at 10:47 AM, Michael Witten <[email protected]> wrote: > In `makepkg' (that is, in `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/\\$//')
Why are we doing such rudimentary parsing + `eval`? Apart from breaking any extra ")", it also breaks any "#" that does not start a comment, which could happen for example in backup file names, or more likely in the more freestyle optdepends. These are in the check_sanity function, by the time which is run we already source'd the BUILDFILE, correct? Why don't we use the existing variable arrays then? > > 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.) > ) > > Sincerely, > Michael Witten >
