Tcl Source Code

View Ticket
Login
2024-08-18
00:23
Merge [fe628d36ce706532] to fix issue [a366c6efee1f70cc], "[ledit] corrupts string literal value". check-in: e21feb8363 user: pooryorick tags: unchained, INCOMPATIBLE_LICENSE
2023-07-16
07:27 • Closed ticket [a366c6efee]: ledit corrupts string literal value plus 6 oth... artifact: a9b1af4949 user: apnadkarni
07:23
Merge 8.7 - Bug [a366c6efee] check-in: fe628d36ce user: apnadkarni tags: trunk, main
06:15
Bug [a366c6efee] check-in: 3b31b4f4a9 user: apnadkarni tags: core-8-branch
2023-07-15
04:40 • Ticket [a366c6efee] ledit corrupts string literal value status still Open ... artifact: 050da462e6 user: apnadkarni
04:06 • Ticket [a366c6efee]: 3 changes artifact: 0eecc81cd1 user: apnadkarni
2023-07-14
15:15 • Ticket [a366c6efee]: 3 changes artifact: 1b5022ef14 user: jan.nijtmans
15:01 • Ticket [a366c6efee]: 3 changes artifact: 810c6ad020 user: dgp
14:59 • New ticket [a366c6efee]. artifact: 84373ee3a4 user: dgp

Ticket UUID: a366c6efee1f70cc9b27f949d41afe3ee77c0f08
Title: [ledit] corrupts string literal value
Type: Bug Created on: 2023-07-14 14:59:26
Submitter: dgp Assigned to: apnadkarni
Subsystem: - New Builtin Commands Severity: Severe
Priority: 5 Medium Last modified: 2023-07-16 07:27:34
Status: Closed Closed by: apnadkarni
Resolution: Fixed Closed on: 2023-07-16 07:27:34
Version: trunk
Description:
The tests ledit-4.2 and socket_inet-13.1 interact and cause failure.
The interaction can be summarized by this demo script:

% proc demo {} {
set l { }
puts [list [ledit l 1 1] $l]
set result foo
append result " " bar
}
% demo
{} {}
foobar

The result "foobar" is wrong.  It should be "foo bar".
It appears that the string literal " " has had its string value
transformed to "" before the append.  This might be the result
of not managing value-sharing properly when the [ledit] command
changes the value of $l from { } to {}.

Hope that's enough to lead the [ledit] keepers to a fix.
User Comments:
jan.nijtmans added on 2023-07-14 15:15:38:

This smells like the TclDuplicatePureObj() danger somewhere.


apnadkarni added on 2023-07-15 04:06:30:
Will take a look later today. Strangely enough, 8.7 which pretty much shares the ledit code does not seem to have this problem. Not that means much...

Thanks Don for a very concise demo.

apnadkarni added on 2023-07-15 04:40:36:
Found the issue, as always not where I suspected. Fix forthcoming.

apnadkarni added on 2023-07-16 07:27:34:
Fixed in [fe628d36ce].

As to why it did not manifest in 8.7 is that the more sophisticated  TclCheckEmptyString check in 9.0 triggered the bug.