* [PATCH] [gdb] Skip ~$USER selftest on MinGW
@ 2026-11-16 17:09 Tom de Vries
0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2026-11-16 17:09 UTC (permalink / raw)
To: gdb-patches
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.
---
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. */
base-commit: 5678a7bfceb3a6ea18bcde1ae68f7e96c43c998b
--
2.51.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-16 17:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-16 17:09 [PATCH] [gdb] Skip ~$USER selftest on MinGW Tom de Vries
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox