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

PATCH: 3.1.5 genericish: cd /..



Mircea Damian wrote:
> dmircea@secu:~% cd /
> dmircea@secu:/% cd ../bin
> dmircea@secu:/../bin% pwd
> /../bin

I thought this might be to do with the RFS superroot, but that's tested
further up, so it's not.  So the simplest fix ought to be OK.  (Arguably
you shouldn't test things like that in configure, but RFS isn't so common.)

--- Src/builtin.c.dd	Wed Feb 10 17:35:28 1999
+++ Src/builtin.c	Mon Mar  1 09:46:41 1999
@@ -1072,12 +1072,14 @@
 	    *dest = '\0';
 	    return;
 	}
-	if (dest > d0 + 1 && src[0] == '.' && src[1] == '.' &&
+	if (src[0] == '.' && src[1] == '.' &&
 	  (src[2] == '\0' || src[2] == '/')) {
-	    /* remove a foo/.. combination */
-	    for (dest--; dest > d0 + 1 && dest[-1] != '/'; dest--);
-	    if (dest[-1] != '/')
-		dest--;
+	    if (dest > d0 + 1) {
+		/* remove a foo/.. combination */
+		for (dest--; dest > d0 + 1 && dest[-1] != '/'; dest--);
+		if (dest[-1] != '/')
+		    dest--;
+	    }
 	    src++;
 	    while (*++src == '/');
 	} else if (src[0] == '.' && (src[1] == '/' || src[1] == '\0')) {


-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxx>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy



Messages sorted by: Reverse Date, Date, Thread, Author