Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 859c433f1c222b50eba0603479fc5b5ba681e4ebd98a1d9dbccc433828ec8146
Ticket: e38dce74e28420b6c1f44fba604c4ed6193a6391
Command line built with list not properly quoted
User & Date: sbron on 2024-09-19 08:20:55
Changes

  1. icomment:
    Looking deeper into the issue, I find that the Tcl 8.6 code that handles this situation (Tcl_ListObjReplace()) contains the following comment:
    ```
        /*
         * Note that when count == 0 and objc == 0, this routine is logically a
         * no-op, removing and adding no elements to the list. However, by flowing
         * through this routine anyway, we get the important side effect that the
         * resulting listPtr is a list in canonical form. This is important.
         * Resist any temptation to optimize this case.
         */
    ```
    On Tcl 9.0 a different function is used (TclListObjAppendElements()), which does have the optimization that was warned against. Disabling the shortcut when elemCount <= 0 fixes the problem.
    
  2. login: "sbron"
  3. mimetype: "text/x-markdown"