Skip to content

Commit becf1f2

Browse files
committed
Atomically update channels/.htaccess
Otherwise we might clobber the redirects if the disk is full, and in any case there is a time window in which .htaccess is in an inconsistent state. Fixes NixOS/nixpkgs#18544.
1 parent 8a0ed20 commit becf1f2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

mirror-nixos-branch.pl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@ sub fetch {
168168
symlink($releaseDir, "$channelLink.tmp") or die;
169169
rename("$channelLink.tmp", $channelLink) or die;
170170

171-
system("cat $channelsDir/.htaccess-nix* > $channelsDir/.htaccess") == 0 or die;
171+
system("cat $channelsDir/.htaccess-nix* > $channelsDir/.htaccess.tmp") == 0 or die;
172+
rename("$channelsDir/.htaccess.tmp", "$channelsDir/.htaccess") or die;
172173

173174
# Update the nixpkgs-channels repo.
174175
system("git remote update origin >&2") == 0 or die;

0 commit comments

Comments
 (0)