diff --git a/srcpkgs/xbps/patches/0001-lib-repo_pkgdeps.c-check-correctly-for-errno-after-o.patch b/srcpkgs/xbps/patches/0001-lib-repo_pkgdeps.c-check-correctly-for-errno-after-o.patch new file mode 100644 index 00000000000..c7844782c75 --- /dev/null +++ b/srcpkgs/xbps/patches/0001-lib-repo_pkgdeps.c-check-correctly-for-errno-after-o.patch @@ -0,0 +1,41 @@ +From 3405866ae2be30807e1c1e28be33c2dbea3c3641 Mon Sep 17 00:00:00 2001 +From: Juan RP +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 + diff --git a/srcpkgs/xbps/patches/0003-xbps-rindex-clean-mode-fixed-random-false-positives-.patch b/srcpkgs/xbps/patches/0003-xbps-rindex-clean-mode-fixed-random-false-positives-.patch new file mode 100644 index 00000000000..b42aa15a169 --- /dev/null +++ b/srcpkgs/xbps/patches/0003-xbps-rindex-clean-mode-fixed-random-false-positives-.patch @@ -0,0 +1,75 @@ +From b21f4c9a59ce22e957acb3c688665afb41bc6c67 Mon Sep 17 00:00:00 2001 +From: Juan RP +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 + diff --git a/srcpkgs/xbps/template b/srcpkgs/xbps/template index 0ab0331e2a3..10542896986 100644 --- a/srcpkgs/xbps/template +++ b/srcpkgs/xbps/template @@ -1,7 +1,7 @@ # Template file for 'xbps' pkgname=xbps version=0.30 -revision=2 +revision=3 patch_args="-Np1" bootstrap=yes conf_files="/etc/xbps/xbps.conf"