commit:     30d0bdb974112f7857d6e50efb7d6b4b2b1ec295
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 18 18:40:04 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Oct 18 18:41:04 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=30d0bdb9

app-arch/cpio: patch regressions in 2.13, allowing CVE-2021-38185 fix 
(unkeyworded)

To be keyworded after testing on more machines.

Bug: https://bugs.gentoo.org/699456
Bug: https://bugs.gentoo.org/807088
Bug: https://bugs.gentoo.org/854192
Closes: https://bugs.gentoo.org/700020
Signed-off-by: Sam James <sam <AT> gentoo.org>

 app-arch/cpio/Manifest                             |  1 +
 app-arch/cpio/cpio-2.13-r1.ebuild                  | 39 ++++++++++++++++++++++
 .../files/cpio-2.13-sysmacros-glibc-2.26.patch     | 12 +++++++
 3 files changed, 52 insertions(+)

diff --git a/app-arch/cpio/Manifest b/app-arch/cpio/Manifest
index e3d8f9e77f92..c9fcf3fa150e 100644
--- a/app-arch/cpio/Manifest
+++ b/app-arch/cpio/Manifest
@@ -1,2 +1,3 @@
 DIST cpio-2.12.tar.bz2 1258605 BLAKE2B 
4b6d42a1d8aaeaa980cab5894b2e264451e96a108f2c3aa89d3e6fde0bff338e026ee233ebd7c8cf41f3c926d42d38b866778244db774055736ca8792889e160
 SHA512 
0cd4da5f2fbca179ab4e666a5f878414c086a5f98bce4c76273f21d9b2a6fe422d901b5d453826c5f81bbe363aa015047a1e99779ad1a451c8feca6205c63120
+DIST cpio-2.13-CVE-2021-38185.patch.xz 7844 BLAKE2B 
e338950e03c3eed3b4288435c9c75af8f0c3497b43680be4ee347e628db7cfac616b437a848094bf82cfc2c7f29d59b388bf0f6368b3b99770022e3f9533be11
 SHA512 
4d2cafefcd1ae9d86cb5171de2896799713490dfd9ed27d3dce0886fa4588c8df2b16ad8508a5dbb9155c9de6e40b6d1083bdb4774d967193a270a1dcbe37a33
 DIST cpio-2.13.tar.bz2 1354559 BLAKE2B 
45d77723acb55f15c8574ab5a2fdff6fb1767629d177dd3416b0268e9f82ee6bdd11b4fa591ef020efccbdc3f4918cf77263169da1a0f6422dfe1a9712295778
 SHA512 
459398e69f7f48201c04d1080218c50f75edcf114ffcbb236644ff6fcade5fcc566929bdab2ebe9be5314828d6902e43b348a8adf28351df978c8989590e93a3

diff --git a/app-arch/cpio/cpio-2.13-r1.ebuild 
b/app-arch/cpio/cpio-2.13-r1.ebuild
new file mode 100644
index 000000000000..6005349fe120
--- /dev/null
+++ b/app-arch/cpio/cpio-2.13-r1.ebuild
@@ -0,0 +1,39 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit autotools
+
+DESCRIPTION="A file archival tool which can also read and write tar files"
+HOMEPAGE="https://www.gnu.org/software/cpio/cpio.html";
+SRC_URI="mirror://gnu/cpio/${P}.tar.bz2"
+SRC_URI+=" 
https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${P}-CVE-2021-38185.patch.xz";
+
+LICENSE="GPL-3+"
+SLOT="0"
+#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc 
~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos 
~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="nls"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-2.12-non-gnu-compilers.patch #275295
+       "${WORKDIR}"/${P}-CVE-2021-38185.patch
+       "${FILESDIR}"/${PN}-2.13-sysmacros-glibc-2.26.patch
+)
+
+src_prepare() {
+       default
+
+       # Drop after 2.13 (only here for CVE patch)
+       eautoreconf
+}
+
+src_configure() {
+       local myeconfargs=(
+               $(use_enable nls)
+               --bindir="${EPREFIX}"/bin
+               --with-rmt="${EPREFIX}"/usr/sbin/rmt
+       )
+
+       econf "${myeconfargs[@]}"
+}

diff --git a/app-arch/cpio/files/cpio-2.13-sysmacros-glibc-2.26.patch 
b/app-arch/cpio/files/cpio-2.13-sysmacros-glibc-2.26.patch
new file mode 100644
index 000000000000..0f902f060f86
--- /dev/null
+++ b/app-arch/cpio/files/cpio-2.13-sysmacros-glibc-2.26.patch
@@ -0,0 +1,12 @@
+--- a/am/ax_compile_check_rettype.m4
++++ b/am/ax_compile_check_rettype.m4
+@@ -70,6 +70,7 @@ AC_CACHE_VAL(AC_CV_NAME,
+ [for ac_type in char short int long "long long" $4
+  do 
+   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
++#include <sys/sysmacros.h>
+ #include <sys/types.h>
+ $3
+ ]], [[switch (0) case 0: case (sizeof ($1($2)) == sizeof ($ac_type)):;]])], 
[AC_CV_NAME=$ac_type])
+ 
+ 

Reply via email to