commit:     4798ad6134c3978c821512fc7850c64514b1f373
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 27 23:50:51 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Oct 27 23:50:51 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4798ad61

app-crypt/p11-kit: backport tty fix; drop castxml dep

* Backport tty fix
* Drop castxml dep, as it's not required, and castxml needs Clang. If we used it
  only if installed, we'd get a non-deterministic build.

Closes: https://bugs.gentoo.org/916376
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/p11-kit-0.25.1-fix-tty-comparison.patch  | 22 ++++++++++++++++++++++
 ...-kit-0.25.1.ebuild => p11-kit-0.25.1-r1.ebuild} | 16 +++++++++++++++-
 2 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/app-crypt/p11-kit/files/p11-kit-0.25.1-fix-tty-comparison.patch 
b/app-crypt/p11-kit/files/p11-kit-0.25.1-fix-tty-comparison.patch
new file mode 100644
index 000000000000..b97a71396e26
--- /dev/null
+++ b/app-crypt/p11-kit/files/p11-kit-0.25.1-fix-tty-comparison.patch
@@ -0,0 +1,22 @@
+https://github.com/p11-glue/p11-kit/commit/cdc4720d29466e717aa694a85a7aee86ebb94172
+
+From cdc4720d29466e717aa694a85a7aee86ebb94172 Mon Sep 17 00:00:00 2001
+From: Erdem Meydanli <[email protected]>
+Date: Thu, 26 Oct 2023 15:18:24 +0000
+Subject: [PATCH] fix: improper comparison
+
+Compare the return value of the readpassphrase function to NULL.
+
+Signed-off-by: Erdem Meydanli <[email protected]>
+--- a/p11-kit/tty.c
++++ b/p11-kit/tty.c
+@@ -66,7 +66,7 @@ p11_pin_tty_callback (const char *pin_source,
+       if (asprintf (&prompt, "%s: ", pin_description) < 0)
+               return NULL;
+ 
+-      if (readpassphrase (prompt, buf, sizeof(buf), 0) < 0)
++      if (readpassphrase (prompt, buf, sizeof(buf), 0) == NULL)
+               goto cleanup;
+ 
+       pin = p11_kit_pin_new_for_string (buf);
+

diff --git a/app-crypt/p11-kit/p11-kit-0.25.1.ebuild 
b/app-crypt/p11-kit/p11-kit-0.25.1-r1.ebuild
similarity index 80%
rename from app-crypt/p11-kit/p11-kit-0.25.1.ebuild
rename to app-crypt/p11-kit/p11-kit-0.25.1-r1.ebuild
index be3e638e329e..ed2b437d4844 100644
--- a/app-crypt/p11-kit/p11-kit-0.25.1.ebuild
+++ b/app-crypt/p11-kit/p11-kit-0.25.1-r1.ebuild
@@ -26,12 +26,15 @@ DEPEND="${RDEPEND}"
 BDEPEND="
        ${PYTHON_DEPS}
        app-text/docbook-xsl-stylesheets
-       dev-libs/castxml
        virtual/pkgconfig
        gtk-doc? ( dev-util/gtk-doc )
        nls? ( sys-devel/gettext )
 "
 
+PATCHES=(
+       "${FILESDIR}"/${P}-fix-tty-comparison.patch
+)
+
 src_prepare() {
        default
 
@@ -46,7 +49,18 @@ multilib_src_configure() {
        # Disable unsafe tests, bug#502088
        export FAKED_MODE=1
 
+       local native_file="${T}"/meson.${CHOST}.${ABI}.ini.local
+
+       # p11-kit doesn't need this to build and castxml needs Clang. To get
+       # a deterministic non-automagic build, always disable the search for
+       # castxml.
+       cat >> ${native_file} <<-EOF || die
+       [binaries]
+       castxml='castxml-falseified'
+       EOF
+
        local emesonargs=(
+               --native-file "${native_file}"
                -Dbashcompdir="$(get_bashcompdir)"
                -Dtrust_module=enabled
                -Dtrust_paths="${EPREFIX}"/etc/ssl/certs/ca-certificates.crt

Reply via email to