summaryrefslogtreecommitdiff
path: root/src/pacman/pacman.c
AgeCommit message (Collapse)Author
2019-05-15increased machine size in pacman.c by oneHEADmasterAndreas Baumann
fixed around letting machine not NUL-terminated when architecture is 'petntium4'
2019-05-15change "i686" to "pentium4" if sse2 is availableErich Eckner
2019-02-12Add implicit fall through warningAllan McRae
Requires modification to our comment about fall through to match compilers expectations. Works for GCC and Clang. Signed-off-by: Allan McRae <allan@archlinux.org>
2018-08-10Remove the last traces of the pacman --force optionAllan McRae
Signed-off-by: Allan McRae <allan@archlinux.org>
2018-07-25Revert "Deprecate --root in favour of --sysroot"Allan McRae
The use of --sysroot in the real world has flagged some issues that need addressing. Undeprecate --root for now. This reverts commit a278356f75866f89232e3e6230bbf9fb2dc1893c. Signed-off-by: Allan McRae <allan@archlinux.org>
2018-05-14Remove all modelines from the projectEli Schwartz
Many of these are pointless (e.g. there is no need to explicitly turn on spellchecking and language dictionaries for the manpages by default). The only useful modelines are the ones enforcing the project coding standards for indentation style (and "maybe" filetype/syntax, but everything except the asciidoc manpages and makepkg.conf is already autodetected), and indent style can be applied more easily with .editorconfig Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2018-03-14Update coyrights for 2018Allan McRae
make update-copyright OLD=2017 NEW=201 Signed-off-by: Allan McRae <allan@archlinux.org>
2018-01-19Deprecate --root in favour of --sysrootAllan McRae
The --root option was widely misunderstood, and is now replaced by --sysroot. Signed-off-by: Allan McRae <allan@archlinux.org>
2017-05-16remove unused byte from user agent bufferAndrew Gregory
snprintf prints at most n bytes including the terminating '\0'. The extra reserved byte was never being used. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2017-05-16check for overflow when setting HTTP_USER_AGENTAndrew Gregory
gcc7 issues a warning about a potential overflow if left unchecked. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2017-04-16add --sysroot optionAndrew Gregory
--root is not sufficient to properly operate on a mounted guest system. Using --root still uses the host system's configuration and there is no way to correctly use the guest configuration without manually modifying any Include directives. --sysroot provides an easier way to operate on a guest system by chrooting immediately after option parsing before configuration parsing or performing any operations. It is currently limited to the root user, but that's enough for restoring a guest system to a working state, which is the primary intended use case. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2017-04-12deprecate --force in favor of --overwriteAndrew Gregory
--force is widely misunderstood and the same effect can now be achieved with --overwrite, which is better named and can be used more safely. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2017-04-12add --overwrite option to ignore file conflictsAndrew Gregory
Allows for safer, more fine-grained control for overwriting files than --force's all-or-nothing approach. Implements FS#31549. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2017-04-04parse stdin as newline-separatedAndrew Gregory
Newline-separated input is more reliable because most of the arguments we accept over stdin can validly contain spaces but not newlines. Resolves FS#52992 Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2017-01-13Introduce a 'disable-download-timeout' optionChristian Hesse
Add command line option ('--disable-download-timeout') and config file option ('DisableDownloadTimeout') to disable defaults for low speed limit and timeout on downloads. Use this if you have issues downloading files with proxy and/or security gateway. Signed-off-by: Christian Hesse <mail@eworm.de> Signed-off-by: Allan McRae <allan@archlinux.org>
2017-01-04Update copyright yearsAllan McRae
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-12-05Give a "success!" message on database checkPatrick Eigensatz
'pacman -Dk' prints a "success!" message if there were no errors. It is possible to suppress the output using the '-q / --quiet' flag. This implements the feature discussed at https://bugs.archlinux.org/task/50087 Signed-off-by: Patrick Eigensatz <patrick.eigensatz@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-04Update copyright years for 2016Allan McRae
make update-copyright OLD=2015 NEW=2016 Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-05remove soft interrupt handler before cleanupAndrew Gregory
The soft interrupt handler dereferences config, causing a segfault if it is called during cleanup. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-05extract soft interrupt handlersAndrew Gregory
Delays handler setup until after config is set to a valid value to avoid a segmentation fault. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-05extract SIGSEGV handlerAndrew Gregory
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-05extract SIGWINCH handlerAndrew Gregory
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 Gregory
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 Gregory
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 Gregory
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 Gregory
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 Gregory
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-11-04add --quiet to -FhAndrew Gregory
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-03Add -F --machinereadable optionFlorian Pritz
Signed-off-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-27Use ARRAYSIZE macro for non-string array size computationPierre Neidhardt
Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-18pacman: add user hook directoriesAndrew Gregory
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-07-15Add regex search option to sync database file searchingAllan McRae
e.g. pacman -Fsx kcm.*print.*\.so Signed-off-by: Allan McRae <allan@archlinux.org>
2015-07-15Prototype pacman files database operationsAllan McRae
Add the -F/--files operations, -s/--sync support and nd provide dummy functions for -s/--search, -l/-list and -o/--owns. Signed-off-by: Allan McRae <allan@archlinux.org>
2015-07-14Fix formatting in parsearg_upgradeAllan McRae
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-01Update copyright notices for 2015Allan McRae
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-01-02Integrate testdb into pacmanAllan McRae
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>
2014-12-18shut up GCC on -Wmaybe-initialized warningsDave Reisner
Admittedly, these are totally bogus, but a clean build is a happy build. Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-18Fix pointer declarations to be globally consistentMicah Saint Germain
Refactored inconsistent pointer declarations to better improve consistency throughout the pacman codebase which will, in turn, increase readability to the user. Expected format of a pointer declaration: `typename *varname` Signed-off-by: Micah Saint Germain <micah@lexme.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-05Add --assume-installed to pacman --helpFlorian Pritz
Signed-off-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-10-13pacman: add --confirm optionAndrew Gregory
--confirm cancels the effect of a previous --noconfirm. This makes it easier for scripts to default to --noconfirm but allow users to override it. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-30Add --assume-installed optionFlorian Pritz
This allows to ignore specific dependencies. Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-09-23pacman.c: Add -gg, -ii, and -yy to help summaryJohannes Löthberg
The sync help summaries was missing the information about: * -gg: View all groups and members * -ii: View extended information * -yy: Force refresh even if DBs are up to date Fixes FS#41388. Original-work-by: Earnestly <zibeon@gmail.com> Signed-off-by: Johannes Löthberg <johannes@kyriasis.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-23pacman: set SA_RESTART for signal handlerAndrew Gregory
Calling a signal handler interrupts some functions, most notably read() and therefore fgets(). Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2014-08-04pacman.c: simplify stdin parsingAndrew Gregory
Incorporate memory exhaustion and end-of-stream checks into the main loop. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-06-29cache terminal size, add SIGWINCH handler to resetDave Reisner
Refactoring getcols, yet again. We do the following: 1) Introduce a static global in src/pacman/util.c 2) getcols always prefers this cached value, but will derive it from the COLUMNS environment var, the characteristics of stdout, or a sane default (in that order). 3) Introduce a SIGWINCH signal handler to reset the cached value, meaning we only call ioctl when we don't know the value. On my machine, pacman -Syy goes from ~4300 ioctl calls to 3.
2014-06-29Revert refactoring in fa0c1e14Allan McRae
This will cause the code to break as soon as we handle another signal such as SIGWINCH... Signed-off-by: Allan McRae <allan@archlinux.org>
2014-06-24pacman: Correct signal handler comment and refactorSilvan Jegen
One of the comments for this function is out of sync with the code. Since the code exhibits the more sane behavior of treating SIGINT and SIGHUB the same way (by not exiting pacman when there is a commit in flight) we adjust the comment. Given this code flow, the if/else statements can be simplified somewhat as well. Signed-off-by: Silvan Jegen <s.jegen@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-06-23Move break to a new line for consistencyHong Shick Pak
This was the only break that didn't have its own line in the function parsearg_query. Signed-off-by: Hong Shick Pak <hong@hspak.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-05-25Clarify that -Ql prints a file listAllan McRae
FS#40234 Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-27check config_new return valueAndrew Gregory
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>