Age | Commit message (Collapse) | Author |
|
Conflicts:
src/pacman/util.c
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Replace "/tmp" with "${TMPDIR:-/tmp}" to allow for overriding the
hardcoded path.
Since we only use "/tmp" in conjunction with mktemp(1), we could also
have used "--tmpdir", which is GNU-ish, however (and the BSD counterpart
"-t" has been deprecated in GNU mktemp).
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
This includes some fixes to the messages that are displayed when a
signal is caught in makepkg or repo-add:
* Instead of always showing "==> ERROR: TERM signal caught. Exiting...",
replace "TERM" by whatever signal is actually caught.
* Fix a typo in the SIGERR error message in repo-add ("occurred" instead
of "occured"). Francois already fixed this for makepkg in 1e51b81c.
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
There is a small chance that a user sends SIGINT (or any other signal
that is trapped) when we're already in clean_up() which used to lead to
trap_exit() being executed and the remaining code in clean_up() being
skipped due to the bash signal/trap handler blocking EXIT (since its
handler is already being executed, even if it's interrupted).
In practice, this behaviour caused unexpected results (primarily because
pressing ^C at the wrong time left a lock file behind):
$ ./repo-add extra.db.tar.gz foobar
==> Extracting database to a temporary location...
^C
==> ERROR: Aborted by user! Exiting...
$ ./repo-add extra.db.tar.gz foobar
==> Extracting database to a temporary location...
==> ERROR: File 'foobar' not found.
==> No packages modified, nothing to do.
^C
==> ERROR: Aborted by user! Exiting...
$ ./repo-add extra.db.tar.gz foobar
==> ERROR: Failed to acquire lockfile: extra.db.tar.gz.lck.
==> ERROR: Held by process 18522
Fix this and reduce the chance of race conditions in signal handlers by:
* Unhooking all traps in both clean_up() and trap_exit().
* Call clean_up() explicitly in trap_exit() to make sure we remove the
lock file and the temporary directory even if we send SIGINT when
clean_up() is already being executed but didn't reach the unhook code
yet.
Also, add an optional parameter to clean_up() to allow for setting an
explicit exit code when we call clean_up() from trap_exit().
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
This should help point users in the right direction if they have not
initialized via pacman-key just yet.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
This one is pretty darn useless. Just derefence the ->data attribute
since the type is public anyway and save yourself the function call.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
This will be useful when extending disk space checks to free space
checking before we download package files.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Instead of iterating character by character, use memchr() calls to
hopefully speed up the search. A newline is the most likely culprit, so
search for that first followed by a NULL byte if there was no newline in
the buffer.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
In the default configuration, we can enter the signing code but still
have nothing to do with GPGME- for example, if database signatures are
optional but none are present. Delay initialization of GPGME until we
know there is a signature file present or we were passed base64-encoded
data.
This also makes debugging with valgrind a lot easier as you don't have
to deal with all the GPGME error noise because their code leaks like a
sieve.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
This had the unfortunate implementation detail that depended on the
strings having 1 byte == 1 column hold true. As we know, this is not at
all the case once you move past the base ASCII character set.
Reimplement this whole thing so it doesn't depend on format strings at
all. Instead, simply calculate the max column widths, and then when
displaying each row add the correct amount of padding using UTF-8 safe
string length functions.
Before:
名字 旧版本新版本 净变化 下载大小
libgee 0.6.2.1-1 0.60 MiB 0.10 MiB
libsocialweb 0.25.19-2 1.92 MiB 0.23 MiB
folks 0.6.3.2-1 1.38 MiB 0.25 MiB
After:
名字 旧版本 新版本 净变化 下载大小
libgee 0.6.2.1-1 0.60 MiB 0.10 MiB
libsocialweb 0.25.19-2 1.92 MiB 0.23 MiB
folks 0.6.3.2-1 1.38 MiB 0.25 MiB
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
If you need zero-filled allocations, call CALLOC() instead.
This was from the original definition of these macros in commit
cc754bc6e3be0f3; hopefully our code is in the shape it needs to be to
switch this behavior.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
These backup-related paths in package extraction are used on relatively
few files during the install process, so bump them off the stack and
into the heap. This removes the artificial PATH_MAX limitation on their
length as well.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
This moves the repetitive (and highly unlikely) logging work to a
single location.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
This will always be a 64-bit signed integer rather than the variable length
time_t type. Dates beyond 2038 should be fully supported in the library; the
frontend still lags behind because 32-bit platforms provide no localtime64()
or equivalent function to convert from an epoch value to a broken down time
structure.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
This prepares the function to handle values past year 2038. The return type
is still limited to 32-bits on 32-bit systems; this will be adjusted in a
future patch.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
We have a few incomplete translations, but these should be addressable
before the 4.0.1 maint release that is surely not that far in the
future.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
This screws up gettext and causes the message to display always
untranslated.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
In prep for the 4.0.0 release.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Similar to what we did in edd9ed6a, disconnect the relationship with our
stack allocated error buffer from the curl handle. Just as an FTP
connection might have some network chatter on teardown causing the
progress callback to be triggered, we might also hit an error condition
that causes curl to write to our (now out of scope) error buffer.
I'm unable to reproduce FS#26327, but I have a suspicion that this
should fix it.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Our error message used to be very unclear when the configuration file
could not be found:
$ ./pactree -lsr gtk
error: failed to register sync DBs
Instead, display an accurate message and include the file name:
$ ./pactree -lsr gtk
error: config file /usr/local/etc/pacman.conf could not be read
Also, move the error message inside register_syncs() to allow for
differentiating between different errors that might require a handler in
the future.
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
This allows for specifying an alternate configuration file path, similar
to pacman's "--config" option.
Given that there is currently no other way to tell pactree to read from
another configuration file (except for patching or symlinking), this
seems totally sensible - even if there are plans to refactor and/or
replace the standalone configuration file parser.
We do not define a short option for the sake of consistency with
pacman's set of command line options.
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Inline comments after pkgver or pkgrel would cause the sanity
checks to fail so remove them before checking the value.
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Make the output into a single block and add separators at the end
so that they do not merge into each other.
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
The original code- pkg_dir="$(echo $pac_db/$pkg_name-[0-9]*)" is
problematic in several ways:
- $pac_db and $pkg_name should be quoted, obviously.
- It assumes pkgver always starts with an integer, while in fact
it just can't contain ':' and '-'.
Counterexample: the code breaks on lshw B.02.15-1.
- It assumes there are no more than one directory matching the
pattern. While this should be the case if everything works
perfectly, it certainly relies on external conditions.
Counterexample: if the local db contains two packages named
foo and foo-3g, even if everything else is perfect, the code
will match two directories.
Don't make assumptions, use what is known.
Signed-off-by: lolilolicon <lolilolicon@gmail.com>
|
|
bacman should support whatever makepkg does as PKGEXT.
Also remove obsolete $EXT variable.
Signed-off-by: lolilolicon <lolilolicon@gmail.com>
|
|
This includes:
- Quoting fixes.
- Drop deprecated mktemp option -p.
- Set extglob nullglob shell options at the top.
- Use extended globbing instead of regex to match %HEADER% in pacman db.
Signed-off-by: lolilolicon <lolilolicon@gmail.com>
|
|
Another style change. The [[ expression ]] form is particularly
cleaner, safer and more powerful than the [ expression ] form.
Signed-off-by: lolilolicon <lolilolicon@gmail.com>
|
|
As every piece of code in the whole project uses TAB as indentation
character, bacman shouldn't be an exception.
Signed-off-by: lolilolicon <lolilolicon@gmail.com>
|
|
This will have to be picked up downstream of course, but addresses
FS#25684 now that this is a lot faster in 4.0 than it was in the
original 3.5 implementation.
Also make curl the first XferCommand listed, as we are moving away from
any other download program at this point.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
This makes the maintainer's life (read: my life) a lot easier when
updating translation files to push to Transifex.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
This allows it to serve double-duty. In order to allow users to base
verification decisions off of both a valid signature and a trusted
signature, we need to assign some level of owner trust to the keys we
designate as trusted on import.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
* --import now only imports keys from pubkey.gpg and does not import
owner trust; if you want to have both simply run the operations in
sequence.
* --import-trustdb has been simplified; it will overwrite existing
values in the trust database as before, but there is no need to export
it first as those values are safe if left untouched.
* Fix the manpage referring to a non-existent option.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
This was a bad oversight on my part, pointed out by Jakob. Whoops.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
If PKGEXT is not one of the recognized tar*'s, create_package() would
create an empty package file and fail, since bsdtar on the left side of
the pipe returns 141 on SIGPIPE (broken pipe).
This patch changes the behavior for an invalid PKGEXT. A warning is
printed on stderr, and a tar file is created. Also retire the obsolete
$EXT variable.
Add the obligatory comment why we don't use bsdtar's compression.
Finally, fix mixed-tab-space indentation.
Signed-off-by: lolilolicon <lolilolicon@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
|
|
Another place where we were doing the dirty work by hand.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
SRCEXT should allow whatever PKGEXT does.
Also address an uninitialized use of $ret.
Signed-off-by: lolilolicon <lolilolicon@gmail.com>
|
|
Expose the current static get_pkgpath() function internally to the rest
of the library as _alpm_local_db_pkgpath(). This allows use of this
convenience function in add.c and remove.c when forming the path to the
scriptlet location.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Add an is_archive parameter to reduce the amount of black magic going
on. Rework to use fewer PATH_MAX sized local variables, and simplify
some of the logic where appropriate in both this function and in the
callers where duplicate calls can be replaced by some conditional
parameter code.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Always quote the right-hand side of expression when the == or != operator
is used, unless intended as a pattern.
Signed-off-by: lolilolicon <lolilolicon@gmail.com>
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Declare and initialize integer variables 'needsroot' and 'verbose'.
Don't use the fact that (( undefined_variable )) evaluates to 0.
Signed-off-by: lolilolicon <lolilolicon@gmail.com>
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|