From 365de86eaddf6734c92db361f2fad26b1dc58359 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 16 Jul 2014 23:20:58 +0200 Subject: [PATCH] Fix hydra-update-gc-roots --- src/script/hydra-update-gc-roots | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/script/hydra-update-gc-roots b/src/script/hydra-update-gc-roots index 4ea91444..021e1f6d 100755 --- a/src/script/hydra-update-gc-roots +++ b/src/script/hydra-update-gc-roots @@ -130,7 +130,10 @@ foreach my $link (@roots) { # Don't delete roots that are less than a day old, to prevent # a race where hydra-eval-jobs has added a root but # hydra-evaluator hasn't added them to the database yet. - if (lstat($path)->ctime < $now - 24 * 60 * 60) { + my $st = lstat("$gcRootsDir/$link"); + if (!defined $st) { + print STDERR "skipping link $link: $!\n"; + } elsif ($st->ctime < $now - 24 * 60 * 60) { print STDERR "removing root $path\n"; $rootsDeleted++; unlink "$gcRootsDir/$link" or warn "cannot remove $gcRootsDir/$link";