xbps: update to 0.31.

This commit is contained in:
Juan RP 2014-02-01 10:46:50 +01:00
parent 198b7183d7
commit 63a618f345
4 changed files with 3 additions and 154 deletions

View file

@ -1,41 +0,0 @@
From 3405866ae2be30807e1c1e28be33c2dbea3c3641 Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Thu, 30 Jan 2014 17:47:59 +0100
Subject: [PATCH 1/4] lib/repo_pkgdeps.c: check correctly for errno after our
call, not after free(3).
The issue was that xbps_pkgdb_get_pkg() did not find any package,
and the code was free(3)ing heap allocated memory before checking for
errno. I suspect that free(3) has touched errno and this errno value
has been propagated to the next code.
Found after a bit of testing on repo.voidlinux.eu.
---
lib/repo_pkgdeps.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/repo_pkgdeps.c b/lib/repo_pkgdeps.c
index 2103c4b..4003dfb 100644
--- a/lib/repo_pkgdeps.c
+++ b/lib/repo_pkgdeps.c
@@ -196,15 +196,16 @@ find_repo_deps(struct xbps_handle *xhp,
*/
if (((tmpd = xbps_pkgdb_get_pkg(xhp, pkgname)) == NULL) &&
((tmpd = xbps_pkgdb_get_virtualpkg(xhp, pkgname)) == NULL)) {
- free(pkgname);
if (errno && errno != ENOENT) {
/* error */
rv = errno;
xbps_dbg_printf(xhp, "failed to find "
"installed pkg for `%s': %s\n",
reqpkg, strerror(errno));
+ free(pkgname);
break;
}
+ free(pkgname);
/* Required pkgdep not installed */
xbps_dbg_printf_append(xhp, "not installed ");
reason = "install";
--
1.8.5.3

View file

@ -1,35 +0,0 @@
From fb5fb91fa3847ebecd67940bad30f045f5d02dc5 Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Tue, 28 Jan 2014 20:51:57 +0100
Subject: [PATCH] lib/transaction_commit.c: fix a double free (reported by
Hanspolo).
---
lib/transaction_commit.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/transaction_commit.c b/lib/transaction_commit.c
index 8c0f8db..8030863 100644
--- a/lib/transaction_commit.c
+++ b/lib/transaction_commit.c
@@ -166,6 +166,7 @@ download_binpkgs(struct xbps_handle *xhp, xbps_object_iterator_t iter)
*/
sigfile = xbps_xasprintf("%s.sig", file);
free(file);
+ file = NULL;
if (access(sigfile, R_OK) == -1) {
xbps_set_cb_state(xhp, XBPS_STATE_DOWNLOAD, 0, pkgver,
"Downloading `%s' signature (from `%s')...", pkgver, repoloc);
@@ -182,7 +183,8 @@ download_binpkgs(struct xbps_handle *xhp, xbps_object_iterator_t iter)
}
}
free(sigfile);
- free(file);
+ if (file != NULL)
+ free(file);
}
xbps_object_iterator_reset(iter);
--
1.8.5.3

View file

@ -1,75 +0,0 @@
From b21f4c9a59ce22e957acb3c688665afb41bc6c67 Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Wed, 29 Jan 2014 16:58:38 +0100
Subject: [PATCH 03/10] xbps-rindex: clean mode: fixed random false positives
with multiple threads.
---
bin/xbps-rindex/index-clean.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/bin/xbps-rindex/index-clean.c b/bin/xbps-rindex/index-clean.c
index ac2f0d9..72fd4c5 100644
--- a/bin/xbps-rindex/index-clean.c
+++ b/bin/xbps-rindex/index-clean.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2012-2013 Juan Romero Pardines.
+ * Copyright (c) 2012-2014 Juan Romero Pardines.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,6 +41,7 @@
struct cbdata {
xbps_array_t result;
xbps_dictionary_t idx;
+ pthread_mutex_t mtx;
const char *repourl;
};
@@ -74,8 +75,11 @@ idx_cleaner_cb(struct xbps_handle *xhp,
*/
xbps_dictionary_get_cstring_nocopy(obj,
"filename-sha256", &sha256);
- if (xbps_file_hash_check(filen, sha256) != 0)
+ if (xbps_file_hash_check(filen, sha256) != 0) {
+ pthread_mutex_lock(&cbd->mtx);
xbps_array_add_cstring_nocopy(cbd->result, pkgver);
+ pthread_mutex_unlock(&cbd->mtx);
+ }
}
free(filen);
return 0;
@@ -97,8 +101,11 @@ idxfiles_cleaner_cb(struct xbps_handle *xhp _unused, xbps_object_t obj _unused,
}
if ((pkg = xbps_dictionary_get(cbd->idx, pkgname))) {
xbps_dictionary_get_cstring_nocopy(pkg, "pkgver", &pkgver);
- if (strcmp(pkgver, key))
+ if (strcmp(pkgver, key)) {
+ pthread_mutex_lock(&cbd->mtx);
xbps_array_add_cstring_nocopy(cbd->result, key);
+ pthread_mutex_unlock(&cbd->mtx);
+ }
}
free(pkgname);
@@ -141,6 +148,8 @@ index_clean(struct xbps_handle *xhp, const char *repodir)
*/
cbd.repourl = repodir;
cbd.result = xbps_array_create();
+ pthread_mutex_init(&cbd.mtx, NULL);
+
allkeys = xbps_dictionary_all_keys(idx);
rv = xbps_array_foreach_cb_multi(xhp, allkeys, idx, idx_cleaner_cb, &cbd);
for (unsigned int x = 0; x < xbps_array_count(cbd.result); x++) {
@@ -171,6 +180,7 @@ index_clean(struct xbps_handle *xhp, const char *repodir)
flush = true;
}
+ pthread_mutex_destroy(&cbd.mtx);
xbps_object_release(cbd.result);
xbps_object_release(allkeys);
--
1.8.5.3

View file

@ -1,8 +1,8 @@
# Template file for 'xbps'
pkgname=xbps
version=0.30
revision=3
patch_args="-Np1"
version=0.31
revision=1
#patch_args="-Np1"
bootstrap=yes
conf_files="/etc/xbps/xbps.conf"
replaces="xbps>=0"