Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH] [gdb] Skip ~$USER selftest on MinGW
Date: Mon, 16 Nov 2026 18:09:55 +0100	[thread overview]
Message-ID: <20261116170955.26351-1-tdevries@suse.de> (raw)

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


                 reply	other threads:[~2026-11-16 17:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261116170955.26351-1-tdevries@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox