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

[PATCH] 'bad interpreter' error garbled



On Sat, Feb 24, 2024 at 2:36 AM Stephane Chazelas <stephane@xxxxxxxxxxxx> wrote:
>
> $ echo '#! ÃÃÃÃ' > a
> $ chmod +x a
> $ ./a
> zsh: ./a: bad interpreter: \M-C\M-c\M-c\M-c\M-^C: no such file or directory
diff --git a/Src/exec.c b/Src/exec.c
index 1565cb13e..c75aa78d6 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -551,7 +551,7 @@ zexecve(char *pth, char **argv, char **newenvp)
 			    break;
 		    if (t0 == ct)
 			zerr("%s: bad interpreter: %s: %e", pth,
-			     execvebuf + 2, eno);
+			     metafy(execvebuf + 2, -1, META_NOALLOC), eno);
 		    else {
 			while (inblank(execvebuf[t0]))
 			    execvebuf[t0--] = '\0';
@@ -574,8 +574,8 @@ zexecve(char *pth, char **argv, char **newenvp)
 				    execve(pprog, argv - 2, newenvp);
 				}
 			    }
-			    zerr("%s: bad interpreter: %s: %e", pth, ptr2,
-				 eno);
+			    zerr("%s: bad interpreter: %s: %e", pth,
+				 metafy(ptr2, -1, META_NOALLOC), eno);
 			} else if (*ptr) {
 			    *ptr = '\0';
 			    argv[-2] = ptr2;


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