bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* Support GLOB_TILDE_CHECK for ~user in glob.c on MS-Windows
@ 2021-03-29  9:59 Eli Zaretskii
  2021-03-30  0:50 ` Bruno Haible
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2021-03-29  9:59 UTC (permalink / raw)
  To: bug-gnulib

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 */
         }
     }
 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-04-02 15:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-29  9:59 Support GLOB_TILDE_CHECK for ~user in glob.c on MS-Windows Eli Zaretskii
2021-03-30  0:50 ` Bruno Haible
2021-03-30  6:41   ` Eli Zaretskii
2021-04-02 15:35     ` Bruno Haible

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).