pacman/upgrade: Check malloc() return value

Check the return value of malloc() before dereferencing the returned pointer.

Signed-off-by: Sören Brinkmann <soeren.brinkmann@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
pacman/upgrade: Refactor memory management

Refactor the upgrade routine to use an array that can be allocated in
one step instead of an alpm_list that is gradually extended in loops.

Signed-off-by: Sören Brinkmann <soeren.brinkmann@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
pacman/upgrade: Fix memory leaks

Make sure allocated memory is freed before returning.

Signed-off-by: Sören Brinkmann <soeren.brinkmann@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
check config_new return value

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
conf.c: remove extra indentation

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
makepkg: sign source packages with --sign

Signed-off-by: Allan McRae <allan@archlinux.org>
Always supply base name and version info in .PKGFILE if needed

Provide pkgbase information for non-split packages with pkgbase set.
Also record the version of the "base" package.  This is useful for
matching package files to source packages.

Signed-off-by: Allan McRae <allan@archlinux.org>
repo-add: declare pkgbase as local
makepkg: use dash instead of underscore in /usr/lib/debug/.build-id

Signed-off-by: Allan McRae <allan@archlinux.org>
strtrim: reset pointer after trimming leading whitespace

Breakage introduced in 92216c5864efccac when we changed the signature
of strtrim to return something more useful.

Fixes FS#39976.

Signed-off-by: Allan McRae <allan@archlinux.org>
register_syncdb: reject db names that contain /

alpm downloads databases based on basename causing [foo] and [bar/foo]
to silently overwrite each other.

Also remove an extra tab

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
pmdb.py: change siglevel name to Required

"Always" is not a valid siglevel.  sign002.py was succeeding because
pacman failed to parse the resulting config file rather than a failed
signature check.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
pactest: treat arguments as files instead of globs

glob() returns an empty list if input does not match any files, causing
non-existent test files to be silently skipped.  Treating arguments as
files causes pactest to immediately bail out with an appropriate error
message on non-existent files.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
remove.c: downgrade TRANS_DUP_TARGET to warning

Matches the behavior for sync packages.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
util: Use off_t instead of int for size values

Old output:
> Total Installed Size:  -1527.44 MiB

Fixed:
> Total Installed Size:  2568.56 MiB

Bug introduced in 7b8f8753b15037bf4a88126ffde8195416432c72.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Allan McRae <allan@archlinux.org>
dload: avoid using CURLOPT_FAILONERROR

Use of this flag causes connections to be closed on 404s -- a common
occurrence when your config sets DatabaseOptional. Handle the error
gracefully, so that the connection can be reused.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
makepkg: Use read to parse status file during signature verification.

Instead of invoking grep multiple times, parse the status file once.

This refactoring also changes the behvaiour when signature verification
fails due to a missing public key: It is now an error instead of a
warning.

Signed-off-by: Allan McRae <allan@archlinux.org>
makepkg: Treat a signature from an untrusted key as an error

Signed-off-by: Allan McRae <allan@archlinux.org>
makepkg: Introduce validpgpkeys array

If validpgpkeys is set in the PKGBUILD, signature checking fails if
the fingerprint of the key used to create the signature is not listed
in the array.

The key's trust value is ignored.

Signed-off-by: Allan McRae <allan@archlinux.org>
Do not check makepkg-wrapper for standard options

Fixes "make distcheck".

Signed-off-by: Allan McRae <allan@archlinux.org>