Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Tk option - bug or feature, a change in handling \ in strings

55 views
Skip to first unread message

Trey Jackson

unread,
Apr 26, 2019, 2:44:31 PM4/26/19
to
Just found a difference in behavior in the [option] command between Tk 8.5.7 and 8.6.9.

Option file contains just this line:

*example: {SOME TEXT "focus on backslashes \\[ \\]"}


Tcl 8.5:
% info patchlevel
8.5.7
% option readfile opt.txt
% option get . example example
{SOME TEXT "focus on backslashes \\[ \\]"}


Tcl 8.6:
% info patchlevel
8.6.9
% option readfile opt.txt
% option get . example example
{SOME TEXT "focus on backslashes \[ \]"}

Note the difference in the presence of double \ in 8.5, and the single \ in 8.6.

Was this a bug "fix"? Or a new bug?

If it was a "fix" - what are the new rules? I need to do something to replicate the old behavior for backward compatibility. It doesn't seem like it's as simple as replacing all \ with \\ in 8.6.


When the option file has single backslash, 8.5 and 8.6 behave identically (preserving the single \).
When the option file has triple backslash, 8.5 preserves the triple, 8.6 returns a double.

I didn't see anything in the Tips for 8.6 regarding the [options] command.

Don Porter

unread,
Apr 26, 2019, 6:19:07 PM4/26/19
to
On 4/26/19 2:44 PM, Trey Jackson wrote:
> Just found a difference in behavior in the [option] command between Tk 8.5.7 and 8.6.9.

...

> Was this a bug "fix"? Or a new bug?

https://core.tcl-lang.org/tk/tktview?name=0aa5e852dc

--
| Don Porter Applied and Computational Mathematics Division |
| donald...@nist.gov Information Technology Laboratory |
| http://math.nist.gov/~DPorter/ NIST |
|______________________________________________________________________|

Trey Jackson

unread,
Apr 29, 2019, 5:44:28 PM4/29/19
to
On Friday, April 26, 2019 at 3:19:07 PM UTC-7, Don Porter wrote:
> On 4/26/19 2:44 PM, Trey Jackson wrote:
> > Just found a difference in behavior in the [option] command between Tk 8.5.7 and 8.6.9.
>
> ...
>
> > Was this a bug "fix"? Or a new bug?
>
> https://core.tcl-lang.org/tk/tktview?name=0aa5e852dc
>

Thanks, that was helpful.

Follow up question.

It appears, from the documentation at the end of the defect you referenced, "the two-character sequence ``\tab'' (backslash followed by horizontal tab) is recognized and replaced by a horizontal tab character"

However in 8.6.9, ``\tab'' is now replaced with ``\tab'' (i.e. no change)
and the test in options.test: option-15.7 has been updated to reflect that.

That is counter-intuitive and isn't how I read the specification (as much as I've read it).

That change was done as a part of a different defect I filed (lucky me...) where the option command was losing the list structure. see: https://core.tcl.tk/tk/info/766ef52f317f3a4a

My question is, is the new behavior correct? (\tab is kept as \tab)
0 new messages