Artifacts Associated With Ticket 4f322b9d2112772a
Ticket change [51847a2a1a] (rid 164385) by sebres on 2018-07-02 12:12:33:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-fossil-wiki"
- 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. - foundin initialized to: ">= 8.5"
- is_private initialized to: "0"
- login: "sebres"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- severity initialized to: "Minor"
- status initialized to: "Open"
- submitter initialized to: "sebres"
- subsystem initialized to: "16. Commands A-H"
- title initialized to:
Impossibility to create an unique path in Tcl (e. g. using file mkdir)
- type initialized to: "RFE"
Ticket change [46d09e9de4] (rid 164394) by sebres on 2018-07-02 15:05:03:
- 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.
- login: "sebres"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Fixed"
- status changed to: "Pending"
- icomment:
Ticket change [c7fe9f4d49] (rid 164611) by aspect on 2018-07-12 09:43:10:
- 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.
- login: "aspect"
- mimetype: "text/plain"
- icomment:
Ticket change [8c357b4f90] (rid 166223) by sebres on 2018-10-10 22:41:54:
- 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?
- login: "sebres"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [6ca8405452] (rid 258156) by serhiy.storchaka on 2026-10-15 11:39:52:
- 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.
- login: "serhiy.storchaka"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Rejected"
- status changed to: "Closed"
- icomment:
Ticket change [ba33e60b4b] (rid 259948) by serhiy.storchaka on 2026-10-22 17:19:27:
- closedate changed to: "2461328.986018646"
- closer changed to: "serhiy.storchaka"
- login: "serhiy.storchaka"