Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
ruby-build
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ruby-build
Commits
af49837c
Commit
af49837c
authored
Jan 18, 2016
by
Jason Karns
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Helpful error msg for unexpected checksum length
parent
8738d193
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
6 deletions
+21
-6
bin/ruby-build
+8
-6
test/checksum.bats
+13
-0
No files found.
bin/ruby-build
View file @
af49837c
...
...
@@ -265,14 +265,16 @@ verify_checksum() {
[
-e
"
$filename
"
]
||
return
0
case
"
${#
expected_checksum
}
"
in
# If expected checksum is empty, return success
0
)
return
0
;;
# MD5
0
)
return
0
;;
# empty checksum; return success
32
)
checksum_command
=
"compute_md5"
;;
# SHA2 256
64
)
checksum_command
=
"compute_sha2"
;;
# unknown checksum algorithm, return failure
*
)
return
1
;;
*
)
{
echo
echo
"unexpected checksum length:
${#
expected_checksum
}
(
${
expected_checksum
}
)"
echo
"expected 0 (no checksum), 32 (MD5), or 64 (SHA2-256)"
echo
}
>
&4
return
1
;;
esac
# If chosen provided checksum algorithm isn't supported, return success
...
...
test/checksum.bats
View file @
af49837c
...
...
@@ -141,3 +141,16 @@ DEF
unstub shasum
}
@test "package URL with checksum of unexpected length" {
stub curl "-q -o * -*S* http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$3"
run_inline_definition <<DEF
install_package "package-1.0.0" "http://example.com/packages/package-1.0.0.tar.gz#checksum_of_unexpected_length" copy
DEF
assert_failure
[ ! -f "${INSTALL_ROOT}/bin/package" ]
assert_output_contains "unexpected checksum length: 29 (checksum_of_unexpected_length)"
assert_output_contains "expected 0 (no checksum), 32 (MD5), or 64 (SHA2-256)"
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment