From 8ffdf161c781b374dcaa461c1a5333f70cffdf6f Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Tue, 8 Oct 2013 07:21:29 -0700 Subject: 31797: to match documentation, avoid expanding history when there is neither a word nor an event designator There are still a few cases where expansion is attempted even though the documentation indicates it will not be, but in most of those cases the expansion will fail. The now-fixed case would fall back to default expansion of the previous command. --- ChangeLog | 9 +++++++++ Src/hist.c | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/ChangeLog b/ChangeLog index a8dc3b9e0..c06c401e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2013-10-08 Barton E. Schaefer + + * 31797: partly fix long-standing history expansion bug in which + in some circumstances a default history expansion would occur even + when there is neither an event nor a word designator, which is + contradictory to the documentation. There are still some cases in + which expansion is attempted when it should not be, but in most of + those cases the expansion simply fails. + 2013-10-07 Peter Stephenson * 31794: Src/hist.c: further refinement that SHAREHISTORY should diff --git a/Src/hist.c b/Src/hist.c index d1af30a29..bd650e81e 100644 --- a/Src/hist.c +++ b/Src/hist.c @@ -521,6 +521,12 @@ histsubchar(int c) } c = ingetc(); } + if (ptr == buf && + (c == '}' || c == ';' || c == '\'' || c == '"' || c == '`')) { + /* Neither event nor word designator, no expansion */ + safeinungetc(c); + return bangchar; + } *ptr = 0; if (!*buf) { if (c != '%') { -- cgit 1.4.1 From dc272d0d14b126ee445c39d1de3962524930fb70 Mon Sep 17 00:00:00 2001 From: Eric Cook Date: Tue, 8 Oct 2013 12:52:31 -0400 Subject: 31801: missing local declaration for variables in completion --- ChangeLog | 5 +++++ Completion/Linux/Command/_btrfs | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c06c401e7..da52f2a9d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-10-08 Peter Stephenson + + * Eric Cook: 31801: Completion/Linux/Command/_btrfs: some + additional variables need to be local. + 2013-10-08 Barton E. Schaefer * 31797: partly fix long-standing history expansion bug in which diff --git a/Completion/Linux/Command/_btrfs b/Completion/Linux/Command/_btrfs index eac827050..da2514e99 100644 --- a/Completion/Linux/Command/_btrfs +++ b/Completion/Linux/Command/_btrfs @@ -1,7 +1,7 @@ #compdef btrfs local curcontext="$curcontext" curstate state line expl grp cmd ret=1 -local -a groups args +local -a groups args cmds_1 cmds_2 cmds_3 cmds_4 cmds_5 cmds_6 groups=( subvolume filesystem device scrub balance inspect-internal help version ) cmds_1=( create delete list snapshot get-default set-default find-new help ) -- cgit 1.4.1 From 68a9bab11da470275fb28bea19e34db51a5093ba Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Thu, 10 Oct 2013 17:12:50 +0100 Subject: 31809: Make whitespace clear in trace output for patterns. --- ChangeLog | 5 +++++ Src/exec.c | 13 +++++++++++++ 2 files changed, 18 insertions(+) diff --git a/ChangeLog b/ChangeLog index da52f2a9d..25fb77933 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-10-10 Peter Stephenson + + * 31809: Src/exec.c: make whitespace clear in trace output for + patterns. + 2013-10-08 Peter Stephenson * Eric Cook: 31801: Completion/Linux/Command/_btrfs: some diff --git a/Src/exec.c b/Src/exec.c index 1c44565f9..de1b4848e 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); -- cgit 1.4.1 From c35a561a9c0ea5f3190141c7ccf28720c100485a Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Thu, 10 Oct 2013 17:45:42 +0100 Subject: 31810: tests for simple XTRACE output from conditions --- ChangeLog | 3 +++ Test/E02xtrace.ztst | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/ChangeLog b/ChangeLog index 25fb77933..524f54242 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2013-10-10 Peter Stephenson + * 31810: Test/E02xtrace.ztst: tests for simple cases of XTRACE + output for conditions. + * 31809: Src/exec.c: make whitespace clear in trace output for patterns. diff --git a/Test/E02xtrace.ztst b/Test/E02xtrace.ztst index 2420aebd7..093a587bd 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 -- cgit 1.4.1