Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Minor xtrace inaccuracy
On Thu, 10 Oct 2013 07:43:33 -0700
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> In _arguments at line 398 is this:
>
> if [[ "$action" = \ # ]]; then
>
> This is printed by xtrace as:
>
> [[ '' == # ]]
>
> The quoting of the space character is lost.
The stuff after the "=" is output specially to try to make the
difference between special and unspecial characters different.
Whitespace needs to be special. This is a bit ad hoc, but that seems to
be inevitable in this case. It doesn't handle non-printing characters
either, but as far as I can see quotedzputs() doesn't either. (There
appear to be too many different ways of getting quoted output in the
shell source.)
diff --git a/Src/exec.c b/Src/exec.c
index 1c44565..de1b484 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -1845,9 +1845,22 @@ quote_tokenized_output(char *str, FILE *file)
case '*':
case '?':
case '$':
+ case ' ':
putc('\\', file);
break;
+ case '\t':
+ fputs("$'\\t'", file);
+ continue;
+
+ case '\n':
+ fputs("$'\\n'", file);
+ continue;
+
+ case '\r':
+ fputs("$'\\r'", file);
+ continue;
+
case '=':
if (s == str)
putc('\\', file);
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author