diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ce953f7634..8bd071c8fc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ BUG FIXES: * csi: Fixed a bug where querying CSI volumes would cause a panic if an allocation that claimed the volume had been garbage collected but the claim was not yet dropped. [[GH-8735](https://github.com/hashicorp/nomad/issues/8735)] * deployments (Enterprise): Fixed a bug where counts could not be changed in the web UI for multiregion jobs. [[GH-8685](https://github.com/hashicorp/nomad/issues/8685)] * deployments (Enterprise): Fixed a bug in multi-region deployments where a region that was dropped from the jobspec was not deregistered. [[GH-8763](https://github.com/hashicorp/nomad/issues/8763)] + * exec: Fixed a bug causing escape characters to be missed in special cases [[GH-8798](https://github.com/hashicorp/nomad/issues/8798)] * plan: Fixed a bug where plans always included a change for the `NomadTokenID`. [[GH-8559](https://github.com/hashicorp/nomad/issues/8559)] ## 0.12.3 (August 13, 2020) diff --git a/helper/escapingio/reader.go b/helper/escapingio/reader.go index 099654c86b3..edb10514196 100644 --- a/helper/escapingio/reader.go +++ b/helper/escapingio/reader.go @@ -93,6 +93,9 @@ func (r *reader) pipe() { bw.WriteByte(r.escapeChar) bw.WriteByte(rb[0]) bw.Flush() + if rb[0] == '\n' || rb[0] == '\r' { + state = sLookEscapeChar + } } } } @@ -137,6 +140,10 @@ START: bw.Write(buf[wi:i]) i = i + 2 wi = i + } else if nc == '\n' || nc == '\r' { + i = i + 2 + s = sLookEscapeChar + goto START } else { i = i + 2 // need to write everything keep going diff --git a/helper/escapingio/reader_test.go b/helper/escapingio/reader_test.go index 70b13b2e387..bf45f72d327 100644 --- a/helper/escapingio/reader_test.go +++ b/helper/escapingio/reader_test.go @@ -42,6 +42,7 @@ func TestEscapingReader_Static(t *testing.T) { {"\n~.", "\n", "."}, {"~", "~", ""}, {"\r~.", "\r", "."}, + {"b\n~\n~.q", "b\n~\nq", "."}, } for _, c := range cases {