Skip to content
Tcl Source Code History Of Ticket 16fe1b5807820bb
Login

History Of Ticket 16fe1b5807820bb

Artifacts Associated With Ticket 16fe1b5807820bb

  1. Ticket change [429b3ff3f8] (rid 158170) by pooryorick on 2017-11-10 11:48:07:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-fossil-wiki"
    4. comment initialized to:
      This script,
      
      <code><verbatim>
      namespace eval : {
          namespace ensemble create
          namespace export *
          proc p1 {} {
              puts {hello from p1}
          }
      }
      
      : p1
      </verbatim></code>
      
      , results in the following error:
      
      <code><verbatim>
      invalid command name ":"
      </verbatim></code>
      
    5. foundin initialized to: "8.6"
    6. is_private initialized to: "0"
    7. login: "pooryorick"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "e476148cded301ffff84bcdc432536dc0c949e88"
    10. resolution initialized to: "None"
    11. severity initialized to: "Minor"
    12. status initialized to: "Open"
    13. submitter initialized to: "pooryorick"
    14. subsystem initialized to: "21. [namespace]"
    15. title initialized to:
      namespace ensemble command named ":" is mistakenly given the empty string as its name
      
    16. type initialized to: "Bug"
  2. Ticket change [86d52ad4ae] (rid 158171) by aspect on 2017-11-11 01:47:20:

    1. icomment:
      Simpler demo:
      
        [8.7a2] % namespace ensemble create -command :
        ::
      
      The responsible code seems to be:
      
      https://core.tcl.tk/tcl/artifact/9cf6780328312995?ln=672-681
      
      which is distinct from how other commands (proc, coroutine) qualify names 
      before calling Tcl_NRCreateCommand/Tcl_CreateObjCommand, eg (note the 
      comment here):
      
      https://core.tcl.tk/tcl/artifact/46a345d533c6582c?ln=8985-9015
      
      seems like a great candidate for factoring into tclUtil.c and using 
      uniformly across command-creating commands.
      
      The first question is, is this the right approach?
      
      The second is, what command-creating commands are there that should be 
      brought into line?  This is a can of worms ..
      
    2. login: "aspect"
    3. mimetype: "text/plain"
  3. Ticket change [fb83d4f5da] (rid 158172) by aspect on 2017-11-11 01:54:52:

    1. icomment:
      .. worms:
      
        [8.7a2] % namespace eval foo {proc : {} {namespace current}}
        can't create procedure ":" in non-global namespace with name starting with ":"
        [8.7a2] % namespace eval foo {proc x {} {namespace current}}
        [8.7a2] % namespace eval foo {rename x :}
        [8.7a2] % namespace eval foo :
        ::foo
      
        [8.7a2] % oo::class create {}
        object name must not be empty
        [8.7a2] % oo::class create :
        ::
        [8.7a2] % {} create {}
        object name must not be empty
        [8.7a2] % {} create :
        Segmentation fault (core dumped)
      
    2. login: "aspect"
    3. mimetype: "text/plain"
  4. Ticket change [fee5867cdd] (rid 158257) by pooryorick on 2017-11-14 07:53:20:

    1. icomment:
      Also:
      
      <code><verbatim>
      namespace eval : {
          proc p1 {} {
              puts hello
          }
      }
      
      puts [namespace which p1] ;# -> ::p1
      </verbatim></code>
      
    2. login: "pooryorick"
    3. mimetype: "text/x-fossil-wiki"
  5. Ticket change [06779e02be] (rid 158630) by aspect on 2017-11-18 12:18:02:

    1. icomment:
      I'm not comfortable with these changes being applied to a mainline branch, 
      so I've moved them to [pyk-command-named-colon].
      
      Rationale is that names like : or :foo reduce the utility of [namespace 
      which] and break with documented behaviour ("two or more colons" are a 
      namespace separator).  Further, as the TclOO segfault below illustrates, 
      this is a can of worms likely to uncover implicit assumptions elsewhere 
      in the core.
      
      I suspect there's useful stuff in the patch, but I'd like to see a more 
      considered approach .. preferably including unifying the name 
      canonicalisation code referred to below.
      
    2. login: "aspect"
    3. mimetype: "text/plain"
  6. Ticket change [eb503f31e6] (rid 158648) by pooryorick on 2017-11-18 21:04:04:

    1. icomment:
      Fixed in [b433ae397cddec65].
      
      The issue was that <code>namespace.c/NsEnsembleImplementationCmdNR</code>,
      which is responsible for resolving aned evaluating namespace ensemble commands,
      [https://core.tcl.tk/tcl/artifact?ln=1735&name=9cf6780328312995|calls
      BuildEnsembleConfig] , which
      [https://core.tcl.tk/tcl/artifact?ln=2640&name=9cf6780328312995|slaps together]
      a fully-qualified name for an exported command.
      
      I modified <code>BuildEnsembleConfig</code>
      [https://core.tcl.tk/tcl/artifact?ln=2671,2679=on&name=e41dd54b9eb45fca|to stop
      building up fully-qualified names], and then modified
      <code>NsEnsembleImplementationCmdNR</code>
      [https://core.tcl.tk/tcl/artifact?ln=1924,1925&name=e41dd54b9eb45fca|to use the
      namespace for comand lookup] rather than using a fully-qualified name.
      
      On the "front end", I relieved <code>TclProcObjCmd</code>
      [https://core.tcl.tk/tcl/artifact?ln=144-145&name=0be3006f576cb9aa|of the
      duty of slapping together a fully-qualified name], and created
      [https://core.tcl.tk/tcl/artifact?ln=8213-8226&name=e33d6838e61d9a4f|tclNRCreateCommandInNs]
      for it to call instead of calling <code>tclNRCreateCommand</code>, which
      doesn't accept a namespace.  This in turn required the creation of
      [https://core.tcl.tk/tcl/artifact?ln=2288&name=e33d6838e61d9a4f|tclCreateObjectCommandInNs],
      and
      [https://core.tcl.tk/tcl/artifact?ln=2237&name=e33d6838e61d9a4f|Tcl_CreateObjCommand]
      becomes a thin wrapper over that.
      
      [https://core.tcl.tk/tcl/artifact?ln=2427&name=d80559c9d6db894d|TclEnsureNamespace]
      is a new utility command that, given a namespace, either returns that
      namespace, or if that namespace is in a deleted state, returns a new namespace
      in its place.
      
    2. login: "pooryorick"
    3. mimetype: "text/x-fossil-wiki"
  7. Ticket change [dfb1b751bb] (rid 158657) by pooryorick on 2017-11-19 00:23:57:

    1. icomment:
      Checkin [8251e62bab] additionally fixes the TclOO segmentation fault noted below, and updates [https://core.tcl.tk/tcl/artifact?ln=9022-9024&name=bcad51a2a66decdf|coroutine] and [https://core.tcl.tk/tcl/artifact?ln=658-669&name=c572db2027241900|TclOO] command creation routines to use [https://core.tcl.tk/tcl/artifact?ln=2288&name=bcad51a2a66decdf|TclCreateObjCommandInNs].
      
    2. login: "pooryorick"
    3. mimetype: "text/x-fossil-wiki"
  8. Ticket change [b7ff755c27] (rid 158658) by pooryorick on 2017-11-19 16:26:55:

    1. icomment:
      Regarding aspect's rationale:
      
         1.  It's already possible to create commands like : and :foo.  This fix does not affect that.
      
         2.  The segfault is a separate issue, and is also now fixed.
      
         3.  The fix *does* unify the name canonicalisation code referred to below.
      
    2. login: "pooryorick"
    3. mimetype: "text/x-fossil-wiki"
  9. Ticket change [fcff48022c] (rid 158672) by pooryorick on 2017-11-20 08:12:09:

    1. icomment:
      The TclOO segmentation fault had nothing to do with ":" characters, but rather with the act of replacing a command that happened to be a class with a command having the same name, [https://core.tcl.tk/tcl/artifact?ln=1786=on&name=8f2e330ff2988b2c|causing the class to be deleted while a pointer to its structure was in use].
      
    2. login: "pooryorick"
    3. mimetype: "text/x-fossil-wiki"
  10. Ticket change [b394d84293] (rid 158704) by aspect on 2017-11-20 13:31:09:

    1. icomment:
      Thanks for the detailed writeup!  Following along with that and the patches 
      I have a much better idea, and like the look of what you've done:  it does 
      make things more uniform and removes some string/dstring juggling which aids 
      readability.
      
      I was put off by the removal of error checking in Tcl_ProcObjCmd that prevents:
      
      % namespace eval foo {proc : {} {}}
      
      .. but with the unification you have performed, this can be restored in 
      TclGetNamespaceForQualName to the benefit of all creative commands, if indeed 
      that's what we want.
      
      I'm still not too keen on enshrining creation of a namespace called ":" in 
      the test suite (even though this was already possible, as you point out), 
      but since it clearly identifies this bug the context is clear and the test 
      can be adjusted in future.
      
      One tiny nit:
      
      > Tcl_Command TclCreateObjCommandInNs(
      > Tcl_Command TclNRCreateCommandInNs(
      
      should have newlines before the function name.
      
    2. login: "aspect"
    3. mimetype: "text/plain"
  11. Ticket change [229d2036ad] (rid 158925) by pooryorick on 2017-11-25 16:59:25:

    1. closedate changed to: "2458083.20793023"
    2. closer changed to: "pooryorick"
    3. login: "pooryorick"
    4. mimetype: "text/plain"
    5. resolution changed to: "Fixed"
    6. status changed to: "Closed"
  12. Ticket change [f602458f3d] (rid 158951) by jan.nijtmans on 2017-11-28 09:12:12:

    1. assignee changed to: "pooryorick"
    2. closer changed to: "nobody"
    3. icomment:
      It appears that this fix caused [6cf568a21bd8fc9b1f63543efe92cbedaa5a7160]. I'm not suggestiong that this fix is wrong, but it might be that this fix exposes a latent bug somewhere else. It's worth to have another look. Please! Any ideas?
      
    4. login: "jan.nijtmans"
    5. mimetype: "text/x-fossil-wiki"
    6. status changed to: "Pending"
  13. Ticket change [f4b48c7563] (rid 158971) by dgp on 2017-11-28 19:50:29:

    1. icomment:
      % oo::class create ns::foo
      make: *** [shell] Segmentation fault
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  14. Ticket change [77e7a8d1a0] (rid 159000) by pooryorick on 2017-11-29 11:27:57:

    1. icomment:
      Yes, see [93c437ef370480b3c80fb63726a3e460467df37|the fix] for the [6cf568a21bd8fc9b1f63543efe92cbedaa5a7160|the ticket you mentioned]. The original fix for the current issue was incomplete, but the Tcl test suite didn't detect it.
      
    2. login: "pooryorick"
    3. mimetype: "text/x-fossil-wiki"
  15. Ticket change [c093f6095d] (rid 159001) by pooryorick on 2017-11-29 11:28:14:

    1. closedate changed to: "2458086.97794398"
    2. closer changed to: "pooryorick"
    3. login: "pooryorick"
    4. mimetype: "text/plain"
    5. status changed to: "Closed"
  16. Ticket change [07dbcd22bb] (rid 169054) by pooryorick on 2019-02-07 15:47:09:

    1. closer changed to: "nobody"
    2. comment changed to:
      <code>info level 0</code> simply returns all the words in the command
      associated with a level.  It was not intended as a mechanism for resolving the
      command to a fully-qualified name, and it generally does not:
      
      <code><verbatim>
      namespace eval n1 {} {
      	proc p args {
      		puts [info level 0]
      	}
      
      	namespace export *
      	namespace ensemble create
      	p n1
      }
      
      namespace eval n2 {} {
      	namespace path ::n1
      	p n2
      }
      </verbatim></code>
      
      
      The fact that the namespace ensemble command resolution routines ever rewrote
      the command name was incidental, and not intended to be part of the public
      interface.  In order to fix [16fe1b5807] the ensemble subcommand lookup
      routines no longer make this artifact visible to <code>info level</code>.  This
      is not a bug.  Furthermore, <code>info level 0</code> is now more consistent.
      It no longer rewrites the command provided by the caller.
      
    3. icomment:
      <code>info level 0</code> simply returns all the words in the command
      associated with a level.  It was not intended as a mechanism for resolving the
      command to a fully-qualified name, and it generally does not:
      
      <code><verbatim>
      namespace eval n1 {} {
      	proc p args {
      		puts [info level 0]
      	}
      
      	namespace export *
      	namespace ensemble create
      	p n1
      }
      
      namespace eval n2 {} {
      	namespace path ::n1
      	p n2
      }
      </verbatim></code>
      
      
      The fact that the namespace ensemble command resolution routines ever rewrote
      the command name was incidental, and not intended to be part of the public
      interface.  In order to fix [16fe1b5807] the ensemble subcommand lookup
      routines no longer make this artifact visible to <code>info level</code>.  This
      is not a bug.  Furthermore, <code>info level 0</code> is now more consistent:
      It now always returns the command as provided by the caller, instead of just
      doing that in the common case.
      
    4. login: "pooryorick"
    5. mimetype: "text/x-fossil-wiki"
    6. resolution changed to: "Invalid"
    7. status changed to: "Pending"
  17. Ticket change [e374104fe1] (rid 169056) by pooryorick on 2019-02-07 16:17:37:

    1. closedate changed to: "2458522.1789035"
    2. closer changed to: "pooryorick"
    3. comment changed to:
      This script,
      
      
      <code><verbatim>
      namespace eval : {
          namespace ensemble create
          namespace export *
          proc p1 {} {
              puts {hello from p1}
          }
      }
      
      : p1
      </verbatim></code>
      , results in the following error:
      
      
      invalid command name ":"
      
    4. icomment:
      Disregard the previous comment.  It was for [8b9854c3d8ba].
      
    5. login: "pooryorick"
    6. mimetype: "text/x-fossil-wiki"
    7. resolution changed to: "Fixed"
    8. status changed to: "Closed"
  18. Ticket change [8b65abfcc8] (rid 170008) by dgp on 2019-03-11 14:19:59:

    1. closedate changed to: "2458554.09721839"
    2. closer changed to: "dgp"
    3. icomment:
      
      How in the world did the namespace facility ever permit any namespace to
      have the name ":" ?
      
    4. login: "dgp"
    5. mimetype: "text/plain"
  19. Ticket change [1c3b1c9535] (rid 172567) by dgp on 2019-06-17 18:05:25:

    1. assignee changed to: "dgp"
    2. closer changed to: "nobody"
    3. icomment:
      
      Re-opened. The change applied to fix this issue caused an 
      unacceptable regression [8b9854c3d8ba]. This issue is still
      captured as test namespcae-56.4 which is marked for now as
      a "knownBug".
      
    4. login: "dgp"
    5. mimetype: "text/plain"
    6. resolution changed to: "None"
    7. status changed to: "Open"
  20. Ticket change [b5a852ab5f] (rid 235287) by jan.nijtmans on 2024-11-21 13:45:53:

    1. closedate changed to: "2460636.07354139"
    2. closer changed to: "jan.nijtmans"
    3. icomment:
      Dup of [f14b33ec]. Closing.
      
      The saga continues.
      
    4. login: "jan.nijtmans"
    5. mimetype: "text/x-fossil-wiki"
    6. resolution changed to: "Duplicate"
    7. status changed to: "Closed"