Commit graph

7431 commits

Author SHA1 Message Date
Allan McRae
870eae26dc makepkg: move SOURCE_DATE_EPOCH handling to libmakepkg
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-12-12 13:27:28 +00:00
Integral
cb940620bc
fix: make dependency cycle a debug message 2024-12-10 21:10:35 +08:00
Integral
dd55afad68 refactor: use c99 struct initializers to enhance readability 2024-12-10 10:18:40 +00:00
Allan McRae
775db50538 Remove pubkey_algo from alpm_pgpkey_t
This field is no longer used and requires updating with gpgme changes.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-12-07 22:13:49 +10:00
Allan McRae
95a7d416ce Do not identify the public key algorithm
When the import key message was pushed to the pacman frontend, we no longer
displayed the length or algorithm used for the key, sticking to just the
user ID and the key ID.

Remove this code given this field is no longer used, and the code requires
updating for any now algorithm added.

Note: removal of the field from the alpm_pgpkey_t will happen in a separate
commit so that this commit can be readily backported.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-12-07 22:07:29 +10:00
Jan Alexander Steffens (heftig)
9154600490 strip: Treat bare object files like static libs, not shared libs
Debug symbols should only be split from finally linked ELFs, not bare
object files. We're already excluding static libraries from splitting
for a similar reason.

The `.gnu_debuglink` sections are also mishandled by LLVM's LLD, which
copies them to its output. For example, this affects Arch Linux's
`/usr/lib/Scrt1.o`.

While we're here (and it changes the code less), also strip GNU LTO data
from bare objects, again for the same reason we're removing it from
static libraries, and apply static library stripping instead of shared
library stripping.

See: https://bugs.gentoo.org/787623
2024-11-27 19:50:57 +10:00
Jan Alexander Steffens (heftig)
e0162a6868 strip: Overwrite debuglink when it's already present
When objcopy encounters an already-present section, adding the new
debuglink will fail with a warning. Remove any existing `.gnu_debuglink`
section to work around this problem.

Arch Linux's `rust` package is affected by this. Apparently when LLVM's
LLD links in `/usr/lib/Scrt1.o` it will also copy the `.gnu_debuglink`
section.

See: https://bugs.gentoo.org/787623
2024-11-27 19:50:46 +10:00
Allan McRae
71afd4d88f libmakepkg - add wrapper function for objcopy
Using objcopy can result in file permission changes.  We work around this
by using "cat" to copy the temporary output file into the target. Extract
this code into a utility function.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-11-27 19:46:48 +10:00
Guillaume
a2d029388c fix a segfault in sandbox.c if handle->dlcb is null 2024-09-28 08:10:46 +00:00
Jelle van der Waa
8a60361949 pactest: drop trailing spaces from README 2024-09-28 01:44:17 +00:00
Chih-Hsuan Yen
e80569f5da Correctly configure landlock for older ABIs
For example, with landlock ABI < 3, LANDLOCK_ACCESS_FS_TRUNCATE is not
set in ruleset_attr.handled_access_fs, so it should not be set in
path_beneath.allowed_access either. Otherwise, landlock_add_rule fails
with -EINVAL, and pacman complains:

> error: restricting filesystem access failed because the landlock rule for the temporary download directory could not be added!

The change is tested on Debian Bookworm kernel
linux-image-6.1.0-25-cloud-amd64 6.1.106-3.
2024-09-28 00:35:10 +00:00
Rafael Fontenelle
60ec268458 Add double colon for newline after MAKEPKG_LINT_PKGBUILD in makepkg.8.asciidoc 2024-09-25 15:11:51 -03:00
Allan McRae
7bc5d55b56 libalpm: only chown downloaded files when running as root
Some libaplm utilities sync databases as a non-root user for use in
actvities other than system updates.  The ability to download as a
non-root user was broken as part of the download sandboxing.

Applying a minimial fix by preventing the chown of the downloaded file
if the user is non-root.  A larger change increasing the robustness
and error checking of this path is warranted in the future.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-09-08 11:49:21 +10:00
KaranveerB
6ba5c20e76
pactest: add test for empty replacements strings 2024-08-03 16:29:26 -07:00
KaranveerB
4c18204938
pacman/util.c: fix segfault when replace in strreplace is NULL 2024-08-03 16:29:11 -07:00
Remi Gacogne
cf473bcfbd Ensure that the download process cannot get new privileges
Signed-off-by: Remi Gacogne <rgacogne@archlinux.org>
2024-08-02 00:39:45 +00:00
Remi Gacogne
f142df92c7 Restrict syscalls for the download process whenever possible
Signed-off-by: Remi Gacogne <rgacogne@archlinux.org>
2024-08-02 00:39:45 +00:00
Allan McRae
c3aa1bc123 Fix typo in git source handling
Fixes #171

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-07-16 18:51:03 +10:00
Allan McRae
138cbae584 Update meson versions for release
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-07-14 19:11:18 +10:00
Allan McRae
dd20586baf Update index.asciidoc for release
Also, rebalance columns in release version table.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-07-14 19:11:18 +10:00
Allan McRae
aa1c64b21a Update translations for release
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-07-14 19:11:18 +10:00
Allan McRae
3223d6206b Update NEWS for 7.0.0 release
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-07-14 19:05:03 +10:00
Allan McRae
7299aadd7b Update README for 7.0.0 release
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-07-14 19:05:03 +10:00
Allan McRae
9841f14f81 Prepare tranlsation strings for 7.0.0 release
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-07-14 19:05:03 +10:00
Allan McRae
95e71ce52b Tidy up landlock check
This test was flagged as ambiguous by clang.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-07-14 19:03:23 +10:00
Allan McRae
cc0292a1ad Revert "_alpm_archive_fgets(): bail early if reached end of block"
This reverts commit 4dc21b965b.

Causes a segfault when reading some repos (gz compressed?)

Fixes #166.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-07-13 22:06:10 +10:00
Andrew Gregory
16a098a44e do not sort passed list
Sorting modifies the list in place, causing any existing pointers to the
list to point to a random element.

Fixes #165

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2024-07-11 01:27:06 -04:00
Vasiliy Stelmachenok
5213a70b88 tidy/strip: Fix incorrect recognition of static binaries as relocatable ones 2024-07-06 09:09:37 +00:00
Filip Hejsek
9151c44658 libmakepkg: Use git -c safe.bareRepository=all in bare repositories
Git commands can fail in bare repositories when global git config contains safe.bareRepository=explicit.
Some users set this option for increased security.
To be compatible with this configuration, explicitly set safe.bareRepository=all when invoking git in a bare repository.
2024-07-06 08:57:20 +00:00
Allan McRae
8d22f991f9 Add download sandbox related options to example config file
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-07-05 09:53:52 +10:00
Diego Viola
50bdd3d9bc Fix typos
Signed-off-by: Diego Viola <diego.viola@gmail.com>
2024-06-30 02:28:13 -03:00
Allan McRae
8d14b22260 repo-add: unconditionally create the database if it is missing
In f91fa546 (repo-add: do not recreate the database if nothing was changed),
repo-add was made to skip database write-out if there were no changes to
the database. However, this breaks the usage of repo-add to create a new
empty database: `repo-add /path/to/mydb/mydb.db.tar.xz`.

Bring back support for this use-case by always writing the database if
it is missing.

Original-patch-by: Ivan Shapovalov <intelfx@intelfx.name>
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-06-27 22:04:28 +10:00
Allan McRae
3f1943c84d Only copy source files onces when creating debug packages
The Arch sharutils package was spewing messages about "Permission denied" when
copying source files into the debug package.  This is due to the source files
having 444 permissions and being used in multiple binaries.  Only copy each
source file into the debug package onces to avoid this error.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-06-20 00:34:32 +00:00
Allan McRae
c9acfc2b50 Fix error when downloading signature file for an existing package file
If a package was already downloaded but its signature file was not,
pacman would download the signature then error out despite all files
being present.

Also fixes a similar error when some, but not all, package databases
were updated with -Sy.

Fixes #156

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-06-19 17:38:07 +10:00
Allan McRae
b60b779fc8 Fix calculation of space needed for download package
The calculation used the size of the package rather than the amount
remaining to download for partially downloaded packages.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-06-19 17:33:36 +10:00
Allan McRae
479f4d574a Prevent buffer overflow when using a scriptlet shell with a long path
Observed in Nixpkgs.  Fixes #157.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-06-19 07:41:11 +10:00
Remi Gacogne
9f8f94c056 Add --disable-sandbox and DisableSandbox
Signed-off-by: Remi Gacogne <rgacogne@archlinux.org>
2024-06-17 11:01:42 +10:00
Remi Gacogne
eacadbcc41
Restrict filesystem access to the download process whenever possible
Signed-off-by: Remi Gacogne <rgacogne@archlinux.org>
2024-06-14 09:30:20 +02:00
Remi Gacogne
24304c6df0 Fix up-to-date repo databases being redownloaded when sandboxed
Signed-off-by: Remi Gacogne <rgacogne@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-06-10 19:48:20 +10:00
Allan McRae
f0a7f85dbb libmakepkg: make configured BUILDENV readonly
PKGBUILDs should not be directly adjusting this variable

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-05-31 16:15:54 +00:00
Allan McRae
b013ca4221 makepkg: provide environment variable to disable PKGBUILD linting
On Windows based systems (e.g. msys), running PKGBUILD linting is very
slow due to time taken spawning bash subshells.  Additionally, some packages
have extreme amounts of (usually procedurally generated) splitting, which
also causes linting to be extremely slow.  Provide an environment variable
to disable PKGBUILD linting.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-06-01 02:12:23 +10:00
Diego Viola
44b9a53b2d Fix spelling of environment 2024-05-31 16:11:07 +00:00
Diego Viola
24455cc5b2 editorconfig: update url
Use https and lowercase characters.

Signed-off-by: Diego Viola <diego.viola@gmail.com>
2024-05-27 02:31:30 -03:00
Diego Viola
7bbfc17f3c Fix typos
Signed-off-by: Diego Viola <diego.viola@gmail.com>
2024-05-20 02:30:50 -03:00
Allan McRae
d74d7ec32c makepkg: remove GITFLAGS support
Supporting git source fragments (branch, commit, tag) is difficult in
conjunction with GITFLAGS usage - particularly with the most common
use cases that reduce the amount of data cloned from the upstream repo.

Leaving GITFLAGS in place an documenting that various git source features
are not supported when GITFLAGS are in used is not an ideal 'solution'.
Instead, remove GITFLAGS support.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-05-20 00:18:43 +00:00
Allan McRae
76e1cb1bf1 Revert "Prepare git src with git worktree"
This causes issues when repeatedly building a package using the same
git checkout.  There is also ambiguity of the default checkout when
trying to build from HEAD. See #142 and #143.

This reverts commit 85c421f1cb.
2024-05-20 10:15:33 +10:00
Allan McRae
0f2417f919 doc/makepkg.8: Improve --cleanbuild documentation
Fixes #45.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-05-12 03:33:01 +00:00
Allan McRae
e1df19ee6f makepkg: drop sudo permissions after use
Add the -k parameter to the sudo call to prevent caching of credientials.
This would (potentailly) stop a rogue sudo use within a PKGBUILD.

Signed-off-by: Allan McRae <allan@archlinux.org>
2024-05-12 03:30:06 +00:00
Allan McRae
6d85d9ae08 Document makepkg.conf.d/ drop-in configuration
Signed-off-by: Allan McRae <allan@archlinux.org>
2024-05-12 03:25:42 +00:00
EnnoxHD
8aba032de4 makepkg: make 'not a clone of' visible with a new error code
Add a new error code to expose the 'not a clone of' error state of some source
providers (git and fossil). This allows other tools integrating further and
handle this specific error state.

One usecase evolves around frequently changing source locations in PKGBUILDs
of packages in the AUR.
2024-05-05 12:24:56 +10:00