Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Bug#353607: Related problem?



On Fri, 19 Oct 2007 15:52:45 -0400
Clint Adams <schizo@xxxxxxxxxx> wrote:
> On Fri, Oct 19, 2007 at 09:18:22PM +0200, Georg Neis wrote:
> > traal% ls -a
> > ./  ../
> > traal% mkdir a b
> > traal% touch a/1 b/1
> > traal% print -l *(F)
> > a
> > b
> > traal% mv a à
> > traal% print -l *(F)
> > b

We don't unmetafy strings passed down to glob qualifier functions.
This appears to be correct in some cases (where the name is passed into
shell code for further processing), so it seems we need to do this within
qualnonemptydir().  (I left the first hunk in as it's a little neater
but it has no effect.)

Index: Src/glob.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/glob.c,v
retrieving revision 1.59
diff -u -r1.59 glob.c
--- Src/glob.c	18 Jun 2007 13:25:05 -0000	1.59
+++ Src/glob.c	22 Oct 2007 09:15:07 -0000
@@ -326,7 +326,8 @@
 	    /* Reject the file if the function returned zero *
 	     * and the sense was positive (sense&1 == 0), or *
 	     * vice versa.                                   */
-	    if ((!((qn->func) (news, bp, qn->data, qn->sdata)) ^ qn->sense) & 1) {
+	    if ((!((qn->func) (news, bp, qn->data, qn->sdata))
+		 ^ qn->sense) & 1) {
 		/* Try next alternative, or return if there are no more */
 		if (!(qo = qo->or)) {
 		    unqueue_signals();
@@ -3254,6 +3255,8 @@
 {
     DIR *dirh;
     struct dirent *de;
+    int unamelen;
+    char *uname = unmetafy(dupstring(name), &unamelen);
 
     if (!S_ISDIR(buf->st_mode))
 	return 0;
@@ -3261,7 +3264,7 @@
     if (buf->st_nlink > 2)
 	return 1;
 
-    if (!(dirh = opendir(name)))
+    if (!(dirh = opendir(uname)))
 	return 0;
 
     while ((de = readdir(dirh))) {


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