Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
Nix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nora Puchreiner
Nix
Commits
aec545c2
Commit
aec545c2
authored
5 years ago
by
Eelco Dolstra
Browse files
Options
Downloads
Patches
Plain Diff
Fix segfault in builtin fetchurl with hashed mirrors + SRI hashes
parent
5450af5d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/libstore/builtins/fetchurl.cc
+2
-1
2 additions, 1 deletion
src/libstore/builtins/fetchurl.cc
tests/fetchurl.sh
+4
-0
4 additions, 0 deletions
tests/fetchurl.sh
with
6 additions
and
1 deletion
src/libstore/builtins/fetchurl.cc
+
2
−
1
View file @
aec545c2
...
...
@@ -64,7 +64,8 @@ void builtinFetchurl(const BasicDerivation & drv, const std::string & netrcData)
try
{
if
(
!
hasSuffix
(
hashedMirror
,
"/"
))
hashedMirror
+=
'/'
;
auto
ht
=
parseHashType
(
getAttr
(
"outputHashAlgo"
));
fetch
(
hashedMirror
+
printHashType
(
ht
)
+
"/"
+
Hash
(
getAttr
(
"outputHash"
),
ht
).
to_string
(
Base16
,
false
));
auto
h
=
Hash
(
getAttr
(
"outputHash"
),
ht
);
fetch
(
hashedMirror
+
printHashType
(
h
.
type
)
+
"/"
+
h
.
to_string
(
Base16
,
false
));
return
;
}
catch
(
Error
&
e
)
{
debug
(
e
.
what
());
...
...
This diff is collapsed.
Click to expand it.
tests/fetchurl.sh
+
4
−
0
View file @
aec545c2
...
...
@@ -42,6 +42,10 @@ ln -s $(pwd)/fetchurl.sh $mirror/sha512/$hash32
outPath
=
$(
nix-build
'<nix/fetchurl.nix>'
--argstr
url file:///no-such-dir/fetchurl.sh
--argstr
sha512
$hash
--no-out-link
--hashed-mirrors
"file://
$mirror
"
)
# Test hashed mirrors with an SRI hash.
nix-build
'<nix/fetchurl.nix>'
--argstr
url file:///no-such-dir/fetchurl.sh
--argstr
hash
$(
nix to-sri
--type
sha512
$hash
)
\
--argstr
name bla
--no-out-link
--hashed-mirrors
"file://
$mirror
"
# Test unpacking a NAR.
rm
-rf
$TEST_ROOT
/archive
mkdir
-p
$TEST_ROOT
/archive
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment