bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: bug-gnulib@gnu.org
Subject: Support GLOB_TILDE_CHECK for ~user in glob.c on MS-Windows
Date: Mon, 29 Mar 2021 12:59:44 +0300	[thread overview]
Message-ID: <837dlqmga7.fsf@gnu.org> (raw)

When Gnulib's glob.c is used on MS-Windows, tilde expansion in the
likes of "~foo" always "succeeds", even when GLOB_TILDE_CHECK is set
in the flags, although in this case 'glob' simply punts and returns
the original unexpanded argument.  Suggested minimal patch is below:

--- glob.c~	2021-03-25 03:47:10.000000000 +0200
+++ glob.c	2021-03-29 12:48:20.907625000 +0300
@@ -881,7 +881,15 @@ __glob (const char *pattern, int flags, 
               }
             scratch_buffer_free (&pwtmpbuf);
           }
-#endif /* !WINDOWS32 */
+#else  /* WINDOWS32 */
+	  /* We don't support ~USER on MS-Windows (FIXME: could have
+	     at least supported that if USER == $USERNAME).  */
+	  if (flags & GLOB_TILDE_CHECK)
+	    {
+	      retval = GLOB_NOMATCH;
+	      goto out;
+	    }
+#endif /* WINDOWS32 */
         }
     }
 


             reply	other threads:[~2021-03-29  9:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-29  9:59 Eli Zaretskii [this message]
2021-03-30  0:50 ` Support GLOB_TILDE_CHECK for ~user in glob.c on MS-Windows Bruno Haible
2021-03-30  6:41   ` Eli Zaretskii
2021-04-02 15:35     ` Bruno Haible

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

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

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

  git send-email \
    --in-reply-to=837dlqmga7.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=bug-gnulib@gnu.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).