From e40a0d08f7a57d349bc6ab954a925e33957c8b17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Buchm=C3=BCller?= Date: Tue, 7 Aug 2018 08:41:00 +0200 Subject: [PATCH] xbps: fix build with gcc-8.2.0 Closes: #1650 [via git-merge-pr] --- srcpkgs/xbps/patches/fix-confdir-size.patch | 42 +++++++++++++++++++++ srcpkgs/xbps/patches/fix-rootdir-size.patch | 25 ++++++++++++ srcpkgs/xbps/patches/fix-strncat-dash.patch | 14 +++++++ 3 files changed, 81 insertions(+) create mode 100644 srcpkgs/xbps/patches/fix-confdir-size.patch create mode 100644 srcpkgs/xbps/patches/fix-rootdir-size.patch create mode 100644 srcpkgs/xbps/patches/fix-strncat-dash.patch diff --git a/srcpkgs/xbps/patches/fix-confdir-size.patch b/srcpkgs/xbps/patches/fix-confdir-size.patch new file mode 100644 index 00000000000..fec9f99a816 --- /dev/null +++ b/srcpkgs/xbps/patches/fix-confdir-size.patch @@ -0,0 +1,42 @@ +--- tests/xbps/libxbps/config/main.c 2018-07-30 13:47:08.000000000 +0200 ++++ tests/xbps/libxbps/config/main.c 2018-08-07 08:37:37.900690953 +0200 +@@ -39,6 +39,8 @@ + struct xbps_handle xh; + const char *tcsdir; + char *buf, *buf2, pwd[PATH_MAX]; ++ char confdir[PATH_MAX + 1 + sizeof("xbps.d")]; ++ size_t len; + + /* get test source dir */ + tcsdir = atf_tc_get_config_var(tc, "srcdir"); +@@ -48,7 +50,9 @@ + + xbps_strlcpy(xh.rootdir, pwd, sizeof(xh.rootdir)); + xbps_strlcpy(xh.metadir, pwd, sizeof(xh.metadir)); +- snprintf(xh.confdir, sizeof(xh.confdir), "%s/xbps.d", pwd); ++ len = snprintf(confdir, sizeof(confdir), "%s/xbps.d", pwd); ++ ATF_REQUIRE_EQ((len < sizeof(xh.confdir)), 1); ++ memcpy(xh.confdir, confdir, len + 1); + + ATF_REQUIRE_EQ(xbps_mkpath(xh.confdir, 0755), 0); + +@@ -88,6 +88,8 @@ + struct xbps_handle xh; + const char *tcsdir; + char *buf, *buf2, pwd[PATH_MAX]; ++ char confdir[PATH_MAX + 1 + sizeof("xbps.d")]; ++ size_t len; + + /* get test source dir */ + tcsdir = atf_tc_get_config_var(tc, "srcdir"); +@@ -97,7 +99,9 @@ + + xbps_strlcpy(xh.rootdir, tcsdir, sizeof(xh.rootdir)); + xbps_strlcpy(xh.metadir, tcsdir, sizeof(xh.metadir)); +- snprintf(xh.confdir, sizeof(xh.confdir), "%s/xbps.d", pwd); ++ len = snprintf(confdir, sizeof(confdir), "%s/xbps.d", pwd); ++ ATF_REQUIRE_EQ((len < sizeof(xh.confdir)), 1); ++ memcpy(xh.confdir, confdir, len + 1); + + ATF_REQUIRE_EQ(xbps_mkpath(xh.confdir, 0755), 0); + diff --git a/srcpkgs/xbps/patches/fix-rootdir-size.patch b/srcpkgs/xbps/patches/fix-rootdir-size.patch new file mode 100644 index 00000000000..d7ca7b26588 --- /dev/null +++ b/srcpkgs/xbps/patches/fix-rootdir-size.patch @@ -0,0 +1,25 @@ +--- lib/initend.c 2018-07-30 13:47:08.000000000 +0200 ++++ lib/initend.c 2018-08-07 08:28:24.261662391 +0200 +@@ -398,6 +398,7 @@ + { + struct utsname un; + char cwd[PATH_MAX-1], sysconfdir[XBPS_MAXPATH+sizeof(XBPS_SYSDEFCONF_PATH)], *buf; ++ char relpath[PATH_MAX+1+XBPS_MAXPATH]; + const char *repodir, *native_arch; + int rv; + +@@ -412,9 +413,13 @@ + xhp->rootdir[0] = '/'; + xhp->rootdir[1] = '\0'; + } else if (xhp->rootdir[0] != '/') { ++ size_t len; + buf = strdup(xhp->rootdir); +- snprintf(xhp->rootdir, sizeof(xhp->rootdir), "%s/%s", cwd, buf); ++ len = snprintf(relpath, sizeof(relpath), "%s/%s", cwd, buf); + free(buf); ++ if (len >= XBPS_MAXPATH) ++ return ENOTSUP; ++ memcpy(xhp->rootdir, relpath, len + 1); + } + xbps_dbg_printf(xhp, "%s\n", XBPS_RELVER); + /* set confdir */ diff --git a/srcpkgs/xbps/patches/fix-strncat-dash.patch b/srcpkgs/xbps/patches/fix-strncat-dash.patch new file mode 100644 index 00000000000..acabf41865d --- /dev/null +++ b/srcpkgs/xbps/patches/fix-strncat-dash.patch @@ -0,0 +1,14 @@ +--- bin/xbps-checkvers/main.c 2018-07-30 13:47:08.000000000 +0200 ++++ bin/xbps-checkvers/main.c 2018-08-07 08:47:03.070720109 +0200 +@@ -599,9 +599,9 @@ + else + rcv->pkgd = xbps_rpool_get_pkg(&rcv->xhp, srcver); + +- srcver = strncat(srcver, "-", 1); ++ srcver = strncat(srcver, "-", 2); + srcver = strncat(srcver, version.v.s, version.v.len); +- srcver = strncat(srcver, "_", 1); ++ srcver = strncat(srcver, "_", 2); + srcver = strncat(srcver, revision.v.s, revision.v.len); + + xbps_dictionary_get_cstring_nocopy(rcv->pkgd, "pkgver", &repover);