zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: 3.1.5 genericish: cd /..
       [not found] <19990228211159.A30631@kappa.ro>
@ 1999-03-01  8:51 ` Peter Stephenson
  0 siblings, 0 replies; only message in thread
From: Peter Stephenson @ 1999-03-01  8:51 UTC (permalink / raw)
  To: Zsh hackers list

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@ibmth.df.unipi.it>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1999-03-01  9:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <19990228211159.A30631@kappa.ro>
1999-03-01  8:51 ` PATCH: 3.1.5 genericish: cd / Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).