pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

vimb3-git: Add a patch to adjust test_expand_user() tests



Module Name:	pkgsrc-wip
Committed By:	Leonardo Taccari <leot%NetBSD.org@localhost>
Pushed By:	leot
Date:		Mon Oct 15 17:16:54 2018 +0200
Changeset:	9e8f71cf2c7b2ac28bfee7a5cf6c47707c04ac81

Modified Files:
	vimb3-git/distinfo
Added Files:
	vimb3-git/patches/patch-tests_test-util.c

Log Message:
vimb3-git: Add a patch to adjust test_expand_user() tests

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=9e8f71cf2c7b2ac28bfee7a5cf6c47707c04ac81

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 vimb3-git/distinfo                        |  1 +
 vimb3-git/patches/patch-tests_test-util.c | 38 +++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+)

diffs:
diff --git a/vimb3-git/distinfo b/vimb3-git/distinfo
index afc76512f4..e739fb7290 100644
--- a/vimb3-git/distinfo
+++ b/vimb3-git/distinfo
@@ -1,2 +1,3 @@
 $NetBSD$
 
+SHA1 (patch-tests_test-util.c) = 9e92df5cab1bece182dc35013688ed6c817ff81f
diff --git a/vimb3-git/patches/patch-tests_test-util.c b/vimb3-git/patches/patch-tests_test-util.c
new file mode 100644
index 0000000000..b36993a221
--- /dev/null
+++ b/vimb3-git/patches/patch-tests_test-util.c
@@ -0,0 +1,38 @@
+$NetBSD$
+
+Gracefully handle subtleties of util_expand() of `~' and `~user'.
+
+When `~' is expanded to an home directory without any user, g_get_home_dir()
+function is used that on Unix systems first try to honor HOME and fall back to
+the passwd file if not set.
+
+On the other hand, `~user' is expanded always by checking the passwd
+file, adjust test_expand_tilde_user() accordingly.
+
+--- tests/test-util.c.orig	2018-09-25 22:49:33.000000000 +0000
++++ tests/test-util.c
+@@ -17,6 +17,7 @@
+  * along with this program. If not, see http://www.gnu.org/licenses/.
+  */
+ 
++#include <pwd.h>
+ #include <gtk/gtk.h>
+ #include <src/util.h>
+ 
+@@ -88,9 +89,15 @@ static void test_expand_tilde_home(void)
+ static void test_expand_tilde_user(void)
+ {
+     State state = {0};
+-    const char *home = g_get_home_dir();
+     const char *user = g_get_user_name();
++    const char *home;
+     char *in, *out;
++    struct passwd *pwd;
++
++    /* initialize home */
++    pwd = getpwnam(user);
++    g_assert_nonnull(pwd);
++    home = pwd->pw_dir;
+ 
+     /* don't expand within words */
+     in = g_strdup_printf("foo~%s/bar", user);


Home | Main Index | Thread Index | Old Index