Commit Graph

6814 Commits

Author SHA1 Message Date
Allan McRae
27955a0fee Move update-copyright into build-aux
This is a useful function to update all our copyright years. Move
it into build-aux so that it is not lost in the switch to meson.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-11-05 15:25:52 +10:00
Ethan Sommer
1bfae7d14a libmakepkg: fix empty arguments in parseopts
Previously parseopts checked if there was an argument by checking
that the string was non-empty, resulting in empty arguments being
incorrectly considered non-existent. This change makes parseopts check
if arguments exist at all, rather than checking that they are non-empty

Signed-off-by: Ethan Sommer <e5ten.arch@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-11-05 14:47:15 +10:00
Matthew Sexton
091b244d0f pacman-key: ignore already lsigned/deleted keys
Added two new functions, key_is_lsigned() and key_is_revoked()
that check whether a key has been locally signed or revoked
respectively during --populate. If the key is already signed
or revoked, it is quietly ignored.

Suggested-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Matthew Sexton <wsdmatty@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-11-05 14:16:31 +10:00
Matthew Sexton
e1f5f21983 pacman-key: hide lsign and revoke output behind --verbose
To cut down on spam during --populate, both locally signing and
revoking keys now hide the specific keys being signed or revoked,
but can be shown with --verbose. A count was added, to show the
number of keys signed/revoked during the process.

Partially Implements:
FS#64142 - pacman-key: make populate less noisy

Signed-off-by: Matthew Sexton <wsdmatty@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-11-05 14:13:10 +10:00
Ethan Sommer
7be7552329 libmakepkg: add optional argument support to parseopts
Adds a "?" suffix that can be used to indicate that an option's argument is
optional.

This allows options to have a default behaviour when the user doesn't
specify one, e.g.: --color=[when] being able to behave like --color=auto
when only --color is passed

Options with optional arguments given on the command line will be returned
in the form "--opt=optarg" and "-o=optarg". Despite that not being the
syntax for passing an argument with a shortopt (trying to pass -o=foo
would make -o's argument "=foo"), this is done to allow the caller to split
the option and its optarg easily

Signed-off-by: Ethan Sommer <e5ten.arch@gmail.com>
Reviewed-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-11-04 10:55:23 +10:00
Allan McRae
f6564377a2 Release 5.2.1
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-11-01 10:57:09 +10:00
Allan McRae
c9613f3a0a Pull latest translations from Transifex
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-11-01 10:54:12 +10:00
Allan McRae
fca2f7e598 Update NEWS for pacman-5.2.1
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-11-01 09:26:54 +10:00
Allan McRae
4d76cf6f07 Comma fail 2019-10-30 14:26:07 +10:00
Eli Schwartz
866a5cd431 autotools: be more templated when getting list of doc dist files
Distribute asciidoc sources for all manpages instead of remembering to
add files to both variables. Fixes regression in
377d47142f which broke building the
website from a dist tarball:

make: *** No rule to make target 'pacman-conf.8.html', needed by 'html'.  Stop.

(Technically this regression is already fixed by commit
942b909829, but this is just going to keep
happening, I suspect, so we should fix the root cause.)

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-30 10:05:28 +10:00
Eli Schwartz
5c2059db28 makepkg: only run --clean actions if we built a package
Fixes issue where users were allowed to run cleanup while running
--geninteg or --printsrcinfo or --packagelist, thus mixing invalid
responses into stdout.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-30 10:04:17 +10:00
Eli Schwartz
0272fca993 makepkg: do not count hard links multiple times when calculating pkg size
Exclude files with hardlinks when cat'ing all the files, and do a second
run to look at each file with hardlinks, keep track of the ones we've
already operated on, and only cat each inode once. Then use "wc -c" to get
the size of all (deduplicated) files the same way we were already doing.

Original-patch-by: Ronan Pigott <rpigott@berkeley.edu>
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-30 10:03:46 +10:00
Eli Schwartz
a745d97c17 makepkg: protect against unexpected whitespace in filenames
zipman:

read -r protects against those evil manpages whose filenames contain
backslash escapes, (muahahaha?)

IFS= read protects against filenames with:

- leading whitespace (but no one is actually stupid enough to configure
  their MAN_DIRS=() in makepkg.conf with such silly directories, *right*?)

- trailing whitespace (but likewise, no one should be stupid enough to
  write an uncompressed manpage for section '1 ' or something)

Also fix several other cases where we read filenames without protecting
against surrounding whitespace, or without using null-delimited
filenames when we could trivially do so.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-30 09:47:28 +10:00
Eli Schwartz
99639dc27c meson: fix inodecmd for darwin/bsd
The BSD stat command uses %N, not %n, and was incorrectly ported to
meson.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-30 09:34:51 +10:00
Allan McRae
ae5cf26b5b Fix segfault importing PGP key for pacman -U operations
Use after free.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-27 19:05:27 +10:00
Evangelos Foutras
dc55701132 Add pacman-conf(8) to the documentation index
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-24 17:18:28 +10:00
Allan McRae
f37a3752b3 Update copyright years
make update-copyright OLD=2018 NEW=2019

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-23 22:06:54 +10:00
Allan McRae
a9835a38a3 Remove --force from completion
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-23 22:06:54 +10:00
Allan McRae
cd4f8f7530 Update completion for -F changes
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-23 22:06:45 +10:00
morganamilo
c58bf862b4 makepkg: don't warn when PACKAGER is unset
makepkg now complains when PACKAGER is not in the format
"name <email>".

Hide this warning when PACKAGER is unset but still warn if it is set to
something out of format.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-22 23:18:48 +10:00
Nick Cao
7df70e7fff Fix compression of package databases with zstd
Commit 7afe51171 attempted to add zstd compression support to repo-add,
but failed...

FS#64213

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-22 17:27:15 +10:00
Allan McRae
942b909829 Fix distribution of meson files
Also caught the source of a man page not being distributed.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-22 09:25:49 +10:00
Allan McRae
8ce20d3754 Release v5.2.0
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-21 17:56:25 +10:00
Allan McRae
de24f644f4 Final translation updates for pacman-5.2.0
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-21 17:25:29 +10:00
Eli Schwartz
9ddd0be027
document changes between 5.1 and 5.2
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
2019-10-17 11:51:30 -04:00
Allan McRae
b05a3c10bf Update README for pacman 5.2.0 release
This is the first major release without any additions to the libalpm API!

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-15 21:29:22 +10:00
morganamilo
719efe19c7 libalpm: set errno in signing dummy functions
This allows pacman to print the correct error message when checking keys
and libalpm has been compiled without gpgme support.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-15 19:56:40 +10:00
morganamilo
54b6d689e5 libalpm: fix segfault when -Qip'ing a package
The dummy checksigs function never sets count to 0, leaving it
unitialized. This caused the siglist cleanup to try and free the empty
list.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-15 19:56:00 +10:00
Allan McRae
27ccd68976 Translation updates
Pull all translations with >75% completion.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-14 09:43:35 +10:00
Andrew Gregory
5e11d86cc5 remove: improve broken dependency error message
This message was clarified for sync operations in
2b1b7b7075.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-14 09:31:43 +10:00
morganamilo
d4e667ee5e pacman: return 1 when -F <target> has no results
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-13 12:37:34 +10:00
Andrew Gregory
808a4f15ce run XferCommand via exec
system() runs the provided command via a shell, which is subject to
command injection.  Even though pacman already provides a mechanism to
sign and verify the databases containing the urls, certain distributions
have yet to get their act together and start signing databases, leaving
them vulnerable to MITM attacks.  Replacing the system call with an
almost equivalent exec call removes the possibility of a shell-injection
attack for those users.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2019-10-12 07:04:20 -07:00
Andrew Gregory
a82b0028e4 add arg_to_string helper
Converts an argc/argv pair to a string for presentation to the user.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2019-10-11 20:14:29 -07:00
Andrew Gregory
a2c4ad4675 move wordsplit into common for sharing
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2019-10-11 18:49:38 -07:00
Eli Schwartz
a897599fa5 makepkg: do not save fflags when creating packages
Saving fflages breaks reproducible builds due to encoding information
specific to the filesystem that was used to build the package. This
information is not needed for packaging purposes anyway.

Including fflags also means that attempting to extract a package file as
root (or fakeroot) might result in angry warnings being printed to the
console by bsdtar, followed by a non-zero exit code, unless the user
remembers to use --no-fflags during extraction. This is unpleasant UI, even
if pacman itself won't care about these.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-09 15:39:48 +10:00
Christian Hesse
e8d4228614 signing: handle unknown uid in key import
With unknown uid pacman crashed. Return with error from email_from_uid()
if uid is NULL.

Signed-off-by: Christian Hesse <mail@eworm.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-09 15:39:35 +10:00
Christian Hesse
379f715105 signing: modify question text with unknwon uid
If the key's uid is unknown (for example with db signatures) the
question was:

:: Import PGP key 02FD1C7A934E614545849F19A6234074498E9CEE, "(null)"? [Y/n]

Let's display a modified question for unknown uid.

Signed-off-by: Christian Hesse <mail@eworm.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-09 15:39:22 +10:00
Jonas Witschel
d5c3ed129c pacman-key: receive keys from WKD with -r/--recv-keys
If an email address is specified, we use --locate-key to look up the key
using WKD and keyserver as a fallback. If the key is specified as a key
ID, this doesn't work, so we use the normal keyserver-based --recv-keys.

Note that --refresh-keys still uses the keyservers exclusively for
refreshing, though the situation might potentially be improved in a new
version of GnuPG:
https://lists.gnupg.org/pipermail/gnupg-users/2019-July/062169.html

Signed-off-by: Jonas Witschel <diabonas@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-07 21:40:54 +10:00
Allan McRae
5d2e48d17f Pull and push translation changes in preparation for 5.2
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-07 18:12:24 +10:00
Alad Wenter
7e79cf73fa makepkg: propagate E_REMOVE_BUILD_DEPS
remove_deps is called once, at the end of clean_up() before makepkg
exit. If remove_deps returns >0 (e.g. when pressing "n" in the resulting
prompt), the error is caught by the ERR signal handler. This in turns
sends SIGUSR1 to the process group, with resulting exit code 138.

In case remove_deps fails, this patch exits makepkg with E_REMOVE_DEPS
if there was no previous error (that is, EXIT_CODE equals E_OK).
Otherwise, makepkg exits with EXIT_CODE.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-07 17:09:23 +10:00
Erich Eckner
095d6332be makepkg: remove makedepends before installing built package
When running `makepkg -i` it may be necessary to first remove make- and
checkdepends before installing the built package - for example if they
conflict each other. This is the case for wireguard-arch which
makedepends and conflicts wireguard-dkms.

Signed-off-by: Erich Eckner <git@eckner.net>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-07 16:44:42 +10:00
Allan McRae
8e7d425627 makepkg: wait for process to finish
Without the -f option to wait, we might move on and try to delete the
logpipe before the process is completed.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-07 16:22:52 +10:00
Austin Lund
e581068c77 makepkg: Delete logpipe when exiting
The logpipe fifo can remain when exiting on a non-error condition such
as recieving signals INT and USR1.  This can be seen by doing either a
manual CTRL-C to interrupt the build or by sending a signal such as:

$ makepkg & sleep 5 ; kill -USR1 $!

Remove the fifo in all cases on script exit if it still exists.

Signed-off-by: Austin Lund <austin.lund@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-07 16:21:24 +10:00
morganamilo
8f89e509d2 pacman: speed up deptest
Try and find an exact match via pkgcache before iterating the entire
localdb.

Gives a noticeable speed up for exact matches e.g. `pacman -T zlib`

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-07 14:27:09 +10:00
morganamilo
f2442bc2e9 libalpm: short circuit alpm_find_dbs_satisfier
when a satisfying package is already installed, we always pick it
instead of prompting the user. So we can return that package as soon as
we find it, instead of waiting until we've iterated through all the
databases.

Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-07 14:21:08 +10:00
morganamilo
0a295f3f39 libalpm: fix incorrect documentation
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-07 14:19:54 +10:00
Eli Schwartz
0e3a4bd1fb meson: work around broken pkg-config file with private requires
In addition to the general issue of staticlibs linkage, linking a static
lib to a library() does not seem to generate the needed Libs.private.

Rework how we handle this entirely. Instead of relying on convenience
libraries, we will *sigh* go extract a boatload of .o files again, then
relink those to the installable libalpm, while mentioning our
dependencies again.

We still have our guaranteed static library for linking arbitrary programs
with (e.g. vercmp), and we still only generate one identical copy of the
.o files, but now we potentially `ar` it up twice, which isn't so bad.
And linking still works, and pkg-config files also still work.

One alternative would be to explicitly list our dependencies to
pkgconfig.generate with requires_private, but since gpgme might be an
elevated config-tool dependency, this can fail with:

meson.build:341:10: ERROR: requires argument not a string, library with pkgconfig-generated file or pkgconfig-dependency object, got <GpgmeDependency gpgme: True>

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-07 14:09:34 +10:00
Eli Schwartz
facd9533b0 meson: fix incorrect libalpm version
LIB_VERSION is supposed to be something like 11.0.1, not simply
reiterate the project version. As a result, we ended up with this:

$ pacman -V
[...]
Pacman v5.1.0 - libalpm v5.1.0
[...]

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-07 14:09:21 +10:00
Eli Schwartz
c0da1ba13a meson: fix libcommon being publicly exposed as a static link dependency
libcommon isn't even installed, so that means libalpm.a (if installed)
is fatally broken as it misses objects. The problem is that meson
doesn't handle this case correctly:

https://github.com/mesonbuild/meson/issues/3934
https://github.com/mesonbuild/meson/issues/3937
https://github.com/mesonbuild/meson/pull/3939

Work around this by manually extracting libcommon's .o files into the
list of objects used to create libalpm.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-07 14:08:57 +10:00
Eli Schwartz
de6249ce22 Support file with seccomp enabled
Not all compression types can be detected in the seccomp sandbox, so we
need to disable it. This requires either configuring makepkg to know the
sandbox is available, or checking for file >= 5.38 in which the sandbox
option is a no-op even when seccomp is disabled.

- Requires autoconf-archive for autotools version compare macro.
- meson version comparison could be made a lot simpler using meson-git.

Fixes FS#58626

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-07 13:43:37 +10:00