Question 160
A controlled command-line practice exercise reports: An operator attempts to decompress an .xz backup using bunzip2 because both tools reduce file size, producing an invalid compressed-data error. Which preventive control should be standardized to avoid recurrence?
Explanation
Correct Answer
This safeguard addresses bzip2 versus xz decompression format selection: Check file extensions and actual formats when receiving compressed artifacts from users or automated jobs. The prevented failure mechanism is: Bzip2 and xz use different compression formats; similar purposes do not make their bitstreams interchangeable. A control for an unrelated service cannot establish the required protection.
Incorrect Answers
Direct execution requires suitable executable permission on a regular file, while explicitly invoking Bash only needs permission to read its contents. “Use the minimum necessary execute permissions and verify ownership before marking scripts executable for multiple users” would remedy that alternative situation, but it would not correct the present issue: bzip2 and xz use different compression formats; similar purposes do not make their bitstreams interchangeable.
“Check archive membership after creation and keep the source files until a restoration test confirms the intended contents” is the supported response when the tar utility combines multiple files and directory entries into an archive, while a compressor such as gzip commonly processes individual streams or files. Here the decisive response is “Check file extensions and actual formats when receiving compressed artifacts from users or automated jobs”, so that different intervention does not meet the stated requirement.
Tar extraction restores archived pathname entries relative to a chosen destination, so the current working directory and archive paths affect where files appear. “List archive contents and use a disposable extraction directory when handling unfamiliar tar files or backups” applies to that other condition. The reported evidence is an operator attempts to decompress an .xz backup using bunzip2 because both tools reduce file size, producing an invalid compressed-data error; this alternative would address the wrong dependency.