zsh-workers
 help / color / mirror / code / Atom feed
* Minor xtrace inaccuracy
@ 2013-10-10 14:43 Bart Schaefer
  2013-10-10 15:25 ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2013-10-10 14:43 UTC (permalink / raw)
  To: zsh-workers

In _arguments at line 398 is this:

if [[ "$action" = \ # ]]; then

This is printed by xtrace as:

[[ '' ==  # ]]

The quoting of the space character is lost.

-- 
Barton E. Schaefer


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Minor xtrace inaccuracy
  2013-10-10 14:43 Minor xtrace inaccuracy Bart Schaefer
@ 2013-10-10 15:25 ` Peter Stephenson
  2013-10-10 16:17   ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 2013-10-10 15:25 UTC (permalink / raw)
  To: zsh-workers

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Minor xtrace inaccuracy
  2013-10-10 15:25 ` Peter Stephenson
@ 2013-10-10 16:17   ` Peter Stephenson
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 2013-10-10 16:17 UTC (permalink / raw)
  To: zsh-workers

Here's one of them test thingies for trace output from some basic
conditions.  If you're doing this at home, you need to know you don't
get a trace of the full test, just the bits actually executed by the
short-cutting logic, hence precedence and parentheses are irrelevant.

diff --git a/Test/E02xtrace.ztst b/Test/E02xtrace.ztst
index 2420aeb..093a587 100644
--- a/Test/E02xtrace.ztst
+++ b/Test/E02xtrace.ztst
@@ -118,3 +118,12 @@
 ?+./fnfile:5> :
 ?+./fnfile:6> fn
 ?+./fnfile:3> print This is fn.
+
+ set -x
+ [[ 'f o' = 'f x'* || 'b r' != 'z o' && 'squashy sound' < 'squishy sound' ]]
+ [[ -e nonexistentfile || ( -z '' && -t 3 ) ]]
+ set +x
+0:Trace for conditions
+?+(eval):2> [[ 'f o' == f\ x* || 'b r' != z\ o && 'squashy sound' < 'squishy sound' ]]
+?+(eval):3> [[ -e nonexistentfile || -z '' && -t 3 ]]
+?+(eval):4> set +x

pws


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-10-10 16:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-10 14:43 Minor xtrace inaccuracy Bart Schaefer
2013-10-10 15:25 ` Peter Stephenson
2013-10-10 16:17   ` Peter Stephenson

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).