Skip to content
Tcl Source Code History Of Ticket 4f322b9d2112772a
Login

History Of Ticket 4f322b9d2112772a

Artifacts Associated With Ticket 4f322b9d2112772a

  1. Ticket change [51847a2a1a] (rid 164385) by sebres on 2018-07-02 12:12:33:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-fossil-wiki"
    4. comment initialized to:
      If working multi-threaded (or multi-processed in cluster-system on share) with some global directory to create some system-wide unique sub-path using some pseudo-unique name generation algorithm (also UUID), to avoid retrieving of the same folder for two workers, one can do the things like this:
      <code><pre style="padding-left:10pt">
      proc get_unique_dir {} {
        while 1 {
          set p [file join $GLOB_PATH [some_uuid_algo]]
          if {![file exists $p]} {
            file mkdir $p
            break
          }
        }
        return $p
      }
      </pre></code>
      
      But it's affected by the race condition (firstly not exists for both workers, then one creates sub-path, another returns with no error in `file mkdir` on same existing path), if some_uuid_algo cannot guarantee a system-wide unique path.
      
      So the creation of a safe construct for that is impossible in Tcl currently.
      
      <b>Suggestion:</b>
      
      Currently `file mkdir` returns no result at all. <br/>
      If `TclFileMakeDirsCmd` will be extended with return value as counter (of created <b>tail</b>-directories), one may use it to avoid race condition in above-mentioned script, like here:
      <code><pre style="padding-left:10pt">
      proc get_unique_dir {} {
        while 1 {
          set p [file join $GLOB_PATH [some_uuid_algo]]
          if {[file mkdir $p]} {
            break
          }
        }
        return $p
      }
      </pre></code>
      
      This is race condition safe.
      The only one backwards-incompatibility in this case would be usage like this:
      <code><pre style="padding-left:10pt">
      set some_var "when [file mkdir $some_path]was used in substitution"
      </pre></code>
      But I believe the way like this is very rarely (or almost never) used.
      
    5. foundin initialized to: ">= 8.5"
    6. is_private initialized to: "0"
    7. login: "sebres"
    8. priority initialized to: "5 Medium"
    9. resolution initialized to: "None"
    10. severity initialized to: "Minor"
    11. status initialized to: "Open"
    12. submitter initialized to: "sebres"
    13. subsystem initialized to: "16. Commands A-H"
    14. title initialized to:
      Impossibility to create an unique path in Tcl (e. g. using file mkdir)
      
    15. type initialized to: "RFE"
  2. Ticket change [46d09e9de4] (rid 164394) by sebres on 2018-07-02 15:05:03:

    1. icomment:
      Implemented in branch [./vdiff?from=core-8-5-branch&to=rfe-4f322b9d21|rfe-4f322b9d21] for >= 8.5th.
      
      Although I think, it could be accepted as it's, adding a short changelog entry with small incompatibility note like: command `file mkdir` returns integer now vs. nothing previously...
      But TCT should decide about it.
      
      So pending as implemented.
      
    2. login: "sebres"
    3. mimetype: "text/x-fossil-wiki"
    4. resolution changed to: "Fixed"
    5. status changed to: "Pending"
  3. Ticket change [c7fe9f4d49] (rid 164611) by aspect on 2018-07-12 09:43:10:

    1. icomment:
      I approve of this change.  Can we afford to break code that relies on the
      empty result from [file mkdir]?
      
      See also https://core.tcl.tk/tips/doc/trunk/tip/431.md and the ensuing
      wiki discussion at https://wiki.tcl.tk/40609
      
      https://core.tcl.tk/tcl/info/270f78ca95b642fb is also relevant.
      
    2. login: "aspect"
    3. mimetype: "text/plain"
  4. Ticket change [8c357b4f90] (rid 166223) by sebres on 2018-10-10 22:41:54:

    1. icomment:
      So [270f78ca95b642fb] is definitely closed, well it is time to "close" another race-condition (this RFE fixed).<br/>
      Someone with an idea to bring this thing further?<br/>
      I spoke to several people: no one has used <code>[file mkdir]</code> to get/check empty return value / or somehow expected empty values in string like <code>"...[file mkdir]..."</code> or similar imaginable substitutions.<br/>
      Any suggetions, proposals, etc?
      
    2. login: "sebres"
    3. mimetype: "text/x-fossil-wiki"
  5. Ticket change [6ca8405452] (rid 258156) by serhiy.storchaka on 2026-10-15 11:39:52:

    1. icomment:
      Never merged (the return value change would need a TIP); in Tcl 9.0 <nowiki>[file tempdir]</nowiki> from TIP 431 creates a unique directory atomically.
      
    2. login: "serhiy.storchaka"
    3. mimetype: "text/x-fossil-wiki"
    4. resolution changed to: "Rejected"
    5. status changed to: "Closed"
  6. Ticket change [ba33e60b4b] (rid 259948) by serhiy.storchaka on 2026-10-22 17:19:27:

    1. closedate changed to: "2461328.986018646"
    2. closer changed to: "serhiy.storchaka"
    3. login: "serhiy.storchaka"