code: plan9front

Download patch

ref: 8a45afd47d2545b2d85aecf9ec5af90cba3905d3
parent: 5e010fd8a82ec3b6552b4002bcd4be0586081e9a
author: Ori Bernstein <ori@eigenstate.org>
date: Tue Jan 30 18:26:42 EST 2024

vdiff: correctly strip more than one prefix

The code as committed will point to the /, and not 1 past it,
which means that the next strchr will point to the same '/';
this means we both get relative paths, and never strip off past
the first '/'.

--- a/sys/src/cmd/vdiff.c
+++ b/sys/src/cmd/vdiff.c
@@ -75,7 +75,7 @@
 		return;
 	for(i = 0; i < nstrip; i++)
 		if((p = strchr(f, '/')) != nil)
-			f = p;
+			f = p+1;
 	getwd(wd, sizeof wd);
 	snprint(addr, sizeof addr, "%s:%d", f, l);
 	plumbsendtext(fd, "vdiff", "edit", wd, addr);