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
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.
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.
- Do not use nftw(3), this won't clean up the tree properly.
Rather use scandir(3) with alphasort, like xbps-create(1).
- Don't drop privs in the parent to make sure that the
temp overlayfs tree can be removed properly.
This fixes the issues while building go modules and others
with xbps-src.
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.
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.
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.
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