Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 5d715ebe4f599657d54c2d77f67ae8e5470e96b6
Ticket: 218410ffffffffffffffffffffffffffffffffff
[package forget] not as documented
User & Date: nobody on 2000-10-26 00:57:15
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 5418 Bug
    Version: 8.4a1
    SubmitDate: '2000-05-10'
    LastModified: '2000-06-26'
    Severity: MED
    Status: Closed
    Submitter: techsupp
    ChangedBy: ericm
    OS: All
    FixedDate: '2000-10-25'
    ClosedDate: '2000-06-26'
    
    
    Name:
    
    Don Porter
    
    
    
    CVS:
    
    $Id: tclPkg.c,v 1.5 1999/09/21 04:20:40 hobbs Exp $
    
    
    
    Comments:
    
    The test suite depended on the buggy behavior.  
    
        The patch fixes that too.  It also makes sure
    
        the tcltest::verbose settings are honored by
    
        the pkg-* tests.
    
        
    
        The real danger here is that the command
    
        
    
        package forget http 2.3
    
        
    
        does not raise an error which may mislead
    
        people into thinking [package forget]
    
        accepts <package> <version> as arguments.
    
    
    
    ReproducibleScript:
    
    #FILE: demo.tcl
    
    set msg ""
    
    puts "[catch {package forget} msg] $msg"
    
    puts "[catch {package forget a b} msg] $msg"
    
    
    
    ObservedBehavior:
    
    $ tclsh demo.tcl
    
    0
    
    0
    
    
    
    DesiredBehavior:
    
    $ tclsh demo.tcl
    
    1 wrong # args: should be "package forget package"
    
    1 wrong # args: should be "package forget package"
    
    
    
    Patch:
    
    Index: generic/tclPkg.c
    
    ===================================================================
    
    RCS file: /cvsroot/tcl/generic/tclPkg.c,v
    
    retrieving revision 1.5
    
    diff -c -r1.5 tclPkg.c
    
    *** tclPkg.c    1999/09/21 04:20:40     1.5
    
    --- tclPkg.c    2000/05/09 20:28:23
    
    ***************
    
    *** 499,504 ****
    
    --- 499,508 ----
    
          switch ((enum pkgOptions) optionIndex) {
    
            case PKG_FORGET: {
    
                char *keyString;
    
    +           if (objc != 3) {
    
    +               Tcl_WrongNumArgs(interp, 2, objv, "package");
    
    +               return TCL_ERROR;
    
    +           }
    
                for (i = 2; i < objc; i++) {
    
                    keyString = Tcl_GetString(objv[i]);
    
                    hPtr = Tcl_FindHashEntry(&iPtr->packageTable, keyString);
    
    Index: tests/pkg.test
    
    ===================================================================
    
    RCS file: /cvsroot/tcl/tests/pkg.test,v
    
    retrieving revision 1.8
    
    diff -c -r1.8 pkg.test
    
    *** pkg.test    2000/04/10 17:19:03     1.8
    
    --- pkg.test    2000/05/09 20:28:24
    
    ***************
    
    *** 23,31 ****
    
      interp eval $i [list set argv $argv]
    
      interp eval $i [list package require tcltest]
    
      interp eval $i [list namespace import -force ::tcltest::*]
    
      interp eval $i {
    
      
    
    ! eval package forget [package names]
    
      set oldPkgUnknown [package unknown]
    
      package unknown {}
    
      set oldPath $auto_path
    
    --- 23,35 ----
    
      interp eval $i [list set argv $argv]
    
      interp eval $i [list package require tcltest]
    
      interp eval $i [list namespace import -force ::tcltest::*]
    
    + interp eval $i [list set ::tcltest::verbose $::tcltest::verbose]
    
      interp eval $i {
    
      
    
    ! foreach p [package names] {
    
    !     package forget $p
    
    ! }
    
    ! 
    
      set oldPkgUnknown [package unknown]
    
      package unknown {}
    
      set oldPath $auto_path
    
    ***************
    
    *** 296,306 ****
    
          package ifneeded a 1.1 {first script}
    
          package ifneeded b 2.3 {second script}
    
          package ifneeded c 1.4 {third script}
    
    -     package forget
    
          set result [list [lsort [package names]]]
    
    !     package forget a c
    
          lappend result [lsort [package names]]
    
    ! } {{a b c} b}
    
      test pkg-3.6 {Tcl_PackageCmd procedure, "ifneeded" option} {
    
          list [catch {package ifneeded a} msg] $msg
    
      } {1 {wrong # args: should be "package ifneeded package version ?script?"}}
    
    --- 300,317 ----
    
          package ifneeded a 1.1 {first script}
    
          package ifneeded b 2.3 {second script}
    
          package ifneeded c 1.4 {third script}
    
          set result [list [lsort [package names]]]
    
    !     package forget a
    
    !     lappend result [lsort [package names]]
    
    !     package forget c
    
          lappend result [lsort [package names]]
    
    ! } {{a b c} {b c} b}
    
    ! test pkg-3.5.1 {Tcl_PackageCmd procedure, "forget" option} {
    
    !     list [catch {package forget} msg] $msg
    
    ! } {1 {wrong # args: should be "package forget package"}}
    
    ! test pkg-3.5.2 {Tcl_PackageCmd procedure, "forget" option} {
    
    !     list [catch {package forget a b} msg] $msg
    
    ! } {1 {wrong # args: should be "package forget package"}}
    
      test pkg-3.6 {Tcl_PackageCmd procedure, "ifneeded" option} {
    
          list [catch {package ifneeded a} msg] $msg
    
      } {1 {wrong # args: should be "package ifneeded package version ?script?"}}
    
    
    
    PatchFiles:
    
    generic/tclPkg.c
    
        tests/pkg.test
    
    
    
    
    
    The existing behavior does allow the user to 
    
    package forget packageA packageB packageC ...
    
    Your change will disallow this behavior; it seems that a better way to address the discrepancy between the docs and the behavior is to correct the docs, in this case.
    
    I will make that change for 8.4a2; please respond if you believe this is not the way to go.
    
       Eric Melski                            The Other Tcl Guy
       ericm at ajubasolutions.com            Ajuba Solutions
    
    -- 06/26/2000 ericm
    
    
    
  4. foundin changed to: "obsolete: 8.4a1"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "56. LibTomMath"
  10. title changed to: "[package forget] not as documented"
  11. type changed to: "Bug"