[binutils-gdb] [gdb] Skip ~$USER selftest on MinGW
Tom de Vries
vries@sourceware.org
Tue Dec 1 07:53:13 GMT 2026
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=62231047e2d7dc828263bd23c191f335ab884969
commit 62231047e2d7dc828263bd23c191f335ab884969
Author: Tom de Vries <tdevries@suse.de>
Date: Tue Dec 1 08:53:09 2026 +0100
[gdb] Skip ~$USER selftest on MinGW
I ran the selftests on msys2-ucrt64, and ran into a failure of selftest
gdb_tilde_expand. The part that is causing the failure is checking whether
~$USER is expanded.
The function that is supposed to implement this is glob, which is provided by
gnulib.
In file gnulib/import/glob.c, a comment explains that given that ~$ANY_USER
doesn't work on Windows, ~$USER is left unsupported, to avoid confusing the
user.
I looked in the gdb docs and didn't find anything suggesting that ~$USER
should work, so I suppose this is OK.
Fix this by skipping the ~$USER part of the selftest.
Tested on x86_64-linux and msys2-ucrt64.
Diff:
---
gdb/unittests/gdb_tilde_expand-selftests.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/gdb/unittests/gdb_tilde_expand-selftests.c b/gdb/unittests/gdb_tilde_expand-selftests.c
index 3ee6abffe9b..61af3b49c26 100644
--- a/gdb/unittests/gdb_tilde_expand-selftests.c
+++ b/gdb/unittests/gdb_tilde_expand-selftests.c
@@ -54,6 +54,10 @@ do_test ()
SELF_CHECK (gdb_tilde_expand ("/some/abs/path") == "/some/abs/path");
SELF_CHECK (gdb_tilde_expand ("relative/path") == "relative/path");
+ /* Skip ~$USER expansion test on MinGW. The file gnulib/import/glob.c has a
+ comment documenting why ~$ANY_USER doesn't work, and consequently ~$USER
+ is left unsupported. */
+#ifndef __MINGW32__
/* If $USER is available in the env variables, check the '~user'
expansion. */
const char *c_user = std::getenv ("USER");
@@ -64,6 +68,7 @@ do_test ()
SELF_CHECK (gdb_tilde_expand (("~" + user + "/a/b").c_str ())
== home + "/a/b");
}
+#endif
/* Check that an error is thrown when trying to expand home of a unknown
user. */
More information about the Gdb-cvs
mailing list