Commit graph

7483 commits

Author SHA1 Message Date
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
Andrew Gregory
edd57c8b96 perform cleanup on sync db parsing errors
Cleanup was only being performed when libarchive failed to actually read
the file.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2024-02-07 12:27:26 +00:00
Andrew Gregory
5c75a55c7d allow freeing partial db package cache
The free function was checking DB_STATUS_PKGCACHE, which is only set
once the package cache has been fully built.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2024-02-07 12:27:26 +00:00
Allan McRae
56f1eeef4b Remove obsolete Doxyfile directives
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-06 20:03:08 +10:00
David Runge
f8c2e59ec5
pacman-key: Make signature verification more robust by checking pipes
To ensure we are not dropping the return code of the `gpg` call due to
piping into `grep`, we make use of `PIPESTATUS` to check the return code
of each command separately.

Additionally, we can now distinguish between two states: The signature
does not verify (e.g. due to technical reasons) and the signature is
not trusted.

Signed-off-by: David Runge <dvzrv@archlinux.org>
2024-02-04 10:06:43 +01:00
David Runge
16a064701a
makepkg: Move check for signature metadata to central location
Move the check for the `NEWSIG` metadata keyword contained in the
GnuPG based statusfile to `parse_gpg_statusfile()` so that it is also
run when creating the statusfile in `verify_file_signature()` and not
only when running `verify_git_signature()`.

Signed-off-by: David Runge <dvzrv@archlinux.org>
2024-02-04 10:06:42 +01:00
David Runge
86ec26b2d3
makepkg: Improve robustness of signature verification by limiting terms
The output of
`gpg --quiet --batch --status-fd /dev/stdout --verify <signature_file> <file> 2> /dev/null`
or
`git verify-commit --raw <commit> 2>&1`
may contain binary data, if the signature has been created with an
OpenPGP implementation, that e.g. makes use of notations.
If the notation string (see `NOTATION_DATA` in /usr/share/doc/gnupg/
DETAILS) contains a trailing binary char, this will break signature
verification, as any following entry (e.g. `VALIDSIG`) will be offset.

As we are only making use of a narrow set of terms from the statusfile
(namely `NEWSIG`, `GOODSIG`, `EXPSIG`, `EXPKEYSIG`, `REVKEYSIG`,
`BADSIG`, `ERRSIG`, `VALIDSIG`, `TRUST_UNDEFINED`, `TRUST_NEVER`,
`TRUST_MARGINAL`, `TRUST_FULLY`, `TRUST_ULTIMATE`), we are applying a
filter, so that only understood terms are written to the file.

Signed-off-by: David Runge <dvzrv@archlinux.org>
2024-02-04 10:06:42 +01:00
David Runge
3aa096a74f
makepkg: Emit early error if signature verification fails
Emit an early error message if tag or commit verification with git or
detached signature verification with gpg fails.
Make `verify_file_signature()` and `verify_git_signature()` return
non-zero in this case and set errors to `1`, so that later checks
in `check_pgpsigs()`, although still run, can not lead to a positive
result.

Signed-off-by: David Runge <dvzrv@archlinux.org>
2024-02-04 10:06:40 +01:00
morganamilo
bf76b5e89f libalpm: correctly log curl_download_internal return value
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-04 10:23:34 +10:00
Allan McRae
ce528a2654 libalpm/discspace.c: ensure mount points provide directories
In the very unlikely situtation where getmntent() and friends return
non-null, but the mount directory is NULL, a null dereference could
occur. It is unclear what the best course of action is in this case,
so just move on to the next mount point.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-04 09:02:36 +10:00
Allan McRae
f996f30163 libalpm/remove.c: prevent undefined behaviour in shift_pacsave error path
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-04 09:02:36 +10:00
Daniel M. Capella
2ba08e622b Update maintainers list
Signed-off-by: Daniel M. Capella <polyzen@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-04 08:58:33 +10:00
Allan McRae
4856fb53ac Add -Wunused_result to debug build compiler flags
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-04 08:53:44 +10:00
Allan McRae
a6b2524762 Ensure paths fit in PATH_MAX when cleaning cache
If a path length exceeds the PATH_MAX value, then it gets truncated
when building the path of the file to delete. This could (in a very
unlikely case...) result in the wrong file being deleted.  Check the
path fittedin the buffer before removing files.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-04 08:44:24 +10:00
Allan McRae
2079f6866a alpm_list_reverse: restore original list on failure
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-02-04 07:56:00 +10:00