Commit Graph

1542 Commits

Author SHA1 Message Date
f906f5a83d xbps_register_pkg: keep stored props in pkgdb on updates.
I noticed that while updating a pkg that is on hold
or in repolock mode, does not keep those properties.

Always set those props in the new pkg dictionary to respect
this behaviour. If there's a pkg on hold and you update it,
you want to keep it in this state unless you tell it to change.

Added new test case to verify.
2020-04-22 12:00:26 +02:00
d5251a9c23 xbps_init: fix typo in debug output.
For #264
2020-04-20 20:20:29 +02:00
e155ba6d20 lib/package_alternatives.c: revert back to orig order.
my mistake, I somehow confused it.
2020-04-20 10:32:14 +02:00
35ae128826 lib/fetch: fix CID 284966 in a different way.
Hopefully this fixes it for real.
2020-04-20 10:31:13 +02:00
8663c3bd75 lib/fetch/common.c: fix CID 284959 (NULL returns).
Also fix previous CID.
2020-04-19 11:53:28 +02:00
359721baa6 lib/fetch/common.c: fix CID 284966 (Resource leak). 2020-04-19 11:43:54 +02:00
7b623783c8 lib/package_alternatives.c: fix CID 284970 (Resource leak).
Also fix calloc args order.
2020-04-19 11:38:09 +02:00
c5904cc6ef lib/conf.c: fix CID 284952 (Identical branches). 2020-04-19 11:22:17 +02:00
96acc6d8ef lib/portableproplib/prop_object.c: fix CID 284969 (Double free). 2020-04-19 11:17:39 +02:00
83d87ce05b lib/transaction_files.c: fix CID 284958 (Resource leak). 2020-04-19 11:17:02 +02:00
debfcf1273 Use xbps_repo_release() where applicable. 2020-04-19 11:09:05 +02:00
4990a2dd91 lib/Makefile: bump LIBXBPS_MICRO. 2020-04-14 20:27:54 +02:00
70efe5c63a repo: introduce xbps_repo_release(), misc changes.
- xbps_repo_release(): new function to release all resources
  associated with a repository object.

- xbps_repo_close(): this now just closes the file descriptor
  associated with the archive and associated resources.

- repo_open_local: after getting the repository dictionaries,
  use xbps_repo_close() to release archive resources.

Bump XBPS_API_VERSION.
2020-04-14 20:27:54 +02:00
bd707acfee repo: fix a double free with invalid repodata.
Fixes #248

Added new test case to verify.
2020-03-31 18:36:04 +02:00
044f75450b lib/transaction_check_revdeps.c: fix previous fix
Don't set transaction type from inside the revdep check,
if the package is being removed then there is not point
in continueing checking if its breaks.

Referencing #245
2020-03-05 00:40:47 +01:00
aed9402d62 lib/transaction_check_revdeps.c: fix regression in revdeps check
this is probably the same as reported in #245.

Its again not resetting/initializing a variable in a loop,
falling back to the previous set value.
2020-03-04 23:51:06 +01:00
5737d9a941 xbps-fetch: TIMEOUT_CONNECTION to customize time waiting for response 2020-03-03 08:15:00 +01:00
24bbfffba1 xbps_transaction_prepare: fix stats for removals. 2020-02-25 08:43:52 +01:00
77c72f9c2c lib/plist_find.c: fix false positive detecting vpkgs.
If target pkg was matched via xbps_pkg_version(), it was
incorrectly accessing the first vpkg stored.
2020-02-24 10:22:52 +01:00
cc601e1e91 xbps_repo_get_{virtual,}pkg: add debug on match. 2020-02-24 10:22:15 +01:00
c3830670f8 lib/transaction_files.c: cleanup memory 2020-02-23 22:18:34 +01:00
64f96ec940 transaction_files.c: port to uthash 2020-02-23 22:18:34 +01:00
657a717855 xbps_get_pkg_fulldeptree: switch to uthash.
There are still two users that can benefit from
uthash: transaction_files.c and xbps-fbulk.

cc @duncaen
2020-02-23 22:18:34 +01:00
c8d676f10e xbps_find_pkg_orphans: fix for #234
Make sure "automatic" bool is initialized to false before
checking its value. This way if xbps_dictionary_get_bool()
fails, "automatic" will be set to false.

Closes #234
2020-02-22 00:00:22 +01:00
f9ccd9b627 xbps_transaction_prepare: set transd stats correctly.
- if pkg trans type is UPDATE or REMOVE, don't set
  download stats, we don't need them.
- Simplify code.
2020-02-21 10:51:20 +01:00
06c9891ae3 xbps_transaction_*: multiple performance improvements (v2).
This commit implements multiple performance improvements
to the transaction code:

- Don't process xbps_pkg_name() N times each time we access
  its package dictionary (via pkgdb or rpool), just do it once
  at xbps_pkgdb_init() time. At pkgdb init time, it just creates
  a property in pkgdb, "pkgname". At rpool time, each time a
  package is accessed, the "pkgname" string property is added.

- The package transaction dictionary contains the "transaction"
  object to know what's the pkg type. This has been changed to an
  uint8, this simplifies the logic and it's faster than checking
  a string object. See xbps_trans_type_t and xbps_transaction_pkg_type().

- Fixed the issue that was marked with XXX in transaction shlibs
  checking code. This has been fixed and improved and resources are
  now just freed as expected.

- Simplified random code all over the place, avoiding unnecessary
  allocations or operations.

- Rename some transaction files to have a better description.

This is my first rototill to the code in 2020.
2020-02-21 09:37:32 +01:00
4d6d328c62 xbps_transaction_prepare: fix for XBPS_FLAG_DOWNLOAD_ONLY.
We don't really care if all pkgs are on hold, so modify
logic to avoid this part and exit early.
2020-02-18 09:07:03 +01:00
1b9dc3cc4d xbps_transaction_prepare: set "total-download-size" correctly.
- It was set only with XBPS_FLAG_DOWNLOAD_ONLY.
- Simplify the logic.

In response to #187 and #230
2020-02-18 08:34:41 +01:00
3ad575178e lib/initend.c: use new xbps_path_* functions 2020-02-14 19:20:54 +01:00
0f61a1a5a2 lib/util_path.c: add some util functions to work with paths 2020-02-14 19:20:54 +01:00
fba65ad9da xbps_transaction_store: ensure no multiple versions.
This change ensures that no multiple versions of the same pkg
are added to the transaction; if a new version of the same
package is being added as a dependency, compare stored
and current and use the greatest one.

This fixes the recent issue seen in the aarch64 builders, where
two versions of the same package were added to the transaction.

Added a new test case.
2020-02-14 08:41:35 +01:00
fbba38b006 lib/util_hash.c: add conditions to avoid misuse without asserts 2020-02-10 15:03:54 +01:00
d99aae586a lib/download.c: fix digestlen assert and add if condition to avoid misuse 2020-02-10 15:03:54 +01:00
2ef79bcc09 lib/util_hash.c: change asserts to allow at least X buffer length 2020-02-10 13:32:17 +01:00
9efa72f5c8 lib/package_config_files.c: use _get_cstring_nocopy for sha256_orig 2020-02-10 13:32:17 +01:00
0d90534236 libxbps: ABI/API break due to hash function changes 2020-02-10 13:32:17 +01:00
aa4d726dca lib/package_register.c: make sure to error out if copy fails 2020-02-10 13:32:17 +01:00
dca2223cb7 lib/transaction_store.c: store a copy in transaction packages array
This fixes multiple use after frees, found with AddressSanitizers.

* xbps_package_register: the pkgdb dictionary is replaced with
  the new one.
* xbps_pkgdb_update: here the pkgdb is externalized, freed and
  internalized.
2020-02-10 13:32:14 +01:00
3eed9bca59 xbps_array_foreach_cb_multi: use PTHREAD_MUTEX_INITIALIZER.
We use defaults, no need to use pthread_mutex_init().
2020-02-10 09:14:50 +01:00
c460df6011 xbps_array_foreach_cb_multi: switch to a mutex.
There's no reason to use a spin lock.
2020-02-10 09:08:33 +01:00
835834ff73 xbps_repo_open: fix memleak in error paths. 2020-02-10 09:07:00 +01:00
02c9cb11c4 configuration: add keepconf option
Add configuration option keepconf that stops xbps from overwriting
unchanged configuration files. If keepconf=true, xbps will store the new
configuration as <name>.new-<version> instead of overwriting unchanged
configuration files.
2020-02-08 21:06:04 +01:00
c4019aa923 xbps_transaction_files: fixed another memleak.
Thanks valgrind
2020-02-08 20:22:42 +01:00
2d7e3d7b1a xbps_transaction_remove_pkg: fix a memleak.
Thanks valgrind
2020-02-08 20:12:11 +01:00
58217d412d xbps_transaction_files: fix a memleak.
Thanks valgrind!
2020-02-08 20:08:03 +01:00
460515bf41 lib/util.c: add assertions everywhere. 2020-02-08 20:00:56 +01:00
6010a24de6 libxbps: ABI/API break due to xbps_pkg{,pattern}_name changes.
The funcs xbps_pkg_name() and xbps_pkgpattern_name() were
using malloc(3) to return the result, until now.

They now have been changed to not allocate the result
via malloc, the caller is responsible to provide a buffer
at least of XBPS_NAME_SIZE (64).

If for whatever reason the pkgname can't be guessed,
returns false. This should avoid lots of small allocs
around libxbps.

New functions have the following prototype:

bool xbps_pkg_name(char *dst, size_t len, const char *pkg)
bool xbps_pkgpattern_name(char *dst, size_t len, const char *pkg)

as suggested by @duncaen.
2020-02-08 19:49:57 +01:00
66bea965dc xbps_register_pkg: switch to localtime_r(3).
lgtm suggested that localtime() is not reentrant,
so that we now use localtime_r() instead.

lgtm reports 0 alerts after this change, yay.
2020-02-08 13:34:57 +01:00
732a0e6bdf alternatives: fixed replace_alternative_with_symlink test case.
Only 1 expected failure now!
2020-02-07 09:43:47 +01:00
94b56d7539 alternatives: do not remove symlinks if provider != target pkg.
This fixes the keep_provider_on_update test case, submitted
by @st3r4g via #219.

While checking for obsoletes make sure current provider
also matches the current target pkg.

Fixes #219
2020-02-07 09:16:57 +01:00