Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 7b9ad97585304619b28f44562c46cb461baed7d9
Ticket: 1750300fffffffffffffffffffffffffffffffff
Unexpected [glob] result, when types list is empty
User & Date: georgeps on 2007-12-15 04:54:53
Changes

  1. icomment:
    Logged In: YES 
    user_id=585068
    Originator: NO
    
    Cool bug:
    % cd /  
    % glob -types {} -- TMP tmp
    TMP tmp
    % file exists TMP
    0
    % glob -- TMP tmp
    tmp
    
    Here's a patch that fixes it:
    Index: tclFileName.c
    ===================================================================
    RCS file: /cvsroot/tcl/tcl/generic/tclFileName.c,v
    retrieving revision 1.86
    diff -u -r1.86 tclFileName.c
    --- tclFileName.c       13 Dec 2007 15:23:17 -0000      1.86
    +++ tclFileName.c       14 Dec 2007 21:46:51 -0000
    @@ -1412,6 +1412,11 @@
             */
     
            Tcl_ListObjLength(interp, typePtr, &length);
    +
    +       if (length <= 0) {
    +            goto skipTypes;
    +       }       
    +
            globTypes = (Tcl_GlobTypeData*)
                    TclStackAlloc(interp,sizeof(Tcl_GlobTypeData));
            globTypes->type = 0;
    @@ -1529,6 +1534,7 @@
            }
         }
     
    +skipTypes:
         /*
          * Now we perform the actual glob below. This may involve joining together
          * the pattern arguments, dealing with particular file types etc. We use a
    
    
    
  2. login: "georgeps"
  3. mimetype: "text/plain"
  4. username: "georgeps"