Skip to content
Tcl Source Code History Of Ticket 1262180
Login

History Of Ticket 1262180

Artifacts Associated With Ticket 1262180

  1. Ticket change [b7d89e93a7] (rid 128867) by kazrak_ on 2005-08-17 15:05:30:

    1. assignee initialized to: "vincentdarley"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      ------- Original report to ActiveState by Jeff Woods 2005-
      08-16 17:52
      
      ActiveState ActiveTcl 8.4.9.0.121397 Dec 07, 2004
      
      platform: RHEL3 on Dell 2650 (Xeon x86-32)
      
      I think we've stumbled on a race condition in "file mkdir".
      
      The ActiveTcl documentation says (in part):
      file mkdir dir ?dir ...?
      Creates each directory specified. For each pathname dir 
      specified, this command will create all non-existing 
      parent directories as well as dir itself. If an existing 
      directory is specified, then no action is taken and no 
      error is returned. Trying to overwrite an existing file with 
      a directory will result in an error. Arguments are 
      processed in the order specified, halting at the first error, 
      if any.
      
      The errorInfo we get is (lightly edited):
      can't create 
      directory "/some/path/to/logs/ACCT/partial/2005/0813": 
      file already exists
          while executing
      "file mkdir [file dirname $log]"
          (procedure "acctStart" line 20)
          invoked from within
      "acctStart {$Revision: 1.3 $}"
      
      We use cron to launch two Tcl scripts at midnight UTC 
      (18:00 local). Both scripts call a Tcl 
      procedure "acctStart" to log their execution and any 
      errors that might occur. The "acctStart" procedure 
      determines the path to the log file including the PID in 
      the filename and the UTC date in the directory path. Just 
      before opening the log file, it ensures the directory 
      exists by executing the failing command above. We've 
      been using this technique for years to create directories 
      dynamically and haven't had a problem with it until 
      tonight.
      
      After the error occurred I checked and the directory 
      specified in the error exists and contains the log file of 
      the other process that ran at the time (plus other logs 
      created in the interim).
      
      I can only imagine this happening if "file mkdir" is using 
      an algorithm along the lines of "if dirname doesn't exist, 
      then create it" when it should be doing something more 
      like "create dirname; if cant create and existing != 
      directory, then error". 
      
       ------- Comments from Jeff Hobbs 2005-08-16 21:06 
      
           Please report this core issue to http://tcl.sf.net/.
      FWIW, you can see the implementation of 'file mkdir' in 
      tcl/generic/tclFCmd.c:TclFileMakeDirsCmd.
      
    4. foundin initialized to: "obsolete: 8.4.9"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "kazrak_"
    9. subsystem initialized to: "37. File System"
    10. title initialized to: "[file mkdir] race condition"
    11. type initialized to: "Bug"
  2. Ticket change [1bcaf72758] (rid 123209) by vincentdarley on 2005-08-17 22:48:44:

    1. assignee changed to: "hobbs"
    2. icomment:
      Logged In: YES 
      user_id=32170
      
      This is reported against an old version of Tcl. It's
      certainly been fixed in cvs HEAD:
      
      2005-06-13  Vince Darley  <[email protected]>
      
      * generic/tclFCmd.c: correct fix to file mkdir 2005-06-09,
      [Bug 1219176]
      
      2005-06-09  Vince Darley  <[email protected]>
      
      * generic/tclFCmd.c: fix to race condition in file mkdir
      [Bug 1217375]
      
      
      
    3. login: "vincentdarley"
    4. mimetype: "text/plain"
    5. username: "vincentdarley"
  3. Ticket change [dd3ef1847e] (rid 114634) by kazrak_ on 2005-08-17 23:10:25:

    1. icomment:
      Logged In: YES 
      user_id=109728
      
      Is it fixed in a shipping stable (non-alpha/non-beta) release?  
      If I read the CVS tags correctly, the HEAD fix isn't yet 
      merged into the 8.4 branch.
      
      FWIW, I looked for a bug report against mkdir before filing 
      this report but didn't find the old reports. Sorry about the 
      duplication.
      
      
    2. login: "kazrak_"
    3. mimetype: "text/plain"
    4. username: "kazrak_"
  4. Ticket change [9b50206506] (rid 111099) by hobbs on 2005-08-17 23:38:55:

    1. assignee changed to: "vincentdarley"
    2. icomment:
      Logged In: YES 
      user_id=72656
      
      If it isn't merged into 8.4, then it wouldn't be in 8.4.11,
      but AT 8.4.11.0 is the most recent stable release.  Vince -
      can this be considered for backport?
      
      
    3. login: "hobbs"
    4. mimetype: "text/plain"
    5. username: "hobbs"
  5. Ticket change [45547b18ca] (rid 99333) by vincentdarley on 2005-08-17 23:56:18:

    1. icomment:
      Logged In: YES 
      user_id=32170
      
      Certainly a good idea to backport.  The relevant diff is:
      
      http://cvs.sourceforge.net/viewcvs.py/tcl/tcl/generic/tclFCmd.c?r1=1.31&r2=1.34
      
      Vince.
      
      
    2. login: "vincentdarley"
    3. mimetype: "text/plain"
    4. username: "vincentdarley"
  6. Ticket change [2b7e2ea5cb] (rid 118753) by hobbs on 2005-08-18 00:50:14:

    1. icomment:
      Logged In: YES 
      user_id=72656
      
      Backported the simple change to 8.4 branch.
      
      
    2. login: "hobbs"
    3. mimetype: "text/plain"
    4. resolution changed to: "Fixed"
    5. status changed to: "Closed"
    6. username: "hobbs"
  7. Ticket change [196ae835d2] (rid 122801) by hobbs on 2005-08-18 00:50:17:

    1. closedate changed to: "2005-08-17T17:50:17"
    2. closer changed to: "hobbs"