summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2022-04-25 16:45:11 +0100
committerSam James <sam@gentoo.org>2022-04-25 16:45:56 +0100
commite67bb84b2c008c569b7e1113260b3ca029b266bb (patch)
tree422b1169d88b59554cc6811720d7d2bb14e75e6d /app-crypt
parentdev-python/lark-parser: Remove old (diff)
downloadgentoo-e67bb84b2c008c569b7e1113260b3ca029b266bb.tar.gz
gentoo-e67bb84b2c008c569b7e1113260b3ca029b266bb.tar.bz2
gentoo-e67bb84b2c008c569b7e1113260b3ca029b266bb.zip
app-crypt/gnupg: backport 2.3.5 hang fix
Closes: https://bugs.gentoo.org/840746 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'app-crypt')
-rw-r--r--app-crypt/gnupg/files/gnupg-2.3.5-fix-buffering-hang.patch52
-rw-r--r--app-crypt/gnupg/gnupg-2.3.5-r2.ebuild162
2 files changed, 214 insertions, 0 deletions
diff --git a/app-crypt/gnupg/files/gnupg-2.3.5-fix-buffering-hang.patch b/app-crypt/gnupg/files/gnupg-2.3.5-fix-buffering-hang.patch
new file mode 100644
index 000000000000..3ff8d2afcf6f
--- /dev/null
+++ b/app-crypt/gnupg/files/gnupg-2.3.5-fix-buffering-hang.patch
@@ -0,0 +1,52 @@
+https://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=commitdiff;h=2fc91e15c6bebb203162cc8445e68ee4ff934885;hp=2848fe4c84e5ee20ccd90f0ef4c9f78c6801e1f6
+https://bugs.gentoo.org/840746
+
+From: NIIBE Yutaka <gniibe@fsij.org>
+Date: Mon, 25 Apr 2022 17:37:32 +0900
+Subject: [PATCH 1/1] common:iobuf: Exclude cases with
+ IOBUF_INPUT_TEMP/IOBUF_OUTPUT_TEMP.
+
+* common/iobuf.c (iobuf_read): Handle a case with IOBUF_INPUT_TEMP.
+(iobuf_write): Handle a case with IOBUF_OUTPUT_TEMP.
+
+--
+
+GnuPG-bug-id: 5941
+Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
+--- a/common/iobuf.c
++++ b/common/iobuf.c
+@@ -2177,7 +2177,8 @@ iobuf_read (iobuf_t a, void *buffer, unsigned int buflen)
+ a->e_d.len = 0;
+
+ /* Hint for how full to fill iobuf internal drain buffer. */
+- a->e_d.preferred = (buf && buflen >= IOBUF_ZEROCOPY_THRESHOLD_SIZE);
++ a->e_d.preferred = (a->use != IOBUF_INPUT_TEMP)
++ && (buf && buflen >= IOBUF_ZEROCOPY_THRESHOLD_SIZE);
+
+ n = 0;
+ do
+@@ -2200,7 +2201,7 @@ iobuf_read (iobuf_t a, void *buffer, unsigned int buflen)
+ underflow to read more data into the filter's internal
+ buffer. */
+ {
+- if (buf && n < buflen)
++ if (a->use != IOBUF_INPUT_TEMP && buf && n < buflen)
+ {
+ /* Setup external drain buffer for faster moving of data
+ * (avoid memcpy). */
+@@ -2328,11 +2329,13 @@ iobuf_write (iobuf_t a, const void *buffer, unsigned int buflen)
+ a->e_d.len = 0;
+
+ /* Hint for how full to fill iobuf internal drain buffer. */
+- a->e_d.preferred = (buflen >= IOBUF_ZEROCOPY_THRESHOLD_SIZE);
++ a->e_d.preferred = (a->use != IOBUF_OUTPUT_TEMP)
++ && (buflen >= IOBUF_ZEROCOPY_THRESHOLD_SIZE);
+
+ do
+ {
+- if (a->d.len == 0 && buflen >= IOBUF_ZEROCOPY_THRESHOLD_SIZE)
++ if ((a->use != IOBUF_OUTPUT_TEMP)
++ && a->d.len == 0 && buflen >= IOBUF_ZEROCOPY_THRESHOLD_SIZE)
+ {
+ /* Setup external drain buffer for faster moving of data
+ * (avoid memcpy). */
diff --git a/app-crypt/gnupg/gnupg-2.3.5-r2.ebuild b/app-crypt/gnupg/gnupg-2.3.5-r2.ebuild
new file mode 100644
index 000000000000..d32419deb726
--- /dev/null
+++ b/app-crypt/gnupg/gnupg-2.3.5-r2.ebuild
@@ -0,0 +1,162 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/gnupg.asc
+inherit flag-o-matic systemd toolchain-funcs verify-sig
+
+MY_P="${P/_/-}"
+
+DESCRIPTION="The GNU Privacy Guard, a GPL OpenPGP implementation"
+HOMEPAGE="https://gnupg.org/"
+SRC_URI="mirror://gnupg/gnupg/${MY_P}.tar.bz2"
+SRC_URI+=" verify-sig? ( mirror://gnupg/gnupg/${P}.tar.bz2.sig )"
+S="${WORKDIR}/${MY_P}"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~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="bzip2 doc ldap nls readline selinux +smartcard ssl test +tofu tpm tools usb user-socket wks-server"
+RESTRICT="!test? ( test )"
+REQUIRED_USE="test? ( tofu )"
+
+# Existence of executables is checked during configuration.
+# Note: On each bump, update dep bounds on each version from configure.ac!
+DEPEND=">=dev-libs/libassuan-2.5.0
+ >=dev-libs/libgcrypt-1.9.1:=
+ >=dev-libs/libgpg-error-1.41
+ >=dev-libs/libksba-1.3.4
+ >=dev-libs/npth-1.2
+ >=net-misc/curl-7.10
+ bzip2? ( app-arch/bzip2 )
+ ldap? ( net-nds/openldap:= )
+ readline? ( sys-libs/readline:0= )
+ smartcard? ( usb? ( virtual/libusb:1 ) )
+ tofu? ( >=dev-db/sqlite-3.27 )
+ tpm? ( >=app-crypt/tpm2-tss-2.4.0:= )
+ ssl? ( >=net-libs/gnutls-3.0:0= )
+ sys-libs/zlib
+"
+
+RDEPEND="${DEPEND}
+ app-crypt/pinentry
+ nls? ( virtual/libintl )
+ selinux? ( sec-policy/selinux-gpg )
+ wks-server? ( virtual/mta )"
+
+BDEPEND="virtual/pkgconfig
+ doc? ( sys-apps/texinfo )
+ nls? ( sys-devel/gettext )
+ verify-sig? ( sec-keys/openpgp-keys-gnupg )"
+
+DOCS=(
+ ChangeLog NEWS README THANKS TODO VERSION
+ doc/FAQ doc/DETAILS doc/HACKING doc/TRANSLATE doc/OpenPGP doc/KEYSERVER
+)
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-2.1.20-gpgscm-Use-shorter-socket-path-lengts-to-improve-tes.patch
+ "${FILESDIR}"/${P}-fix-buffering-hang.patch
+)
+
+src_prepare() {
+ default
+
+ # Inject SSH_AUTH_SOCK into user's sessions after enabling gpg-agent-ssh.socket in systemctl --user mode,
+ # idea borrowed from libdbus, see
+ # https://gitlab.freedesktop.org/dbus/dbus/-/blob/master/bus/systemd-user/dbus.socket.in#L6
+ #
+ # This cannot be upstreamed, as it requires determining the exact prefix of 'systemctl',
+ # which in turn requires discovery in Autoconf, something that upstream deeply resents.
+ sed -e "/DirectoryMode=/a ExecStartPost=-${EPREFIX}/bin/systemctl --user set-environment SSH_AUTH_SOCK=%t/gnupg/S.gpg-agent.ssh" \
+ -i doc/examples/systemd-user/gpg-agent-ssh.socket || die
+}
+
+src_configure() {
+ local myconf=(
+ $(use_enable bzip2)
+ $(use_enable nls)
+ $(use_enable smartcard scdaemon)
+ $(use_enable ssl gnutls)
+ $(use_enable tofu)
+ $(use_enable tofu keyboxd)
+ $(use_enable tofu sqlite)
+ $(usex tpm '--with-tss=intel' '--disable-tpm2d')
+ $(use smartcard && use_enable usb ccid-driver || echo '--disable-ccid-driver')
+ $(use_enable wks-server wks-tools)
+ $(use_with ldap)
+ $(use_with readline)
+ --with-mailprog=/usr/libexec/sendmail
+ --disable-ntbtls
+ --enable-all-tests
+ --enable-gpgsm
+ --enable-large-secmem
+ CC_FOR_BUILD="$(tc-getBUILD_CC)"
+ GPG_ERROR_CONFIG="${ESYSROOT}/usr/bin/${CHOST}-gpg-error-config"
+ KSBA_CONFIG="${ESYSROOT}/usr/bin/ksba-config"
+ LIBASSUAN_CONFIG="${ESYSROOT}/usr/bin/libassuan-config"
+ LIBGCRYPT_CONFIG="${ESYSROOT}/usr/bin/${CHOST}-libgcrypt-config"
+ NPTH_CONFIG="${ESYSROOT}/usr/bin/npth-config"
+ $("${S}/configure" --help | grep -o -- '--without-.*-prefix')
+ )
+
+ if use prefix && use usb; then
+ # bug #649598
+ append-cppflags -I"${EPREFIX}/usr/include/libusb-1.0"
+ fi
+
+ #bug 663142
+ if use user-socket; then
+ myconf+=( --enable-run-gnupg-user-socket )
+ fi
+
+ # glib fails and picks up clang's internal stdint.h causing weird errors
+ [[ ${CC} == *clang ]] && \
+ export gl_cv_absolute_stdint_h=/usr/include/stdint.h
+
+ # Hardcode mailprog to /usr/libexec/sendmail even if it does not exist.
+ # As of GnuPG 2.3, the mailprog substitution is used for the binary called
+ # by wks-client & wks-server; and if it's autodetected but not not exist at
+ # build time, then then 'gpg-wks-client --send' functionality will not
+ # work. This has an unwanted side-effect in stage3 builds: there was a
+ # [R]DEPEND on virtual/mta, which also brought in virtual/logger, bloating
+ # the build where the install guide previously make the user chose the
+ # logger & mta early in the install.
+
+ econf "${myconf[@]}"
+}
+
+src_compile() {
+ default
+
+ use doc && emake -C doc html
+}
+
+src_test() {
+ #Bug: 638574
+ use tofu && export TESTFLAGS=--parallel
+ default
+}
+
+src_install() {
+ default
+
+ use tools &&
+ dobin \
+ tools/{convert-from-106,gpg-check-pattern} \
+ tools/{gpgconf,gpgsplit,lspgpot,mail-signed-keys} \
+ tools/make-dns-cert
+
+ dosym gpg /usr/bin/gpg2
+ dosym gpgv /usr/bin/gpgv2
+ echo ".so man1/gpg.1" > "${ED}"/usr/share/man/man1/gpg2.1 || die
+ echo ".so man1/gpgv.1" > "${ED}"/usr/share/man/man1/gpgv2.1 || die
+
+ dodir /etc/env.d
+ echo "CONFIG_PROTECT=/usr/share/gnupg/qualified.txt" >> "${ED}"/etc/env.d/30gnupg || die
+
+ use doc && dodoc doc/gnupg.html/* doc/*.png
+
+ systemd_douserunit doc/examples/systemd-user/*.{service,socket}
+}