summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2015-12-05extract SIGSEGV handlerAndrew Gregory3-17/+29
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-05extract SIGWINCH handlerAndrew Gregory3-5/+22
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-05move signal handlers to sighandler.[ch]Andrew Gregory4-58/+122
Signals are special because they run asynchronously, making them non-trivial to handle correctly. Move the handlers a separate file to offset them from the normal code and make them easier to separate into individual functions without further cluttering pacman.c Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-05avoid unsafe functions in signal handlerAndrew Gregory1-9/+7
signal(7) lists a set of functions that can safely be called from within a signal handler. Even fileno and strlen are not guaranteed to be safe. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-05remove SIG_IGN check when setting signal handlerAndrew Gregory1-6/+2
Our signal handler provides a way to gracefully interrupt a transaction and should always be set. The check appears to have originally been copied directly from the glibc manual. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-05do not catch SIGTERMAndrew Gregory1-3/+2
On SIGTERM pacman was exiting immediately, even in the middle of a transaction. In this case we should leave the lock file in place as an indication that the database may not be in a consistent state. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-05pacman: exit without memory cleanup on signalsAndrew Gregory1-2/+2
Memory allocation/deallocation functions are not safe to call from signal handlers. Just remove the lock file if there is one and exit immediately. Fixes: FS#46375, FS#45995, FS#47011 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 Gregory2-2/+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-05Detect potential conflict when symlink to directory is changing to directoryAllan McRae2-0/+29
When a symlink to a directory is changing to a directory, any package file inside the new directory can create an unexpected conflict with the filesystem. Reported by Neofytos and Luca from Chakra. Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-04Add large file support CFLAGS to pkgconfig fileAllan McRae2-1/+10
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-28pacdiff: do not require DIFFPROG for -o/--outputEvangelos Foutras1-1/+1
Signed-off-by: Evangelos Foutras <evangelos@foutrelis.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-28hooks: pass matched targets to hooksAndrew Gregory4-17/+156
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 Gregory4-7/+150
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-28tap.py: replace newlines with escape sequenceAndrew Gregory1-1/+1
Newlines clutter tap output and can potentially confuse TAP parsers. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-28pmrule.py: add FILE_CONTENTS ruleAndrew Gregory2-0/+7
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-23lint_pkgbuild/variable: increase robustnessAllan McRae1-12/+54
Approach the detection of variables of the wrong type using an approach similar to that used for construction of .SRCINFO files. While doing silly things in bash could still result in false negatives, this approach should be very robust to generatinf false positives results. Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-23makepkg: merge arch dependent variables after PKGBUILD lintingAllan McRae1-8/+8
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-23makepkg: remove obsolete commentAllan McRae1-1/+0
Behaviour changed in commit dce82f9d. Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-23lint_pkgbuild: explicitly return valueAllan McRae5-4/+12
Set the return value to be local and always explictly returns it. Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-11Refactor strtrim functionSilvan Jegen1-9/+5
Signed-off-by: Silvan Jegen <s.jegen@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-11Use correct format specifiersRikard Falkeborn7-14/+14
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-05Refactor lint_source to work with earlier versions of BashAaron Campbell1-1/+1
Negative subscripts to indexed arrays are not supported before 4.2. However, since substring expansion works on arrays, we can specify an offset of -1 to be taken relative to one greater than the maximum index of the specified array (see Parameter Expansion section of the bash man page). This works with both Bash 4.1 and 4.2, and 4.1 is already the oldest supported by pacman. Signed-off-by: Aaron Campbell <aaron@monkey.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-04files_search: reset found for each targetAndrew Gregory1-1/+2
Otherwise any invalid targets following a successful match will not get an error message. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-04files_search: free compiled regexAndrew Gregory1-0/+3
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-04files: do not unnecessarily strdup targetsAndrew Gregory1-25/+10
Targets are never modified so we can just use the original copy. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-04files.c: add vim modelineAndrew Gregory1-1/+2
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-04add detail to broken dependency errorsAndrew Gregory2-6/+24
The difference between a sync target having an unmet dependency and breaking a dependency for an installed package is a common source of confusion. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-04add --quiet to -FhAndrew Gregory1-0/+1
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> 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-11-03zsh_completion: Handle --ignore/--ignoregroup correctlyMohammad Alsaleh1-4/+17
Completion now works as expected with a comma-separated sequence. Signed-off-by: Mohammad Alsaleh <CE.Mohammad.AlSaleh@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-03package.c: Fix incorrect buffersize and constant-foldingPierre Neidhardt1-4/+3
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com> Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-03Add -F --machinereadable optionFlorian Pritz4-6/+55
Signed-off-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-03Document pacman -FFlorian Pritz1-0/+29
Signed-off-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-28scripts/po: fix translated file nameAllan McRae1-1/+1
This file was renamed during review and its entry in POTFILES.in was not updated. 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-28makepkg: fix $pkgname element duplicationBenjamin Yates1-2/+2
run_split_packaging did not preserve the $pkgname array correctly, and would create duplicate entries in the list during restore. After restoring the backup (a b c) would become (a b c b c). This probably went unnoticed because during --install, pacman would reconcile the duplicates. Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-27libmakepkg: fix pkgver checkingAllan McRae1-2/+2
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-27add alpm-hooks man pageAndrew Gregory3-0/+123
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-27Align titles automatically in information displayPierre Neidhardt1-32/+141
Signed-off-by: Pierre Neidhardt <ambrevar@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-27zsh_completion: Add --asdeps/--asexplicit to -U optionsMohammad Alsaleh1-0/+2
Signed-off-by: Mohammad Alsaleh <CE.Mohammad.AlSaleh@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-27Use ARRAYSIZE macro for non-string array size computationPierre Neidhardt5-4/+6
Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-22makepkg: Fix hard-coded debug suffixMohammad Alsaleh1-2/+2
Signed-off-by: Mohammad Alsaleh <CE.Mohammad.AlSaleh@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>