From 7059eaa4abff89e7ae13e3962fdb5ae5342a11d2 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Thu, 10 Jun 2021 16:45:30 +0200 Subject: [PATCH] Revert "Disallow escaped characters in variable expansion" This reverts commit 555af37616893160ad1afb208a957d6a01a7a315. --- CHANGELOG.rst | 1 - src/common.cpp | 3 --- tests/checks/slices.fish | 14 -------------- 3 files changed, 18 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 41d3ba84d..d5611e69e 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -9,7 +9,6 @@ Notable improvements and fixes Syntax changes and new commands ------------------------------- - Empty variable names are no longer allowed. -- Escaped characters like ``\x41`` are no longer valid in a variable name (:issue:`7969`). Deprecations and removed features --------------------------------- diff --git a/src/common.cpp b/src/common.cpp index 3146f90d5..c419bc1b0 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -1244,9 +1244,6 @@ maybe_t read_unquoted_escape(const wchar_t *input, wcstring *result, boo } if (res <= max_val) { - // Prepend internal sep so this does not get treated as part of a variable. - // See #7969. - if (unescape_special) result->push_back(INTERNAL_SEPARATOR); result_char_or_none = static_cast((byte_literal ? ENCODE_DIRECT_BASE : 0) + res); } else { diff --git a/tests/checks/slices.fish b/tests/checks/slices.fish index 5f1a29c47..44b25870b 100644 --- a/tests/checks/slices.fish +++ b/tests/checks/slices.fish @@ -78,17 +78,3 @@ echo $list # CHECK: 2 1 3 set -l list 1 2 3 set list[2..] $list[-1..2] echo $list # CHECK: 1 3 2 - -# Regression test for #7969. -set fo shorty -set foo A B C -echo $foo[1] -# CHECK: A -echo $foo\1331\135 -# CHECK: A[1] B[1] C[1] -echo $foo\x5b1\x5d -# CHECK: A[1] B[1] C[1] -echo $foo\1331\135 -# CHECK: A[1] B[1] C[1] -echo $fo\157 -# CHECK: shortyo