1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-11-12 04:15:06 -05:00
Commit Graph

6279 Commits

Author SHA1 Message Date
Tobias Stoeckmann
5fcd60e264 Reject files larger than 16384 bytes in read_sigfile.
If signature files are larger than SIZE_MAX, not enough memory could
be allocated for this file. The script repo-add rejects files which
are larger than 16384 bytes, therefore handle these as errors here,
too.

While at it, I also rearranged the code to avoid a quite harmless
TOCTOU race condition between stat() and fopen().

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-08-30 18:10:40 +10:00
Tobias Stoeckmann
681509fd44 Release resources on error paths.
Some resources (memory or file descriptors) are not released on all
error paths.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-08-30 18:10:40 +10:00
Allan McRae
1291c04961 pacman-key: reject armored signatures
pacman expects an unarmored signature.  makepkg forces the generation of
unarmored signatures, and repo-add will reject any armored signature.
For consistency pacman-key should also reject armored signatures.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-08-30 18:10:40 +10:00
Tobias Stoeckmann
80d97fcf75 Always use proper error code in alpm_initialize.
In out of memory conditions, an undefined error value is written
into *err, because myerr is never explicitly set in these cases.

I have also converted a calloc into a MALLOC call, because the memory
will be properly filled by the snprintf call right after it.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-08-30 18:10:40 +10:00
Allan McRae
0f0b192d8a Remove obsolete TODO
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-08-30 18:10:40 +10:00
Andrew Gregory
6ac2ee21b3 recursedeps: include cyclic dependencies
Cyclic dependencies (A depends on B, B depends on A) were not selected
because neither package could be removed individually, so
can_remove_package would always return false for both.  By preselecting
all dependencies then filtering back out any dependencies still required
by any packages that will not be uninstalled, groups of unneeded cyclic
dependencies can be found.

Fixes FS#41031

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-08-30 18:10:40 +10:00
Allan McRae
7a9d8b7001 Turn off colours once finished using them
The colour of the package version could leak onto the next line in both
-Qo and -Fo.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-08-30 18:10:40 +10:00
Christian Hesse
839417e8c6 pacman.8: add link to alpm-hooks(5) in see also
Signed-off-by: Christian Hesse <mail@eworm.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-18 15:45:56 +10:00
Christian Hesse
f018317f48 libalpm.3: add link to alpm-hooks(5) in see also
Signed-off-by: Christian Hesse <mail@eworm.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-18 15:45:56 +10:00
Ashley Whetter
4f114f3817 libmakepkg: extract functions for integrity checking
Signed-off-by: Ashley Whetter <ashley@awhetter.co.uk>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-18 15:45:56 +10:00
Leonid Isaev
892a1076c0 Use a more generic regexp when parsing output of gpg(1) in signature verification.
The current way of extracting key trust from output of gpg --verify is not very
robust against changes in the format of said output. As a result, pacman-key
can return an error even if the signature is actuall good.

This change relaxes the regexp when parsing output of gpg.

Signed-off-by: Leonid Isaev <leonid.isaev@jila.colorado.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-18 15:45:56 +10:00
Alastair Hughes
87082e3f44 makepkg: ignore the architecture for --printsrcinfo
Signed-off-by: Alastair Hughes <hobbitalastair@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-18 15:45:55 +10:00
Allan McRae
7bebe4deff Report local file URL for -Sp operations if package is in cache
When using "pacman -Sp" operation to get URLs of packages to download, it is
useful to know which packages are already in the file cache and do not need
downloaded.  Print packages in the cache with a file:// prefix.

e.g
$ pacman -Sp glibc
file:///var/cache/pacman/glibc-2.23-1-x86_64.pkg.tar.xz

Also use package locations in case statements rather than opersations. This
allows the ALPM_PKG_SYNCDB to fall thorough to just printing the package name
for weird serverless repo setups.

Fixes FS#15868

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-18 15:45:55 +10:00
Allan McRae
02a0bf550a makepkg: move build enviroment set-up to function
This is a requirement to split the preparation of the build environment
into libmakepkg, which will allow dropping in extensions (e.g. to allow PGO).

After this patch, disabling buildflags or makeflags and enabling debug
CFLAGS will only effect the build(), check() and package() functions.  The
relevant variables are no longer exported for the prepare() function.  This
should have zero impact for the prepare() function of a properly written
PKGBUILD, as no building/linking is done there...

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-18 15:45:07 +10:00
Allan McRae
3729ef7a9a Avoid logical OR duplication warning from gcc-6
The value EAGAIN is allowed by POSIX to be the same as EWOULDBLOCK, but this is
not guaranteed. Thus on some systems (e.g. glibc Linux), we get a warning that
the logical OR is being performed on two expressions of the same type. We can
not get rid of this test in case any system defines these as unique values.

Suggested-by: Dave Reisner
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-05 13:52:23 +10:00
Ashley Whetter
b012da645e Add -m/--nocolor options to updpkgsums
Fixes FS#43346

Signed-off-by: Ashley Whetter <ashley@awhetter.co.uk>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-05 13:52:23 +10:00
Ashley Whetter
6c96ad36e0 pacsort help clearly states that files contain inputs to be sorted
Fixes FS#44121

Signed-off-by: Ashley Whetter <ashley@awhetter.co.uk>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-05 13:52:23 +10:00
Allan McRae
5b9bc6024c Prevent wrapping of enum items
GCC-6 points out that the value we use for the sentinal in enums is actually
too large for the integer type. Reduce the bitshift by one to fix this.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-05 13:52:23 +10:00
Eric Engestrom
2694d17ad9 fix spelling mistakes
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-05 13:52:23 +10:00
Xavion
0088a7ab1c Add colour to the output of the "-{F, Q}o" operations.
Matching output for -s operations, the repository is coloured 'magenta', the
package name is 'bold', and the version is outputted in 'green'.

Signed-off-by: Xavion <Xavion (dot) 0 (at) Gmail (dot) com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-05 13:52:23 +10:00
Xavion
7e7c64f513 Add colour to group selection dialog
Colour the group name in 'blue' and the repository names in 'magenta'.

Signed-off-by: Xavion <Xavion (dot) 0 (at) Gmail (dot) com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-05 13:52:23 +10:00
Allan McRae
7d1ea0b814 Handle provides with -Q
It is useful to be able to use "pacman -Qi" on any dependency, even if that
dependency is a provide.  For example, on Arch Linux systems, "sh" is provided
by the "bash" package, and many packages depend on "sh". Querying the
package that provides the "sh" dependency currently requires first searching
for "sh".

This patch allows the use of "pacman -Qi" on a provide.

Fixes FS#20650.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-05 13:52:23 +10:00
Allan McRae
502e0d1db0 pacman_query: move error messages into relevant if statements
This ensures any additions to these test do not have to rely on the correct
error condition being set by libalpm.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-05 13:52:23 +10:00
Christian Hesse
a194fb434e pacman.8: add actual operation to captions for easy searching
I caught myself searching for operations when in need for an option.
However this made me find transaction and update options only. So add
the actual operations to captions for easy searching.

Signed-off-by: Christian Hesse <mail@eworm.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-05 13:52:23 +10:00
Allan McRae
ee960048b2 Remove notification of system upgrade when only printing URLs
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-05 13:52:23 +10:00
Allan McRae
3ed57be450 Print replacements when using -Sup
When printing a list of URLs of packages to be updated, pacman was ignoring any
replacements that would be made in the update process.

Fixes FS#35812

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-05-05 13:52:23 +10:00
Alastair Hughes
4960be7764 Changed documentation to use 'the default' instead of 'a typical default'
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-03-28 17:17:17 +10:00
Allan McRae
5901038610 PKGBUILD.5: document that the pkgver() function runs after prepare()
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-03-28 17:17:17 +10:00
Allan McRae
2ee1706a72 Do not add root prefix twice when checking database files
When checking .INSTALL and .CHANGELOG files in the mtree file, we need to find
the path they are stored in the local database. This was appending the root
prefix twice as alpm_option_get_dbpath already returns the absolute path to
the database.

While fixing that issue I added checks that the paths for the database files
were not longer than PATH_MAX.

Fixes FS#48563.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-03-28 17:16:27 +10:00
Ashley Whetter
4cad2423a3 libmakepkg: extract functions for writing .SRCINFO files
Signed-off-by: Ashley Whetter <ashley@awhetter.co.uk>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-03-28 16:26:12 +10:00
Allan McRae
baf1ff64e6 libmakepkg: ensure emptydir find command acts on individual directories
Using "-exec command {} +" systax exits on any error.  Such errors occur when
running rmdir on a non-empty directory.  Switch to "{} ;" syntax instead which
avoids exiting before the find command is completed.

Fixes FS#48515.

Note, we can not use "-empty" in the find command because it is not supported
by Busybox find, and the "--ignore-fail-on-non-empty" flag for rmdir is not
available on BSD rmdir variants.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-03-21 13:14:56 +10:00
Andrew Gregory
02731189f1 use multi-byte character matching for user input
Fixes FS#47992

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-26 15:52:25 +10:00
Allan McRae
1a94c00e36 Add release instructions
This serves as a release checklist for anyone making a pacman release.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-26 15:20:02 +10:00
Allan McRae
f363cf7857 repo-add: do not alter the database if only verifying signature
Fixes FS#48085.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-26 15:18:44 +10:00
Allan McRae
af5d69d59d Failed database downloads cause transaction to stop
Previously, we errored only if all databases failed to download. If any
database downloads fail, we are unable to determine whether an update is
still considered safe. So now if any database download fails, the transaction
is aborted (after attempting all database downloads).

Fixes FS#47599.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-26 15:18:43 +10:00
Allan McRae
3da06c3519 Use versions specified in optdepends
Checking install status and if a package is optionally required on removal
now considers the version of the optdepend.

Fixes FS#44957.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-26 15:18:43 +10:00
Allan McRae
59112e186b Consider provides when warning about optdepnd removal
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-26 15:18:43 +10:00
Allan McRae
76a7d2293c Consider provides when labelling optdepends status as pending install
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-26 15:18:43 +10:00
Xyne
8ff03868a3 makepkg: Turn PACMAN_OPTS into an array
Avoid potential word expansion with future inclusions

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-26 15:18:43 +10:00
Allan McRae
1a29744d0d makepkg: Remove upx and optipng support
These options were added before libmakepkg allowed passes like this to be
dropped in.  I prefer only real core packaging tasks to be included in
makepkg and additional things like this to be dropped in by a user or
distribution that wants to support them.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-26 15:18:43 +10:00
Allan McRae
d4f499f563 libmakepkg: fix is_array function
This happened to work for the majority of cases because the only calling
function used a variable named "i" that was related to the variable being
passed to the function.

Fixes FS#48340.

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-26 15:18:43 +10:00
Allan McRae
df5dc0c9de Update NEWS for pacman-5.0.1
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-26 15:18:43 +10:00
Allan McRae
f38de43eb6 Release 5.0.1
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-23 13:46:25 +10:00
Allan McRae
9375715ae4 Regenerate translations for 5.0.1 2016-02-23 13:09:39 +10:00
Allan McRae
e2ca25623b Manually fix space before ellipses in translations
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-23 13:05:02 +10:00
Stefan Tatschner
cd4a3d03a0 Fix inconsistent status messages
This patch fixes an inconsistency in the status messages.

    :: Proceed with installation? [Y/n]
    :: Retrieving packages ...         <--- Space before "...".
     blas-3.6.0-4-x86_64
     cblas-3.6.0-4-x86_64
     lapack-3.6.0-4-x86_64
    (3/3) checking keys in keyring
    (3/3) checking package integrity
    (3/3) loading package files
    (3/3) checking for file conflicts
    (3/3) checking available disk space
    :: Processing package changes...  <--- No space before "..."
    (1/3) upgrading blas
    (2/3) upgrading cblas
    (3/3) upgrading lapack

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-23 12:56:52 +10:00
Allan McRae
5c136d85db Pull translation updates from Transifex
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-23 12:56:40 +10:00
Evangelos Foutras
c034a3322b makepkg: do not run prepare() with --noextract
This is partial revert of 8454daa7fe (makepkg: run pkgver() and
prepare() with --noextract).

Reasoning for the reversion (copied from FS#43498):

    Running prepare() when --noextract is used no longer allows running
    'makepkg -o && makepkg -e' with any PKGBUILD that applies patches in
    prepare(). [1]

    Sure there's --noprepare which restores the old behavior, but that's
    a lot of extra typing for what I believe is a much more common use
    of --noextract.

    For OP's use case of doing git bisects, you can specify the commit
    in the source array and thus skip --noextract since makepkg will
    checkout the correct commit each time.

    [1] I often extract the sources using 'makepkg -o', manually edit
    some source files, and then use 'makepkg -e' to package it (while
    possibly repeating the edit/package steps).

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-23 12:50:04 +10:00
Andrew Gregory
a724235b61 make alpm_unlock and trans_interrupt async safe
RET_ERR calls _alpm_log which includes calls that are not safe for use
in asynchronous signal handlers (see signal(7)).  Replace it in
functions called from our signal handlers with a new macro
RET_ERR_ASYNC_SAFE which is identical except that it lacks the call to
_alpm_log.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2016-02-23 12:41:36 +10:00
Andrew Gregory
1d6583a58d alpm_run_chroot: always connect parent2child pipe
Commit e374e6829c closed stdin before
running scripts/hooks.  This left the exec'd process with no file
descriptor 0.  If the process subsequently opened a file it would be
assigned fd 0, and could potentially be confused for stdin.  Connecting
and immediately closing the parent2child pipe ensures that the child has
an fd 0 and that it is empty.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-23 12:33:04 +10:00