Skip to content
Tcl Source Code History Of Ticket 1047097
Login

History Of Ticket 1047097

Artifacts Associated With Ticket 1047097

  1. Ticket change [cb4ff04967] (rid 95492) by nobody on 2004-10-14 15:06:02:

    1. assignee initialized to: "dkf"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      Synopsis of the bug:
      
        Possible issue with the way tcl parses list commands.
      
        1. If the list being passed to one of the list commands 
      is followed by any nonspace "terminator" character 
      (such as "[", ",", ".", "{", "}", ")", "\" and etc. ) and then 
      by any number of nonspace characters then space , all 
      those characters are being appended to the very last 
      element of the list while executing the command.
      
      Example:
      ----------
      input: join [list 1 2 3]\[ |
      output: 1|2|3[
      
      input: join [list 1 2 3]] |
      output: 1|2|3]
      
        2. If the list being passed to one of the list commands 
      is followed by any nonspace "terminator" character 
      (such as "[", ",", ".", "{", "}", ")", "\" and etc. ) and then 
      by any number of nonspace characters, then by "\", 
      then by a space character, and then again any number 
      of nonspace characters, all those characters before "\ " 
      are being appended to the very last element of the 
      passed list and all characters that goes after "\ " are 
      treated as an additional last element of the list while 
      executing the command.
      
      Example:
      ----------
      input: join $l\extra1\ extra2 |
      output: 1|2|3extra1|extra2
      
      Setup information:
        OS:  Windows 2000 Professional,
        TCL: Tcl version 8.3
      
      Steps to reproduce the bug:
        1. Bring up tclsh command prompt
      
        2. Initialize the list as below...
            input: set l [list 1 2 3]
            output: 1 2 3
      
        3. Try one of the operation below (join is used only as 
      an example any other list operation will manifest the 
      same issue)
      
      input: join $l] |
      output: 1|2|3]
      
      input: join $l{ |
      output: 1|2|3{
      
      input: join $l} |
      output: 1|2|3}
      
      input: join $l) |
      output: 1|2|3)
      
      input: join $l. |
      output: 1|2|3.
      
      input: join $l, |
      output: 1|2|3,
      
      input: join $l\asdf |
      output: 1|2|3sdf
      
      input: join $l\( |
      output: 1|2|3(
      
      input: join $l\[ |
      output: 1|2|3[
      
      input: join $l\] |
      output: 1|2|3]
      
      input: join $l\\ |
      output: 1|2|3\
      
      input: join [list 1 2 3]\[ |
      output: 1|2|3[
      
      input: join $l\extra1\ extra2 |
      output: 1|2|3extra1|extra2
      
      Expected result: Parsing error.
      
    4. foundin initialized to: "final ----"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "nobody"
    9. subsystem initialized to: "17. Commands I-L"
    10. title initialized to:
      Possible parsing problem. "list" command inccorectly assigns
      
    11. type initialized to: "Bug"
  2. Ticket change [01c4a14eb7] (rid 119541) by nobody on 2004-10-18 18:13:48:

    1. icomment:
      Logged In: NO 
      
      I am not sure about cases containing chars like [ and { but
      at least this:
      
      input: join $l, |
      output: 1|2|3,
      
      is IMHO perfectly OK - list $l is converted to string, then
      comma is
      appended to it while forming the first arg to 'join', then
      it is converted
      back to list because 'join' wants a list.
      
      In fact it has nothing to do with lists at all, the only
      question might be
      whether all those combinations of special characters in
      arguments
      are written in the best possible quoting style and whether
      parser could enforce a better style, for example:
      
      input: join $l} |
      output: 1|2|3}
      
      is rather unfortunate when used as part of bigger script, I
      would
      rather backslash-escape the brace:
      
      input: join $l\} |
      output: 1|2|3}
      
      Vaclav Hanzl
      
      
      
    2. login: "nobody"
    3. mimetype: "text/plain"
    4. username: "nobody"
  3. Ticket change [45bbc638d7] (rid 99399) by dkf on 2004-10-19 20:45:08:

    1. closedate changed to: "2004-10-19T13:45:08"
    2. closer changed to: "dkf"
    3. foundin changed to: "final: 8.3.5"
    4. icomment:
      Logged In: YES 
      user_id=79902
      
      These are all not bugs; just funny (and inefficient) ways to
      construct lists.
      
      Tcl, by definition, concatenates lists and characters by
      converting the list to a string and concatenating strings.
      Then the join command (or any other list-consuming command)
      reinterprets the resulting string as a list again.  Of the
      characters you list ("[", ",", ".", "{", "}", ")", "\"), all
      except the {curly braces} and backslash have no meaning to
      the list parsing engine at all. When a curly brace starts a
      word in a list, that word extends up to the matching closing
      curly (which must not have any trailing chars) but that is
      the only time they are significant. Backslashes are special
      in front of some characters, but you have to distinguish
      between quoting them to the command you're typing in and the
      actual list engine.
      
      To summarize, what you've written is all correct and
      intended (if perhaps surprising the first time you encounter
      it.)
      
      
    5. login: "dkf"
    6. mimetype: "text/plain"
    7. resolution changed to: "Invalid"
    8. status changed to: "Closed"
    9. subsystem changed to: "14. List Object"
    10. username: "dkf"