From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/libnl/, dev-libs/libnl/files/
Date: Thu, 21 Apr 2022 23:02:15 +0000 (UTC) [thread overview]
Message-ID: <1650582119.4d6d5918a4ed8600271110fcc9e3fe5e96062af6.sam@gentoo> (raw)
commit: 4d6d5918a4ed8600271110fcc9e3fe5e96062af6
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 21 23:01:49 2022 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Apr 21 23:01:59 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4d6d5918
dev-libs/libnl: keyword 3.6.0 (w/ test fixes)
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../files/libnl-3.6.0-test-fixes-sandbox.patch | 160 +++++++++++++++++++++
dev-libs/libnl/libnl-3.6.0.ebuild | 8 +-
2 files changed, 164 insertions(+), 4 deletions(-)
diff --git a/dev-libs/libnl/files/libnl-3.6.0-test-fixes-sandbox.patch b/dev-libs/libnl/files/libnl-3.6.0-test-fixes-sandbox.patch
new file mode 100644
index 000000000000..deb60069955c
--- /dev/null
+++ b/dev-libs/libnl/files/libnl-3.6.0-test-fixes-sandbox.patch
@@ -0,0 +1,160 @@
+https://github.com/thom311/libnl/issues/308
+https://github.com/thom311/libnl/commit/85e3c5d423a0ab8f8414f892998323c886484725
+https://github.com/thom311/libnl/commit/ec712a4514e667b6f7fc3a54a10d4d4f65d1b5c7
+https://github.com/thom311/libnl/commit/7577266c03ddbf42257f6c43f42e5837a2671038
+
+From 85e3c5d423a0ab8f8414f892998323c886484725 Mon Sep 17 00:00:00 2001
+From: Thomas Haller <thaller@redhat.com>
+Date: Thu, 21 Apr 2022 08:39:51 +0200
+Subject: [PATCH] tests: add _assert_nltst_netns() helper
+
+--- a/tests/nl-test-util.c
++++ b/tests/nl-test-util.c
+@@ -25,6 +25,14 @@ struct nltst_netns {
+
+ /*****************************************************************************/
+
++#define _assert_nltst_netns(nsdata) \
++ do { \
++ const struct nltst_netns *_nsdata = (nsdata); \
++ \
++ ck_assert_ptr_nonnull(_nsdata); \
++ ck_assert_int_eq(_nsdata->canary, _CANARY); \
++ } while (0)
++
+ static struct {
+ struct nltst_netns *nsdata;
+ } _netns_fixture_global;
+@@ -34,12 +42,12 @@ void nltst_netns_fixture_setup(void)
+ ck_assert(!_netns_fixture_global.nsdata);
+
+ _netns_fixture_global.nsdata = nltst_netns_enter();
+- ck_assert(_netns_fixture_global.nsdata);
++ _assert_nltst_netns(_netns_fixture_global.nsdata);
+ }
+
+ void nltst_netns_fixture_teardown(void)
+ {
+- ck_assert(_netns_fixture_global.nsdata);
++ _assert_nltst_netns(_netns_fixture_global.nsdata);
+ _nl_clear_pointer(&_netns_fixture_global.nsdata, nltst_netns_leave);
+ }
+
+From ec712a4514e667b6f7fc3a54a10d4d4f65d1b5c7 Mon Sep 17 00:00:00 2001
+From: Thomas Haller <thaller@redhat.com>
+Date: Thu, 21 Apr 2022 08:41:03 +0200
+Subject: [PATCH] tests: cleanup unshare_user() and use _nltst_fclose()
+
+--- a/tests/nl-test-util.c
++++ b/tests/nl-test-util.c
+@@ -65,24 +65,27 @@ static void unshare_user(void)
+ _nltst_assert_errno(r == 0);
+
+ /* Since Linux 3.19 we have to disable setgroups() in order to map users.
+- * Just proceed if the file is not there. */
++ * Just proceed if the file is not there. */
+ f = fopen("/proc/self/setgroups", "we");
+ if (f) {
+- fprintf(f, "deny");
+- fclose(f);
++ r = fprintf(f, "deny");
++ _nltst_assert_errno(r > 0);
++ _nltst_fclose(f);
+ }
+
+ /* Map current UID to root in NS to be created. */
+ f = fopen("/proc/self/uid_map", "we");
+- ck_assert(f);
+- fprintf(f, "0 %d 1", uid);
+- fclose(f);
++ _nltst_assert_errno(f);
++ r = fprintf(f, "0 %d 1", uid);
++ _nltst_assert_errno(r > 0);
++ _nltst_fclose(f);
+
+ /* Map current GID to root in NS to be created. */
+ f = fopen("/proc/self/gid_map", "we");
+- ck_assert(f);
+- fprintf(f, "0 %d 1", gid);
+- fclose(f);
++ _nltst_assert_errno(f);
++ r = fprintf(f, "0 %d 1", gid);
++ _nltst_assert_errno(r > 0);
++ _nltst_fclose(f);
+ }
+
+ struct nltst_netns *nltst_netns_enter(void)
+--- a/tests/nl-test-util.h
++++ b/tests/nl-test-util.h
+@@ -34,6 +34,14 @@
+ _nltst_assert_errno(_r == 0); \
+ } while (0)
+
++#define _nltst_fclose(f) \
++ do { \
++ int _r; \
++ \
++ _r = fclose((f)); \
++ _nltst_assert_errno(_r == 0); \
++ } while (0)
++
+ /*****************************************************************************/
+
+ void nltst_netns_fixture_setup(void);
+From 7577266c03ddbf42257f6c43f42e5837a2671038 Mon Sep 17 00:00:00 2001
+From: Thomas Haller <thaller@redhat.com>
+Date: Thu, 21 Apr 2022 08:42:35 +0200
+Subject: [PATCH] tests: silently ignore EACCES for setting uid_map for test
+ namespace
+
+Seems this can happen, but we probably can just continue with the
+unit test. Just ignore the error.
+
+https://github.com/thom311/libnl/issues/ ## 308
+--- a/tests/nl-test-util.c
++++ b/tests/nl-test-util.c
+@@ -53,7 +53,7 @@ void nltst_netns_fixture_teardown(void)
+
+ /*****************************************************************************/
+
+-static void unshare_user(void)
++static bool unshare_user(void)
+ {
+ const uid_t uid = geteuid();
+ const gid_t gid = getegid();
+@@ -75,7 +75,11 @@ static void unshare_user(void)
+
+ /* Map current UID to root in NS to be created. */
+ f = fopen("/proc/self/uid_map", "we");
+- _nltst_assert_errno(f);
++ if (!f) {
++ if (errno == EACCES)
++ return false;
++ _nltst_assert_errno(f);
++ }
+ r = fprintf(f, "0 %d 1", uid);
+ _nltst_assert_errno(r > 0);
+ _nltst_fclose(f);
+@@ -86,6 +90,7 @@ static void unshare_user(void)
+ r = fprintf(f, "0 %d 1", gid);
+ _nltst_assert_errno(r > 0);
+ _nltst_fclose(f);
++ return true;
+ }
+
+ struct nltst_netns *nltst_netns_enter(void)
+@@ -96,8 +101,12 @@ struct nltst_netns *nltst_netns_enter(void)
+ nsdata = calloc(1, sizeof(struct nltst_netns));
+ ck_assert(nsdata);
+
+- nsdata->canary = _CANARY;
++ *nsdata = (struct nltst_netns){
++ .canary = _CANARY,
++ };
+
++ /* unshare_user() might fail to set uid_map/gid_map due to sandboxing.
++ * We ignore that error and proceed. The test will possibly still work. */
+ unshare_user();
+
+ r = unshare(CLONE_NEWNET | CLONE_NEWNS);
+
diff --git a/dev-libs/libnl/libnl-3.6.0.ebuild b/dev-libs/libnl/libnl-3.6.0.ebuild
index 5c1aeb096def..ab759e51347b 100644
--- a/dev-libs/libnl/libnl-3.6.0.ebuild
+++ b/dev-libs/libnl/libnl-3.6.0.ebuild
@@ -18,8 +18,7 @@ S="${WORKDIR}/${LIBNL_P}"
LICENSE="LGPL-2.1 utils? ( GPL-2 )"
SLOT="3"
-# Test failure: https://github.com/thom311/libnl/issues/308
-#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux"
IUSE="+debug python test utils"
RESTRICT="!test? ( test )"
@@ -32,8 +31,6 @@ BDEPEND="${RDEPEND}
test? ( dev-libs/check )"
REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
-DOCS=( ChangeLog )
-
MULTILIB_WRAPPED_HEADERS=(
# we do not install CLI stuff for non-native
/usr/include/libnl3/netlink/cli/addr.h
@@ -52,6 +49,7 @@ MULTILIB_WRAPPED_HEADERS=(
PATCHES=(
"${FILESDIR}"/${P}-static-tests.patch
+ "${FILESDIR}"/${P}-test-fixes-sandbox.patch
)
src_prepare() {
@@ -101,6 +99,8 @@ multilib_src_install() {
}
multilib_src_install_all() {
+ DOCS=( ChangeLog )
+
einstalldocs
find "${ED}" -name '*.la' -delete || die
next reply other threads:[~2022-04-21 23:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-21 23:02 Sam James [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-04-16 2:09 [gentoo-commits] repo/gentoo:master commit in: dev-libs/libnl/, dev-libs/libnl/files/ Sam James
2020-09-20 13:01 Jeroen Roovers
2015-08-19 5:11 Jeroen Roovers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1650582119.4d6d5918a4ed8600271110fcc9e3fe5e96062af6.sam@gentoo \
--to=sam@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox