Commit graph

7347 commits

Author SHA1 Message Date
morganamilo
aff98a2bd9
Add tests for partial upgrades 2024-03-16 20:30:50 +00:00
morganamilo
a22d07b177
Fix tests that perform partial upgrades 2024-03-16 20:30:47 +00:00
morganamilo
7c02a4ad2a
Replace packages without asking 2024-03-16 20:30:44 +00:00
morganamilo
7289953332
pacman: be more informative on partial upgrade 2024-03-16 20:24:09 +00:00
morganamilo
0a7ecd3990
pacman: add AllowPartialUpgrades option 2024-03-16 20:24:06 +00:00
morganamilo
e13d6d805e
pacman: Add --partial option 2024-03-16 20:24:03 +00:00
morganamilo
a84916d4bb
libalpm: disallow partial upgrades
Detect if there's an upgrade avaliable, and if so disallow the upgrade.
2024-03-16 20:23:59 +00:00
Morten Linderud
bae9594ac1
debugedit: only check for debugedit if we build a package
We only really need debugedit while building the package, while this
check would run if you tried something like `makepkg --verifysource`.
Use the same checks as we have for fakeroot to wrap debugedit so we
don't beg for dependencies we don't need.

Fixes: 3ed08f97ec

Signed-off-by: Morten Linderud <morten@linderud.pw>
2024-03-14 23:07:08 +01:00
Allan McRae
111eed0251 Fix unused result warnings
Not actually a fix, as the pacman output will still be weird and
we will not gracefully exit, but it does print an error message...

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-03-14 01:50:05 +00:00
Christian Heusel
0571ee82bf repo-add: fix parseopts missing arg to -k/--key
The current code treats -k/--key as a binary option which later makes it
fail parsing the argument as then the end of arguments '--' is treated
as the GPGKEY. We fix this by adding the appropriate specifier to the
long and shortopt.

Closes https://gitlab.archlinux.org/pacman/pacman/-/issues/105

Fixes: 4f43ce3e ("repo-add: use parseopts from libmakepkg")
Signed-off-by: Christian Heusel <christian@heusel.eu>
2024-03-14 01:20:53 +00:00
Ivan Shapovalov
5e0496260b make_aligned_titles: pass the correct buffer length
The third parameter to wcstombs() is the length of the output buffer
(first parameter) in bytes. Take the correct sizeof() here.

This is not a problem in practice, but prevents _FORTIFY_SOURCE=3 from
detecting a possible output buffer overflow (as the source buffer is
bigger than the destination).

Fixes #104.

Signed-off-by: Ivan Shapovalov <intelfx@intelfx.name>
2024-03-13 04:32:42 +01:00
Allan McRae
95f148c222 Update website to reflect gitlab usage
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-03-06 10:23:33 +00:00
Allan McRae
d7f3ce1217 Manage releases through gitlab
Also provide an example for how to check for errors in translations

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-03-06 10:23:33 +00:00
Allan McRae
6bb95c8856 Fix error messages for unknown key in databases
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-03-05 07:25:11 +10:00
Allan McRae
e3dc296ba3 Pull translations for release
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-03-04 13:07:58 +10:00
Allan McRae
23151a8811 Update web index for release
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-03-04 11:44:11 +10:00
Allan McRae
4b25bb63c1 Update meson.build for release
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-03-04 11:44:11 +10:00
Allan McRae
1c536abef6 Update NEWS for 6.1 release
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-03-04 11:44:11 +10:00
Allan McRae
90f5ca42cc Update README for 6.1
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-03-04 11:44:11 +10:00
Andrew Gregory
9f6c081771 conf: do not default sysroot to /
Setting sysroot to / is not the same as having no sysroot, because the
sysroot is prepended to ALL config paths including relative ones:

$ cd /etc
$ pacman --config=pacman.conf
error: config file /pacman.conf could not be read: No such file or directory

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2024-03-04 01:33:51 +00:00
Andrew Gregory
cddad6fccd conf: make prepend_dir and globdir NULL aware
Allows sysroot to be left NULL.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2024-03-04 01:33:51 +00:00
Levente Polyak
016fd2633e
libmakepkg/srcinfo.sh: fix missing extglob in srcinfo_write_attr
We use an extended glob here, but were relying on having it globally set
in makepkg. This causes it to fail when used in scripts.

Since scripts using libmakepkg may not want extglob to be set, save and
restore the environment while explicitly setting extglob only where we
need it.

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2024-02-28 21:30:22 +01:00
Allan McRae
f343db5b8e Do not segfault with badly formed URL
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-28 07:38:56 +10:00
Allan McRae
4a115b4dca Fix bug introduced to string_length
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-26 13:59:18 +10:00
Allan McRae
74deada511 pacman/callback.c: handle empty pkgname
In pacman's progress callback, pkgname being null may result in a
segfault, due to undefined printf behaviour.  libalpm always passes
at least an empty string for pkgname, so this situation is largely
avoided.

However, the callback mostly checked for pkgname's being non-null
and not empty.  This means a additional space was being added to
the output messages (although with zero actual effect on the output).

Be a bit more robust here by treating null and empty pkgname the
same and fixing the invisible output issue...

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-26 03:42:53 +00:00
Allan McRae
b30dac6a5b Improve robustness of parsing the --ask argument
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-26 13:14:23 +10:00
Allan McRae
5121108542 Improve robustness of parsing the --debug argument
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-26 03:10:35 +00:00
Allan McRae
c9c56be396 pacman/util.c: fix potential buffer overflow in string_length
A potential buffer overflow could occur if a detected terminal escape
sequence was not for a terminal colour (i.e. did not contain an "m").

Fix the potential buffer overflow while explicitly detecting only
terminal colour escape sequences.  Any other escape sequence is
unexpected, and just gets pushed to the terminal.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-26 03:07:08 +00:00
Allan McRae
1d1bb6fa1a pacman-key: remove lock-never from keyring configuration
I'm not sure why this was originally included, but it has now become
a problem with multiple processes updating the keyring (e.g. the
systemd timer for WKD updates from Arch Linux).

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-26 03:04:05 +00:00
loqs
dba383f092 makepkg: Add support for Fortran build flags
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-25 09:33:29 +10:00
Allan McRae
2a0dd9ec09 makepkg: move rust related documentation into the configuration file
Adding more and more languages will make the man page become increasingly
difficult to navigate.  Move documentation into the configuration file
where variables are defined.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-25 09:32:57 +10:00
Allan McRae
d55b47e551 Update copyright years
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-24 18:40:44 +10:00
Allan McRae
c8afb0aa1a Prepare translations
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-19 11:27:21 +10:00
Allan McRae
c7c4c2a7d2 verify_signature: wait as long as possible before bailing
Bailing early caused problems with makepkg failing on verify but expired
signatures.  As this is often out of the packagers control, and it is
better to verify a signature than not, we try bailing as late as possible
and let makepkg warn about the expired signature.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-19 09:24:13 +10:00
Andrew Gregory
7016adcb70 manually apply --sysroot to configuration
The previous chroot-based sysroot often broke due to glibc's delayed
loading for much of its functionality when the sysroot did not contain
compatible copies of the necessary libraries.

This approach instead manually prepends the sysroot to all configuration
paths.

BREAKING CHANGE: targets to -U are no longer interpreted relative to
sysroot

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-19 09:20:16 +10:00
Masato TOYOSHIMA
2180e4d127 libalpm: download signatures with the external downloader
Ensure relevant signature files are downloaded when using the fetch
callback.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-16 19:27:09 +10:00
Allan McRae
48729f8ecc libmakepkg: skip stripping guile-2.2 files
Guile 2.2 uses ELF format for its byte-compiled files.  These are not
normal executables, and are not strippable in the normal sense.

Given these are ELF files and detected by "file" as non-stripped binaries,
it is only possible to skip these using the file path.

Fixes #73

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-15 23:34:05 +00:00
Allan McRae
fface9001a Update "submitting-patches.asciidoc" for the move to gitlab
Also include a section encouraging discussion of large changes as there have
been a number of case of rejected features being reinvented.

Fixes #34

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-15 23:19:20 +00:00
Allan McRae
f74daa39e8 makepkg.conf.5: Add ellipsis to OPTIONS array description
We have added more options to makepkg, but adding them to the man
page entry would result in line wrapping on a standard width
terminal.  Instead, trucate and add ellipsis to indicate more
members (as described in the section below).

Fixes #91

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-15 23:14:28 +00:00
Allan McRae
22c043d4c3 Fix format string
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-16 09:09:45 +10:00
morganamilo
abc6dd7411 libalpm: check calloc in alpm_list_cmp_unsorted 2024-02-15 23:02:15 +00:00
morganamilo
7a43c6fee0 Speedup comparing lists if they happen to be in the same order 2024-02-15 23:02:15 +00:00
morganamilo
62095d916b Prompt to delete invalid package 2024-02-15 23:02:15 +00:00
morganamilo
386125fc89 Validate extra data when comparing dbpkg to pkgfile 2024-02-15 23:02:15 +00:00
morganamilo
196de7e94a Add function to check if lists are equal 2024-02-15 23:02:15 +00:00
morganamilo
e1dc609939 libalpm: print warnings for unknown keys in databases/packages
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-10 11:31:12 +10:00
Allan McRae
0649a66ee5 Add ALPM_PKG_REASON_UNKNOWN type
Return ALPM_PKG_REASON_UNKNOWN when parsing of %REASON% in the local
database fails.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-09 11:14:38 +10:00
morganamilo
6e6d3f18e3 libalpm: don't use atio for pkgreason
atio's behaviour is undefined if the input is not valid. Also it does
all sorts of whitespace and prefix handling which we don't need for
pkgreason.

Instead of going into UB on invalid input we now return EXPLICIT as the
fallback and print an error. However we don't actually error out as the
DB parsing tries to be error tolerant.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-09 11:14:38 +10:00
Andrew Gregory
0a394144b2 validate package metadata after loading
alpm has certain requirements for package metadata necessary for proper
functioning, name and version in particular.  These requirements are
already enforced in makepkg, but nowhere in alpm.

Exceptions are treated as errors for non-local packages because they
cannot be installed without potentially resulting in undefined behavior.
Exceptions for local packages are treated as warnings because they are
already installed, so any damage has already been done, and the user
would otherwise have no way to uninstall them.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2024-02-07 12:27:26 +00:00
Andrew Gregory
fde59b99e8 be_package: delay freeing archive resource
The error path uconditinally tries to free the archive, leading to a
double-free segmentation fault if the error path is triggered after
already freeing it.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2024-02-07 12:27:26 +00:00