pacman/scripts
Eli Schwartz 1a5f308d52 makepkg: optimize and fix BUILDINFO generation's use of awk
The biggest issue is directly supplying the data within the format
string which can result in misinterpreting formatter sequences if a
printed variable contains an "%" in it. This character is currently
permitted in the pkgver field, though not in the pkgname. Also
pacman/libalpm itself has much looser limitations and this can appear
anywhere at all if a package was created by some other program.

For the package "iambroke-1%s-1-any.pkg.tar.xz", installed in the build
environment, the result is:

  -> Generating .BUILDINFO file...
awk: cmd. line:3: (FILENAME=- FNR=1085) fatal: not enough arguments to satisfy format string
	`-1%s-1'
	   ^ ran out for this one

Followed by a .BUILDINFO which contains an LC_ALL=C sorted list of
$pkgname-${epoch:+$epoch:}$pkgver-$pkgrel-$arch ending in:

installed = iambroke

Which is cut short, then fails to list the succeeding packages. The
package itself successfully builds.

It's also unnecessary to save the output of pacman -Qq in order to get the
information for pacman -Qi, since the latter will, just like the former,
return information for all installed packages if not given a package
name(s).

While I am at it, pipe this directly to awk rather than keeping a copy
in an unnecessary local variable. This is slightly more efficient in
addition to preventing the <<< herestring from re-interpreting the
content of "$pkginfos" in ways that don't really matter for our usage.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-07-27 11:43:39 +10:00
..
completion bash_completion.in - consider option "-n --native" in operation "-Q --query" 2018-05-12 21:29:12 +10:00
libmakepkg makepkg: reduce strictness of pkgver in depends linting 2018-07-27 10:21:58 +10:00
library makepkg: Move parseopts from library to libmakepkg 2016-10-22 20:50:54 +10:00
po Pull updated translations from Transifex 2018-07-27 10:38:57 +10:00
.gitignore makepkg: Move parseopts from library to libmakepkg 2016-10-22 20:50:54 +10:00
Makefile.am Remove all modelines from the project 2018-05-14 09:59:15 +10:00
makepkg-template.pl.in Remove all modelines from the project 2018-05-14 09:59:15 +10:00
makepkg.sh.in makepkg: optimize and fix BUILDINFO generation's use of awk 2018-07-27 11:43:39 +10:00
pacman-db-upgrade.sh.in Remove all modelines from the project 2018-05-14 09:59:15 +10:00
pacman-key.sh.in Remove all modelines from the project 2018-05-14 09:59:15 +10:00
pkgdelta.sh.in Remove all modelines from the project 2018-05-14 09:59:15 +10:00
repo-add.sh.in Remove all modelines from the project 2018-05-14 09:59:15 +10:00
wrapper.sh.in Update coyrights for 2018 2018-03-14 13:31:31 +10:00