From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh-workers@zsh.org
Subject: Re: Minor xtrace inaccuracy
Date: Thu, 10 Oct 2013 16:25:49 +0100 [thread overview]
Message-ID: <20131010162549.48c18765@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <131010074333.ZM4312@torch.brasslantern.com>
On Thu, 10 Oct 2013 07:43:33 -0700
Bart Schaefer <schaefer@brasslantern.com> 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
next prev parent reply other threads:[~2013-10-10 15:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-10 14:43 Bart Schaefer
2013-10-10 15:25 ` Peter Stephenson [this message]
2013-10-10 16:17 ` Peter Stephenson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131010162549.48c18765@pwslap01u.europe.root.pri \
--to=p.stephenson@samsung.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).