If a hook path equals or exceeds PATH_MAX characters the path will be
left unterminated. Pre-calculating the path length also allows us to
use the more efficient memcpy over strncpy.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
run_split_packaging did not preserve the $pkgname array correctly, and
would create duplicate entries in the list during restore.
After restoring the backup (a b c) would become (a b c b c).
This probably went unnoticed because during --install, pacman would
reconcile the duplicates.
Signed-off-by: Allan McRae <allan@archlinux.org>
Also, use FREE() instead of free() in _alpm_backup_free()
to set the pointers to NULL.
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
That makes it impossible to free it later.
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Since it can fail, check the return value.
If it fails, we need to free the memory of the object we wanted
to add to the list.
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
ccache expects further compiler wrappers to be specified via
CCACHE_PREFIX. Otherwise, ccache will hash the wrapper executable
instead of the real one.
Signed-off-by: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
makepkg used to check OPTIONS too, which could override
BUILDENV. Implement a new function that handles these
options more like OPTIONS.
This also reduces code duplication a bit.
Signed-off-by: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Not particularly useful in English (will always be plural), but useful in
languages that have multiple plural forms.
Signed-off-by: Allan McRae <allan@archlinux.org>
Separating the fakeroot command and the pacman call with "--" prevents weird
interactions with some locales. See FS#46405.
Signed-off-by: Allan McRae <allan@archlinux.org>
Combining with the --root flag and outputing a consistent root prefix leads
to many situations that make no sense. Instead, do not print any prefix for
any --files operations.
Signed-off-by: Allan McRae <allan@archlinux.org>
The return value was being assigned when an error was found in a PKGBUILD's
arch array but it never was returned.
Also remove error message explaining about adding the arch array to a PKGBUILD.
That was added a long time ago when the arch array first became compulsory.
Signed-off-by: Allan McRae <allan@archlinux.org>
This is necessary in order to be able to run PreTransaction hooks as
close to the actual commit as possible so that we don't prematurely run
hooks for a transaction that ultimately never happens.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
When extracting variables from PKGBUILD (e.g. for .SRCINFO creation) we make
assumptions about whether variables are arrays or not. This adds a check to
the PKGBUILD linter to ensure variables are arrays or not as appropriate.
Signed-off-by: Allan McRae <allan@archlinux.org>
When a database and its signature is updated non-atomically on a server,
there is a window where a user may update the database but grab the old
signature. The database is marked as invalid by libalpm, which can be
fixed by forcing a refresh (assuming the server has caught up and the
user realizes what has happened) or with a future update of the repo.
Work around this by forcing a repository refresh whenever a database is
invalid.
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
alpm_depend_t is an exposed data type. Front-ends may opt for alloc'ing
one and filling the fields manually, but alpm's _alpm_hash_sdbm is not
exposed, making it impossible for them to fill in the name_hash field.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>