texlive[54354] Master/tlpkg/tltcl/tltcl.tcl: Fixes for dir_writable

commits+siepo at tug.org commits+siepo at tug.org
Mon Mar 16 21:33:10 CET 2020


Revision: 54354
          http://tug.org/svn/texlive?view=revision&revision=54354
Author:   siepo
Date:     2020-03-16 21:33:10 +0100 (Mon, 16 Mar 2020)
Log Message:
-----------
Fixes for dir_writable

Modified Paths:
--------------
    trunk/Master/tlpkg/tltcl/tltcl.tcl

Modified: trunk/Master/tlpkg/tltcl/tltcl.tcl
===================================================================
--- trunk/Master/tlpkg/tltcl/tltcl.tcl	2020-03-16 20:32:20 UTC (rev 54353)
+++ trunk/Master/tlpkg/tltcl/tltcl.tcl	2020-03-16 20:33:10 UTC (rev 54354)
@@ -548,17 +548,21 @@
 proc dir_writable {d} {
   for {set x 0} {$x<100} {incr x} {
     set y [expr {int(10000*rand())}]
-    set newfile [file join $::instroot $y]
+    set newfile [file join $d $y]
     if [file exists $newfile] {
       continue
     } else {
-      set fid [open $newfile w]
-      chan close $fid
-      if [file exists $newfile] {
-        file delete $newfile
-        return 1
+      if [catch {open $newfile w} fid] {
+        return 0
       } else {
-        return 0
+        chan puts $fid "hello"
+        chan close $fid
+        if [file exists $newfile] {
+          file delete $newfile
+          return 1
+        } else {
+          return 0
+        }
       }
     }
   }



More information about the tex-live-commits mailing list.