Skip to content

Instantly share code, notes, and snippets.

@msnoigrs
Last active January 27, 2017 06:59
Show Gist options
  • Save msnoigrs/1e298d1d7b93aaec9e7fff65ede8af8d to your computer and use it in GitHub Desktop.
Save msnoigrs/1e298d1d7b93aaec9e7fff65ede8af8d to your computer and use it in GitHub Desktop.
TexLive 2016をWindowsにインストールするときに、"Permission denied" でランダムに失敗する場合、tlpkg/TeXLive/TLPDB.pmの以下の位置にwaitを入れるとうまくいく。close後のsleepが重要。必要であればsleepする時間を長くする。
--- TLPDB.pm.orig 2016-05-16 11:49:27.000000000 +0900
+++ TLPDB.pm 2017-01-27 15:25:47.149889400 +0900
@@ -479,9 +479,17 @@
my $path = $self->location;
mkdirhier(dirname($path));
my $tmppath = "$path.tmp";
- open(FOO, ">$tmppath") || die "$0: open(>$tmppath) failed: $!";
+ my $count = 0;
+ while(1) {
+ open(FOO, ">$tmppath") && last;
+ Time::HiRes::sleep(0.01); # sleep 0.01 second
+ if ($count++ == 100) {
+ die "$0: open(>$tmppath) failed: $!";
+ }
+ }
$self->writeout(\*FOO);
close(FOO);
+ Time::HiRes::sleep(0.5);
# if we managed that one, we move it over
die ("rename $tmppath to $path failed: $!")
unless rename($tmppath, $path);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment