fsck: Add --all to print all corrupted object

Stopping on the first error is nice if you just want to know if everything is ok, but
if you want to figure out all that is wrong its nice to be able to continue and
print all corruptions.

Closes: #1591
Approved by: cgwalters
This commit is contained in:
Alexander Larsson authored and Atomic Bot committed 2018-05-24 21:00:52 +00:00
1 parent ef86abe228
commit 5f82503a01
2 files changed
+31 -1

No files matched your search

+24 -1
View File
@@ -21,7 +21,7 @@
set -euo pipefail
echo "1..8"
echo "1..9"
. $(dirname $0)/libtest.sh
@@ -118,6 +118,7 @@ rev=$($OSTREE rev-parse test2)
filechecksum=$(ostree_file_path_to_checksum repo test2 /firstfile)
echo corrupted >> repo/$(ostree_checksum_to_relative_object_path repo $filechecksum)
unset filechecksum
assert_not_has_file repo/state/${rev}.commitpartial
@@ -129,3 +130,25 @@ assert_file_has_content_literal err.txt "Marking commit as partial: $rev"
assert_has_file repo/state/${rev}.commitpartial
echo "ok corrupt file"
cd ${test_tmpdir}
rm repo files -rf
setup_test_repository "bare"
rev=$($OSTREE rev-parse test2)
firstfilechecksum=$(ostree_file_path_to_checksum repo test2 /firstfile)
echo corrupted >> repo/$(ostree_checksum_to_relative_object_path repo $firstfilechecksum)
secondfilechecksum=$(ostree_file_path_to_checksum repo test2 /baz/cow)
echo corrupted >> repo/$(ostree_checksum_to_relative_object_path repo $secondfilechecksum)
assert_not_has_file repo/state/${rev}.commitpartial
if $OSTREE fsck -a --delete 2>err.txt; then
assert_not_reached "fsck unexpectedly succeeded"
fi
assert_file_has_content err.txt "Corrupted file object.*${firstfilechecksum}"
assert_file_has_content err.txt "Corrupted file object.*${secondfilechecksum}"
assert_file_has_content_literal err.txt "Marking commit as partial: $rev"
assert_has_file repo/state/${rev}.commitpartial
echo "ok fsck --all"