bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Support GLOB_TILDE_CHECK for ~user in glob.c on MS-Windows


From: Eli Zaretskii
Subject: Support GLOB_TILDE_CHECK for ~user in glob.c on MS-Windows
Date: Mon, 29 Mar 2021 12:59:44 +0300

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 via email to

[Prev in Thread] Current Thread [Next in Thread]