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