Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Completion problems on cygwin when nocaseglob is set
- X-seq: zsh-users 12087
- From: Peter Stephenson <pws@xxxxxxx>
- To: "Zsh Users" <zsh-users@xxxxxxxxxx>
- Subject: Re: Completion problems on cygwin when nocaseglob is set
- Date: Tue, 23 Oct 2007 16:57:08 +0100
- In-reply-to: <DD74FBB8EE28D441903D56487861CD9D225F6859@xxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Organization: CSR
- References: <DD74FBB8EE28D441903D56487861CD9D223A0DF0@xxxxxxxxxxxxxxxxxxxxxx> <20a807210710200509t43730713oa909fce4e0a57940@xxxxxxxxxxxxxx> <DD74FBB8EE28D441903D56487861CD9D223A0DF8@xxxxxxxxxxxxxxxxxxxxxx> <20071022103452.6c0580c6@news01> <DD74FBB8EE28D441903D56487861CD9D224E86E7@xxxxxxxxxxxxxxxxxxxxxx> <20071022123128.2db6000c@news01> <DD74FBB8EE28D441903D56487861CD9D224E8A05@xxxxxxxxxxxxxxxxxxxxxx> <20071023101151.3757a369@news01> <DD74FBB8EE28D441903D56487861CD9D225F6432@xxxxxxxxxxxxxxxxxxxxxx> <200710231156.l9NBuQwA019246@xxxxxxxxxxxxxx> <DD74FBB8EE28D441903D56487861CD9D225F6859@xxxxxxxxxxxxxxxxxxxxxx>
OK, I've found the underlying problem. The cause is as discussed---"c"
doesn't appear in the directory listing for "/", which still strikes me as
a bug.
I next noticed that "print /c/*" doesn't work. The reason is that globbing
couldn't find /c. That #ifdef I pointed out before in pattern.c is
supposed to ensure that we don't do globbing on a directory just because
nocaseglob is in effect on Cygwin, since we'll find files with any case
without having to search. However, it turns out there's another piece of
code that's turning off the flag that says we've got a straight string that
doesn't need globbing. Using the same trick here allows us to pick up /c
without globbing to find it again. c:/* now works again, too.
This means that /c*/* still doesn't find any files under /c, but this time
I think it's a natural and unavoidable consequence of the fact that c
doesn't appear in the directory listing for /.
I haven't looked at fake-files.
Index: Src/pattern.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/pattern.c,v
retrieving revision 1.40
diff -u -r1.40 pattern.c
--- Src/pattern.c 27 Jul 2007 21:51:33 -0000 1.40
+++ Src/pattern.c 23 Oct 2007 15:47:38 -0000
@@ -1167,7 +1167,26 @@
* ..(#a1).. (i.e. the (#a1) has no effect), but if you're
* going to write funny patterns, you get no sympathy from me.
*/
- if (patglobflags & (0xFF|GF_LCMATCHUC|GF_IGNCASE)) {
+ if (patglobflags &
+#ifdef __CYGWIN__
+ /*
+ * As above: don't use pattern matching for files
+ * just because of case insensitivity if file system
+ * is known to be case insensitive.
+ *
+ * This is known to be necessary in at least one case:
+ * if "mount -c /" is in effect, so that drives appear
+ * directly under / instead of the usual /cygdrive, they
+ * aren't shown by readdir(). So it's vital we don't use
+ * globbing to find "/c", since that'll fail.
+ */
+ ((patflags & PAT_FILE) ?
+ (0xFF|GF_LCMATCHUC) :
+ (0xFF|GF_LCMATCHUC|GF_IGNCASE))
+#else
+ (0xFF|GF_LCMATCHUC|GF_IGNCASE)
+#endif
+ ) {
if (!(patflags & PAT_FILE))
flags &= ~P_PURESTR;
else if (!(nptr[0] == '.' &&
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
Messages sorted by:
Reverse Date,
Date,
Thread,
Author