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