summaryrefslogtreecommitdiff
path: root/gnu/packages/patches
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/patches')
-rw-r--r--gnu/packages/patches/gnupg-default-pinentry.patch62
-rw-r--r--gnu/packages/patches/hash-extender-test-suite.patch13
2 files changed, 56 insertions, 19 deletions
diff --git a/gnu/packages/patches/gnupg-default-pinentry.patch b/gnu/packages/patches/gnupg-default-pinentry.patch
index 272f4b53dc..a8ed613565 100644
--- a/gnu/packages/patches/gnupg-default-pinentry.patch
+++ b/gnu/packages/patches/gnupg-default-pinentry.patch
@@ -1,15 +1,65 @@
-Default to the pinentry program installed in ~/.guix-profile.
+Make GnuPG automatically find a pinentry installed by Guix. Try using
+$HOME or, if that variable is not set, use the system password database,
+or fall back to looking in "/".
+
+More information:
+
+https://bugs.gnu.org/24076
diff --git a/common/homedir.c b/common/homedir.c
-index e9e75d0..74e0aaf 100644
+index 4b6e46e88..f7ae68ba5 100644
--- a/common/homedir.c
+++ b/common/homedir.c
-@@ -968,7 +968,7 @@ get_default_pinentry_name (int reset)
+@@ -33,6 +33,7 @@
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <unistd.h>
++#include <pwd.h>
+
+ #ifdef HAVE_W32_SYSTEM
+ #include <winsock2.h> /* Due to the stupid mingw64 requirement to
+@@ -67,6 +68,10 @@
+ * gnupg_homedir and gnupg_set_homedir. Malloced. */
+ static char *the_gnupg_homedir;
+
++/* The user's home directory. Used in Guix to help GnuPG find the
++ * pinentry. */
++static char *the_user_homedir;
++
+ /* Flag indicating that home directory is not the default one. */
+ static byte non_default_homedir;
+
+@@ -509,6 +514,25 @@ gnupg_homedir (void)
+ return the_gnupg_homedir;
+ }
+
++/* Return the user's home directory */
++const char *
++user_homedir (void)
++{
++ const char *dir;
++ dir = getenv("HOME");
++ if (dir == NULL)
++ {
++ struct passwd *pw = NULL;
++ pw = getpwuid (getuid ());
++ if (pw != NULL)
++ dir = pw->pw_dir;
++ else
++ dir = "/";
++ }
++ if (!the_user_homedir)
++ the_user_homedir = make_absfilename (dir, NULL);
++ return the_user_homedir;
++}
+
+ /* Return whether the home dir is the default one. */
+ int
+@@ -971,6 +995,7 @@ get_default_pinentry_name (int reset)
} names[] = {
/* The first entry is what we return in case we found no
other pinentry. */
-- { gnupg_bindir, DIRSEP_S "pinentry" EXEEXT_S },
-+ { gnupg_homedir, "/.guix-profile/bin/pinentry" },
++ { user_homedir, "/.guix-profile/bin/pinentry" },
+ { gnupg_bindir, DIRSEP_S "pinentry" EXEEXT_S },
#ifdef HAVE_W32_SYSTEM
/* Try Gpg4win directory (with bin and without.) */
- { w32_rootdir, "\\..\\Gpg4win\\bin\\pinentry.exe" },
diff --git a/gnu/packages/patches/hash-extender-test-suite.patch b/gnu/packages/patches/hash-extender-test-suite.patch
deleted file mode 100644
index 59de52dad4..0000000000
--- a/gnu/packages/patches/hash-extender-test-suite.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-Make the test suite exit with a non-zero exit code if some tests failed.
-Pull request pending upstream: https://github.com/iagox86/hash_extender/pull/13
---- a/test.c
-+++ b/test.c
-@@ -79,5 +79,9 @@ void test_report(void)
- printf("TESTS PASSED: %d / %d [%2.4f%%]\n", tests_passed, tests_run, 100 * (float)tests_passed / tests_run);
- printf("--------------------------------------------------------------------------------\n");
- }
-+
-+ if (tests_passed != tests_run) {
-+ exit(1);
-+ }
- }