summaryrefslogtreecommitdiff
path: root/tests/xfs/533
blob: 31858cc9947d2a4cdb6ee2bcfecb9d56112ccbfa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2022 FUJITSU LIMITED. All rights reserved.
#
# FS QA Test 533
#
# Regression test for xfsprogs commit
# f4afdcb0ad11 ("xfs_db: clean up the salvage read callsites in set_cur()")
#
# This case test xfs_db whether can get the new magicnum field value even we
# just have corrupted this field value.
#

. ./common/preamble
_begin_fstest auto quick db

# real QA test starts here
_supported_fs xfs
_fixed_by_git_commit xfsprogs f4afdcb0ad11 \
	"xfs_db: clean up the salvage read callsites in set_cur()"
#skip fs check because invalid superblock 1
_require_scratch_nocheck

# The error messages in the golden output come from the V5 superblock verifier
# routines, so ignore V4 filesystems.
_require_scratch_xfs_crc

_scratch_mkfs_xfs >>$seqres.full 2>&1

# write the bad magicnum field value(0) to the superblock 1
_scratch_xfs_set_metadata_field "magicnum" "0" "sb 1"

# Even magicnum field has been corrupted, we still can read this field value.
# The error message changed in xfsprogs 5.19.
_scratch_xfs_get_metadata_field "magicnum" "sb 1" 2>&1 | \
	sed -e 's/Superblock has bad magic number 0x0. Not an XFS filesystem?/bad magic number/g'

# success, all done
status=0
exit