Prevents the need to rename the file if we end up keeping it and ensures
that pacnew files always reflect the most recent version by overwriting
stale copies.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Leave user files in place and save new config files with a .pacnew
extension. This reduces the complexity of file extraction and respects
the principle that pacman shouldn't modify files it didn't create.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
If an error occurs the actual path being extracted is more useful than
the original path from the package file list. The original path is
still used for checks that use it directly.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
alpm's database files (.INSTALL, .MTREE, etc.) should be extracted no
matter what; skip mtree/needbackup/noextract/noupgrade checks for them.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
key points to a statically allocated string so it can't be NULL and
empty keys are rejected by the callback.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Reduces the number of errors the ini parser must handle to make it more
suitable for sharing with the backend.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Storing repo information removes the need for the final callback. This
allows the call signature to be re-purposed for indicating read errors.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
This will allow pacman to parse its config file in a single pass and
removes the need for the *_SET siglevels in alpm that were only required
for pacman's siglevel inheritance.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
It was allocating the required size rather than the calculated new size,
resulting in pathological incremental reallocations.
Signed-off-by: Daniel Micay <danielmicay@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
The files_size variable contains the current capacity (in bytes) and
should not be used to calculate the next length increment. It only works
because _alpm_greedy_grow currently results in incremental growth.
Signed-off-by: Daniel Micay <danielmicay@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
If an already used array is passed array_build, some entries from the old
array could be carried over if the old array was longer than the new one.
Clear the destination array before adding elements to it to prevent this
issue.
Fixes: https://bugs.archlinux.org/task/43387
Signed-off-by: Allan McRae <allan@archlinux.org>
die prints "at $scriptname line $linenumber." if the string does not
end with "\n". This information is not of much use for us and it makes
testing harder because we'd to remove it there.
Signed-off-by: Florian Pritz <bluewind@xinu.at>
I suspect this is just wrong -- you never need to quote the replacement
side of a PE. In bash 4.3, this is essentially a no-op, but because of
a bug in bash 4.2, we get embedded quotes as a result of this
replacement. The relevant changelog item in bash is:
Fixed a bug that caused single quotes that resulted from $'...' quoting
in the replacement portion of a double-quoted ${word/pat/rep} expansion
to be treated as quote characters.
But this doesn't apply to us. Let's just drop the excessive quoting...
Signed-off-by: Allan McRae <allan@archlinux.org>
When a shared library uses an absolute symlink for its its .so file, the check
if the shared version of a static library exists fails. Test for the presence
of a broken symlink too.
Signed-off-by: Allan McRae <allan@archlinux.org>
_alpm_pkg_dup leaves the destination pointer unaltered in case of fatal
errors, so when commits 2f0ca00e and be4198b3 freed the pointer, they
fixed a memory leak on non-fatal errors by replacing it with
a segmentation fault on fatal errors.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
The required adding a Database Option section to the pacman man page
and adding more complete documentation for --asdeps and --asexplicit
as well.
Signed-off-by: Allan McRae <allan@archlinux.org>
The functionality of testdb is now available in pacman. pacman -Dk will
check the local database for consistency, and pacman -Dkk will check the
sync databases.
Note that unlike testdb, you can not specify individual sync databases to
check as sync databases act as a whole and not individually. A single database
can be checked using an alternative pacman.conf file.
Signed-off-by: Allan McRae <allan@archlinux.org>