From 59b021af73587b7426a532a051fa87e4a44ab227 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Thu, 18 Feb 2021 13:05:29 -0500 Subject: [PATCH] Corrected an error in which the "select" command returns the name of an instance with double-escaped brackets if the instance name contains brackets. This then undermines the use of the backslash escape and causes the interpreter to raise an error instead of printing the name. --- VERSION | 2 +- commands/CmdRS.c | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 3ce5d98b..423f70a6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.128 +8.3.129 diff --git a/commands/CmdRS.c b/commands/CmdRS.c index 3adea56f..1934891e 100644 --- a/commands/CmdRS.c +++ b/commands/CmdRS.c @@ -819,7 +819,7 @@ CmdSelect(w, cmd) * also used to step through multiple uses. */ static bool lessCycle = FALSE, lessCellCycle = FALSE; - char path[200], *printPath, **msg, **optionArgs, *feedtext; + char path[200], *printPath, **msg, **optionArgs, *feedtext, *pstr; TerminalPath tpath; CellUse *use; CellDef *rootBoxDef; @@ -1526,6 +1526,13 @@ Okay: DBWSetBox(scx.scx_use->cu_def, &r); #ifdef MAGIC_WRAPPER + /* Remove any backslash escapes so that Tcl_escape() doesn't + * double-escape them. + */ + for (pstr = printPath; *pstr != '\0';) + if ((*pstr == '\\') && ((*(pstr + 1) == '[') || (*(pstr + 1) == ']'))) + memmove(pstr, pstr + 1, 1 + strlen(pstr + 1)); + else pstr++; tclstr = Tcl_escape(printPath); Tcl_SetResult(magicinterp, tclstr, TCL_DYNAMIC); #else