admin/pin: Enforce that index is a number

Validate that we're parsing a number; we want to guard
against typos.

Closes: https://github.com/ostreedev/ostree/issues/2171
This commit is contained in:
Colin Walters committed 2020-08-19 13:11:55 +00:00
1 parent fa9942c7ad
commit 22a445c189
2 files changed
+16 -2

No files matched your search

+8 -1
View File
@@ -26,7 +26,7 @@ set -euo pipefail
# Exports OSTREE_SYSROOT so --sysroot not needed.
setup_os_repository "archive" "syslinux"
echo "1..7"
echo "1..8"
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
@@ -102,6 +102,13 @@ ${CMD_PREFIX} ostree admin pin -u 0
assert_n_pinned 0
echo "ok pin unpin"
for p in medal 0medal '' 5000 9999999999999999999999999999999999999; do
if ${CMD_PREFIX} ostree admin pin ${p}; then
fatal "created invalid pin ${p}"
fi
done
echo "ok invalid pin"
${CMD_PREFIX} ostree admin pin 0 1
assert_n_pinned 2
assert_n_deployments 2