2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2022 FUJITSU LIMITED. All rights reserved.
7 # Regression test for xfsprogs commit
8 # f4afdcb0ad11 ("xfs_db: clean up the salvage read callsites in set_cur()")
10 # This case test xfs_db whether can get the new magicnum field value even we
11 # just have corrupted this field value.
15 _begin_fstest auto quick db
17 # real QA test starts here
19 _fixed_by_git_commit xfsprogs f4afdcb0ad11 \
20 "xfs_db: clean up the salvage read callsites in set_cur()"
21 #skip fs check because invalid superblock 1
22 _require_scratch_nocheck
24 # The error messages in the golden output come from the V5 superblock verifier
25 # routines, so ignore V4 filesystems.
26 _require_scratch_xfs_crc
28 _scratch_mkfs_xfs >>$seqres.full 2>&1
30 # write the bad magicnum field value(0) to the superblock 1
31 _scratch_xfs_set_metadata_field "magicnum" "0" "sb 1"
33 # Even magicnum field has been corrupted, we still can read this field value.
34 # The error message changed in xfsprogs 5.19.
35 _scratch_xfs_get_metadata_field "magicnum" "sb 1" 2>&1 | \
36 sed -e 's/Superblock has bad magic number 0x0. Not an XFS filesystem?/bad magic number/g'