Follow redirects early to ensure consistency between the manifest and the tarball
Without this change, if the URL is a redirect that changes in between, we can get a manifest that doesn't match the tarball.
This commit is contained in:
parent
ca3d9f8b31
commit
1d0bafb74d
1 changed files with 8 additions and 0 deletions
|
@ -88,6 +88,14 @@ sub update {
|
||||||
my $exprs = "";
|
my $exprs = "";
|
||||||
foreach my $name (keys %channels) {
|
foreach my $name (keys %channels) {
|
||||||
my $url = $channels{$name};
|
my $url = $channels{$name};
|
||||||
|
|
||||||
|
# Check if $url is a redirect. If so, follow it now to ensure
|
||||||
|
# consistency if the redirection is changed between
|
||||||
|
# downloading the manifest and the tarball.
|
||||||
|
my $headers = `$Nix::Config::curl --silent --head '$url'`;
|
||||||
|
die "$0: unable to check `$url'\n" if $? != 0;
|
||||||
|
$headers =~ s/\r//g;
|
||||||
|
$url = $1 if $headers =~ /^Location:\s*(.*)\s*$/m;
|
||||||
|
|
||||||
# Pull the channel manifest.
|
# Pull the channel manifest.
|
||||||
system("$Nix::Config::binDir/nix-pull", "--skip-wrong-store", "$url/MANIFEST") == 0
|
system("$Nix::Config::binDir/nix-pull", "--skip-wrong-store", "$url/MANIFEST") == 0
|
||||||
|
|
Loading…
Reference in a new issue