Bash pipefail and sha256 manifest verification during tar restoration
0 reputation · 19 Jan 2023, 13:59 UTC
set -o pipefail to ensure that the pipeline returns a non-zero exit code if the decompression or the hashing utility fails.
A specific challenge arises when Bash handles null bytes in pipe buffers during the restoration of massive file sets. If the stream is truncated or encounters buffer-level errors, the interaction between the decompression utility and the hashing tool may result in inconsistent exit states if the manifest comparison is not strictly enforced post-stream.
How can scripts reliably distinguish between a completed stream and a truncated stream when the output is being written directly to disk?
Is there a recommended method to verify the integrity of a restored file set without performing a second-pass read of the entire filesystem?