summaryrefslogtreecommitdiffstats
path: root/lib/libalpm
AgeCommit message (Collapse)AuthorFilesLines
2016-05-05Prevent wrapping of enum itemsAllan McRae2-2/+2
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-05fix spelling mistakesEric Engestrom4-4/+4
Signed-off-by: Eric Engestrom <eric@engestrom.ch> Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-26Use versions specified in optdependsAllan McRae1-1/+2
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-26Consider provides when warning about optdepnd removalAllan McRae1-1/+1
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-23Regenerate translations for 5.0.1Allan McRae41-1713/+2302
2016-02-23Pull translation updates from TransifexAllan McRae40-1062/+478
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-23make alpm_unlock and trans_interrupt async safeAndrew Gregory3-4/+10
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-23alpm_run_chroot: always connect parent2child pipeAndrew Gregory1-7/+6
Commit e374e6829cea3512f0b4a4069c5a6168f0f8d8a0 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-23ensure gpgdir has a trailing slashAndrew Gregory1-9/+3
init_gpgme checks for various paths under gpgdir by concatenating them directly, giving warning messages incorrectly if gpgdir does not end with '/'. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-23do not rely on localdb for hook matchingAndrew Gregory5-13/+17
Relying on localdb to determine which trigger operations should match is completely broken for PostTransaction hooks because the localdb has already been updated. Store a copy of the old version of any packages being updated to use instead. Fixes FS#47996 Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-21only remove pacnew file if it is newAndrew Gregory1-3/+7
Check if we overwrote an exiting pacnew file before unlinking it. Otherwise, updating to a version with an unchanged file would delete existing pacnew files. FS#47993 Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-20Log to file when running hooksOlivier Brunel1-1/+1
Useful if there's some output (to know where it comes from), or in case of failure. Signed-off-by: Olivier Brunel <jjk@jjacky.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2016-02-20Add the missing limits.h include to hook.cAlastair Hughes1-0/+1
PATH_MAX is only defined in limits.h in musl libc, so ensure that it is included. Presumably this is also required on other platforms. Signed-off-by: Alastair Hughes <hobbitalastair@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-30Update translationsAllan McRae21-156/+998
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-17Pull translations updates from TransifexAllan McRae46-1745/+1800
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-15Cast events to void* before passing to callbackAllan McRae2-4/+4
Silence warnings from clang about typecasting alignment. Reported-by: Rikard Falkeborn Original-patch-by: Olivier Brunel Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-15add alpm_list_appendAndrew Gregory2-10/+25
alpm_list_add always returns the provided list making it impossible for callers to check whether or not the operation actually succeeded without manually comparing the list length before and after. alpm_list_append instead returns a pointer to the newly created list item so that success can be checked. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-04Make alpm_graph state signedness explicitRikard Falkeborn1-1/+1
The signedness of char is implementation defined. Since the alpm_graph state is clearly meant to be signed, make the signedness explicit. This fixes bugs on systems where char is unsigned, in comparissons of the following type: if(v.state == -1) which, if state is unsigned, will never be true due to integer promotion rules. Fixes failing test/pacman/tests/sync012.py when compiling with -funsigned-char. Fixes two warnings [-Wtype-limits] for comparissons with -1 when compiling with -funsigned-char. Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-04Update copyright years for 2016Allan McRae52-52/+52
make update-copyright OLD=2015 NEW=2016 Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-04Do not warn about missing files in NoExtractAllan McRae1-2/+4
The CheckSpace option checks the size of all files in a package being replaced and gives a warning when it can not read the file. However, files in NoExtract are expected to be missing and should not be warned about. Fixes FS#47470. Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-15alpm: Abort ASAP on failure in pre-transaction hooksOlivier Brunel1-0/+8
There is no need to run any/remaining pre-transaction hooks as soon as a failure has occured, which will lead to aborting the transaction. So if an error occured during the first phase (reading directories/parsing files), or as soon as a hook flagged abort_on_fail does fail, we stop processing them and return. (For post-transaction hooks, all hooks are run regardless since there's no aborting.) Signed-off-by: Olivier Brunel <jjk@jjacky.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-15alpm-hooks: add Description fieldAllan McRae2-0/+7
The "Description" field allows a hook to provide a some text for frontends to use in describing what the hook is doing. For example: Description = updating info page directory Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-15Show progress processing hooksAllan McRae2-3/+32
Introduces the ALPM_EVENT_HOOK_RUN_{START,DONE} events that are triggered at the start and end of running an individual hook. Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-15Add ALPM_EVENT_TRANSACTION_{START,DONE} eventsAllan McRae2-0/+9
This provides a way to detect when the processing of package changes starts, allowing pacman to delineate hook output and package installation/removal output. Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-15Add events ALPM_EVENT_HOOK_{START,DONE}Olivier Brunel3-9/+33
Add events to let frontends know when hooks are being processed (and when it's done), as that might be useful to update the UI. Signed-off-by: Olivier Brunel <jjk@jjacky.com>
2015-12-15Collect all triggered hooks before running themAllan McRae1-1/+10
Having a first pass that checks which hooks are triggered followed by a second pass of the triggered hooks allows us to only provide output when a hook is actually triggered. Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-09Pull translations from Transifex and prepare for next releaseAllan McRae47-4491/+8097
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-06alpm_run_chroot: remove dead codeAndrew Gregory1-5/+0
Removes a leftover error message from when fdopen and fgets were used to read from the pipe. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-05alpm_initialize: Fix double slash in sys hook dir pathDavid Macek1-2/+5
The path of the default system hook directory was created by concatenating `myhandle->root` (usually "/"), and SYSHOOKDIR (usually "/usr/share/libalpm/hooks/"), resulting in "//usr/share/libalpm/hooks/". Fix this by skipping the initial slash from SYSHOOKDIR. Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-05db_update: always clear db flags after updateAndrew Gregory1-22/+23
Signature downloading and DB validation was being based on the most recent download status for the DB. If a DB successfully downloaded but a signature did not, db_update would move to the next server. If the next server tried does not have a more recent copy of the DB, db_update would not download the DB again and would forget that the DB had previously been updated. In this case it would skip validation entirely, leaving an updated DB with the original validation status. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-05add and expose alpm_unlockAndrew Gregory2-2/+18
alpm_unlock is a limited version of alpm_release that does nothing but the actual unlinking of the lock file and is therefore safe to call from signal handlers. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-05handle_unlock: return 0 if lockfile == NULLAndrew Gregory1-1/+1
Returning -1 is useless since we don't provide any way to determine why it failed. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-05skip conflicts resolved by file replacementAndrew Gregory1-0/+15
When replacing a file with a directory, any files inside the new directory cannot possibly exist on the filesystem and can be skipped. This allows cross-package symlink-to-directory transitions when there are files with the same name under both the symlinked directory and the new directory. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-05always unlink files before extractionAndrew Gregory1-8/+3
libarchive will not extract a directory over an existing directory symlink, making it impossible to replace a symlink with a directory across packages. Adding the ARCHIVE_EXTRACT_UNLINK and ARCHIVE_EXTRACT_SECURE_SYMLINKS causes libarchive to unlink the existing symlink and prevents it from extracting any paths that contain a symlink, which we should not be doing anyway. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-04Add large file support CFLAGS to pkgconfig fileAllan McRae1-1/+1
Large file support is enabled by our configure script as required. If anything linking to libalpm does not also define large file support, there will be differences in the size of off_t which are not caught until runtime. Add the required CFLAGS to the pkg-config file so that users of libalpm know what flags are required. Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-28run_chroot: always clear script output bufferAndrew Gregory1-0/+6
If the script output does not end in a newline there could still be data in the buffer after the poll loop. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-28hooks: pass matched targets to hooksAndrew Gregory1-17/+110
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-28allow specifying input to scriptletsAndrew Gregory4-29/+179
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-28allow arguments in hook Exec fieldsAndrew Gregory1-5/+124
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-11Use correct format specifiersRikard Falkeborn4-4/+4
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-03ensure realloc has a positive sizeAndrew Gregory2-6/+14
If given size 0 POSIX allows realloc to return a pointer that is not suitable for use. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-28_alpm_hook_run: check path length before copyingAndrew Gregory1-8/+19
If a hook path equals or exceeds PATH_MAX characters the path will be left unterminated. Pre-calculating the path length also allows us to use the more efficient memcpy over strncpy. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-27hook.c: print invalid option nameAndrew Gregory1-1/+1
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-27order hooks by file nameAndrew Gregory1-0/+8
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-27Alpm, check for NULL in free-functionsRikard Falkeborn6-3/+11
Also, use FREE() instead of free() in _alpm_backup_free() to set the pointers to NULL. Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-27Use ARRAYSIZE macro for non-string array size computationPierre Neidhardt1-1/+1
Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-18validate hooks after parsingAndrew Gregory1-1/+64
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-18run hooks during trans_commitAndrew Gregory8-0/+294
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-18add hook data types and parserAndrew Gregory2-0/+188
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-18handle: add hookdirs optionAndrew Gregory5-0/+75
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>