This patch corrects "Edit [erw] filename" errors when "filename" is unrooted. Under this condition the effective file name becomes the entire tag line. (Button 3 clicking on an unrooted file name in the tag line also fails, but silently.) The propsed change to dirname() explicitly sets a terminating null for the unrooted file name case. Notes: Wed Mar 23 13:37:41 EST 2005 rsc Thanks for the report. Your fix only sets the terminating NUL in one case of dirname, and even then only if cleanname doesn't shorten the name at all: with your fix I believe that if one did Edit e ../edit.c, you'd still end up with something like /whatever/edit.ct.c being returned. We can't set the NUL in the general case because the dirname might not have had space allocated for it. Instead I fixed cmdname to add the NUL itself, which it should have been doing all along. I didn't understand your comment about button 3 failing. I click button 3 on unrooted file names in tags all the time and have no problems. Did you mean it fails after a bogus Edit e command? Russ Reference: /n/sources/patch/applied/acme-look Date: Wed Mar 23 08:06:27 CET 2005 Reviewed-by: rsc --- /sys/src/cmd/acme/look.c Wed Mar 23 08:06:09 2005 +++ /sys/src/cmd/acme/look.c Wed Mar 23 08:05:55 2005 @@ -423,6 +423,7 @@ if(slash < 0) goto Rescue; runemove(b+slash+1, r, n); + b[slash+1+n] = '\0'; free(r); return cleanrname((Runestr){b, slash+1+n});