Skip to content
Tcl Source Code History Of Ticket 434876ffffffffff
Login

History Of Ticket 434876ffffffffff

Artifacts Associated With Ticket 434876ffffffffff

  1. Ticket change [0594901f57] (rid 89087) by lvirden on 2001-06-20 18:50:24:

    1. assignee initialized to: "nobody"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      In all versions of tcl that I have tested the following
      seems to be incorrect:
      
      $ tclsh
      % ln -s /lwv /tmp/notthere
      % glob /tmp/notthere*
      /tmp/notthere
      % glob /tmp/notthere
      no files matched glob pattern "/tmp/notthere"
      while evaluating {glob /tmp/notthere}
      
      For some reason, glob reads too 'deeply' into
      the fact that the file being pointed at does not yet
      appear.
      
      In cases where the file name is a value being passed by
      the user, it becomes nearly impossible to work around
      this bug.
      
    4. foundin initialized to: "obsolete: 8.4a3"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "lvirden"
    9. subsystem initialized to: "37. File System"
    10. title initialized to: "glob of symlink returns incorrect err"
    11. type initialized to: "Bug"
  2. Ticket change [817810076a] (rid 117041) by vincentdarley on 2001-08-16 22:03:04:

    1. icomment:
      Logged In: YES 
      user_id=32170
      
      There have been some changes to this code in the 8.4a3 
      (after the vfs code was added), do you still see this 
      problem?
      
      It does appear as if Tcl is doing something slightly wrong 
      wrt stat-vs-lstat...
      
      
    2. login: "vincentdarley"
    3. mimetype: "text/plain"
    4. username: "vincentdarley"
  3. Ticket change [bbc0ca9dc6] (rid 129542) by vincentdarley on 2001-08-17 00:00:42:

    1. icomment:
      Logged In: YES 
      user_id=32170
      
      There have been some changes to this code in the 8.4a3 
      (after the vfs code was added), do you still see this 
      problem?
      
      It does appear as if Tcl is doing something slightly wrong 
      wrt stat-vs-lstat...
      
      
    2. login: "vincentdarley"
    3. mimetype: "text/plain"
    4. username: "vincentdarley"
  4. Ticket change [ece288fc8b] (rid 103783) by lvirden on 2001-08-17 00:09:30:

    1. icomment:
      Logged In: YES 
      user_id=15949
      
      Yes, I still see this behavior with the latest (last nite)
      version of tcl.
      
      
    2. login: "lvirden"
    3. mimetype: "text/plain"
    4. username: "lvirden"
  5. Ticket change [a6df8d2914] (rid 98681) by vincentdarley on 2001-08-18 00:16:56:

    1. icomment:
      Logged In: YES 
      user_id=32170
      
      glob, or more precisely 'TclDoGlob' in tclFileName.c (near 
      the very end of the file) uses this piece of code to decide 
      whether to add a complete file name (no pattern involved) 
      to the result:
      
          if (Tcl_Access(name, F_OK) == 0) {
      then add to glob result
          }
      
      This differs to the pattern matching code 
      (TclpMatchInDirectory) which will simply add anything 
      returned by the OS 'opendir/readdir' combination, without 
      actually checking whether the file exists (unless you pass 
      in additional '-types' arguments).
      
      So, the solution would seem to be to change that Tcl_Access 
      to something else.  Or at least, if the access fails, to 
      try 'lstat' instead.  Could you test what happens if you 
      replace if (Tcl_Access .. == 0) by 'if (Tcl_LStat(..) == 
      0)'?  (or something like that)....
      
      
      
      
    2. login: "vincentdarley"
    3. mimetype: "text/plain"
    4. username: "vincentdarley"
  6. Ticket change [48eaa464ca] (rid 99978) by lvirden on 2001-08-20 17:13:29:

    1. icomment:
      Logged In: YES 
      user_id=15949
      
      Unfortunately, I wasn't able to figure out how to add
      the code.  Tcl_FSLstat takes an TclObj for a pathname
      and I don't have the background to figure out how to create
      one of those...
      
      If someone can come up with a patch, I can test it out -
      I provided a simple script in the original bug report
      for recreating the problem on at least SPARC Solaris...
      I wasn't aware that the bug didn't exist everywhere.
      
      
    2. login: "lvirden"
    3. mimetype: "text/plain"
    4. username: "lvirden"
  7. Ticket change [c71f0c1cf1] (rid 121883) by vincentdarley on 2001-08-20 18:08:58:

    1. icomment:
      Logged In: YES 
      user_id=32170
      
      Could you test this:
      
      case TCL_PLATFORM_UNIX: {
          Tcl_Obj *nameObj;
          struct stat buf;
          
          if (Tcl_DStringLength(headPtr) == 0) {
      if ((*name == '\\' && name[1] == '/') || (*name 
      == '/')) {
          Tcl_DStringAppend(headPtr, "/", 1);
      } else {
          Tcl_DStringAppend(headPtr, ".", 1);
      }
          }
          nameObj = Tcl_NewStringObj(Tcl_DStringValue(headPtr), 
             Tcl_DStringLength(headPtr));
          if (Tcl_FSLstat(nameObj, &buf) == 0) {
      Tcl_ListObjAppendElement(interp, Tcl_GetObjResult
      (interp), 
       nameObj);
          } else {
      Tcl_DecrRefCount(nameObj);
          }
          break;
      }
      
      
      
    2. login: "vincentdarley"
    3. mimetype: "text/plain"
    4. username: "vincentdarley"
  8. Ticket change [4e3260c2de] (rid 127181) by lvirden on 2001-08-20 18:40:09:

    1. icomment:
      Logged In: YES 
      user_id=15949
      
      I have made the change you requested.  However, 
      it doesn't fix the problem:
      
      $ tclsh
      % glob /tmp/notthere*
      /tmp/notthere
      % glob /tmp/notthere
      no files matched glob pattern "/tmp/notthere"
      
      
      Note there is one difference - now the message no longer
      says "while evaluating {glob /tmp/notthere}"; I have no
      idea why that is now missing!
      
      
    2. login: "lvirden"
    3. mimetype: "text/plain"
    4. username: "lvirden"
  9. Ticket change [439e8680cc] (rid 116594) by vincentdarley on 2001-08-20 18:42:38:

    1. icomment:
      Logged In: YES 
      user_id=32170
      
      Actually the patch I gave below can segfault under some 
      circumstances.  This is better:
      
          Tcl_Obj *nameObj;
          struct stat buf;
          
          if (Tcl_DStringLength(headPtr) == 0) {
      if ((*name == '\\' && name[1] == '/') || 
      (*name == '/')) {
          Tcl_DStringAppend(headPtr, "/", 1);
      } else {
          Tcl_DStringAppend(headPtr, ".", 1);
      }
          }
          nameObj = Tcl_NewStringObj(Tcl_DStringValue
      (headPtr), 
             Tcl_DStringLength
      (headPtr));
          Tcl_IncrRefCount(nameObj);
          if (Tcl_FSLstat(nameObj, &buf) == 0) {
      Tcl_ListObjAppendElement(interp, 
      Tcl_GetObjResult(interp), 
       nameObj);
          }
          Tcl_DecrRefCount(nameObj);
          break;
      
      
      
    2. login: "vincentdarley"
    3. mimetype: "text/plain"
    4. username: "vincentdarley"
  10. Ticket change [e30fae774b] (rid 87724) by lvirden on 2001-08-20 19:57:03:

    1. icomment:
      Logged In: YES 
      user_id=15949
      
      even with your improved patch, the glob continues to
      work in the same fashion as it did.
      
      
    2. login: "lvirden"
    3. mimetype: "text/plain"
    4. username: "lvirden"
  11. Ticket change [83460b8d9a] (rid 117361) by dkf on 2001-08-20 21:14:52:

    1. assignee changed to: "vincentdarley"
    2. icomment:
      Logged In: YES 
      user_id=79902
      
      Vince, with your later change it works exactly as advertised
      for me under Solaris; I cannot reproduce Larry's problem.
      Should this (corrected) behaviour and its fix be propagated
      through to the other platforms too?  (I suppose if they can
      have broken links...)  Would that allow any refactoring of
      code?
      
      
    3. login: "dkf"
    4. mimetype: "text/plain"
    5. username: "dkf"
  12. Ticket change [f585d91a32] (rid 130123) by nobody on 2001-08-20 21:16:24:

    1. icomment:
      Logged In: NO 
      
      I've found a sunos machine I have access to, on which this 
      fails, and have tried my patch below.  It works for me:
      
      sfi ~> ls -l bbb
      lrwxrwxrwx   1 vince    info            3 Aug 20 08:05 bbb -
      > aaa
      sfi ~> ls -l aaa
      ls: aaa: No such file or directory
      Exit 1
      sfi ~> ./tcl/tcl/unix/tclsh
      % info patchlevel
      8.4a4
      % parray tcl_platform
      tcl_platform(byteOrder) = bigEndian
      tcl_platform(machine)   = sun4u
      tcl_platform(os)        = SunOS
      tcl_platform(osVersion) = 5.7
      tcl_platform(platform)  = unix
      tcl_platform(user)      = vince
      % glob bbb*
      bbb
      % glob bbb
      bbb
      %
      
      
      Or, to give an example closer to yours:
      
      % ln -s foo /tmp/notthere
      % glob /tmp/notthere
      /tmp/notthere
      
      I think this means you've got a problem with the wrong 
      version of Tcl being picked up in your testing.  Unless 
      there are strenuous objections I'll mark this bug closed 
      when I apply the patch (along with a variety of other fs 
      changes) -- Vince..
      
      
      
    2. login: "nobody"
    3. mimetype: "text/plain"
    4. username: "nobody"
  13. Ticket change [6c9f603fe0] (rid 128545) by lvirden on 2001-08-20 21:20:01:

    1. icomment:
      Logged In: YES 
      user_id=15949
      
      I just tried from a different computer (same install image)
      and I see it working from there as well.  So it
      should be fine to make this one closed.
      
      
    2. login: "lvirden"
    3. mimetype: "text/plain"
    4. username: "lvirden"
  14. Ticket change [8492e85d3e] (rid 117576) by nobody on 2001-08-20 23:33:33:

    1. icomment:
      Logged In: NO 
      
      Responding to dkf below, yes this does allow refactoring of 
      some code, which I've now done.  The end of TclDoGlob is 
      now a bit simpler, and more code is shared.  I'm working on 
      a variety of other small filesystem issues and will commit 
      the patch when a few other things are done -- Vince.
      
      
      
    2. login: "nobody"
    3. mimetype: "text/plain"
    4. username: "nobody"
  15. Ticket change [949bbcb15a] (rid 106021) by vincentdarley on 2001-08-24 01:26:50:

    1. closedate changed to: "2001-08-23T18:26:50"
    2. closer changed to: "vincentdarley"
    3. icomment:
      Logged In: YES 
      user_id=32170
      
      Fixed in cvs head
      
      
    4. login: "vincentdarley"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"
    8. username: "vincentdarley"