summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPali Rohár <pali.rohar@gmail.com>2018-08-28 21:20:01 +0200
committerBrian C. Lane <bcl@redhat.com>2018-10-16 11:52:08 -0700
commit8740cfcff3ea839dd6dc8650dec0a466e9870625 (patch)
treeb47e10d16551d7a2f66beeebe3d6856eebbfed9f /tests
parenta52926f6d3cd2520419c60d4f81a410d33d6d970 (diff)
downloadparted-8740cfcff3ea839dd6dc8650dec0a466e9870625.tar.gz
libparted: Add support for MBR id, GPT GUID and detection of UDF filesystem
This is needed for libparted based applications (like Gparted) to correctly choose MBR id and GPT GUID for UDF filesystem. MBR id for UDF is 0x07 and GPT GUID is Microsoft Basic Data, see why: https://serverfault.com/a/829172 Without registering a new libparted fs code it is not possible to assign MBR id or GPT GUID. Detection of UDF filesystem is done by checking presence of UDF VSD (NSR02 or NSR03 identifier) and UDF AVDP at expected locations (blocks 256, -257, -1, 512). Signed-off-by: Brian C. Lane <bcl@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am1
-rw-r--r--tests/t2410-dos-udf-partition-type.sh38
2 files changed, 39 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3851983..3fa75a9 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -51,6 +51,7 @@ TESTS = \
t2310-dos-extended-2-sector-min-offset.sh \
t2320-dos-extended-noclobber.sh \
t2400-dos-hfs-partition-type.sh \
+ t2410-dos-udf-partition-type.sh \
t2500-probe-corrupt-hfs.sh \
t3000-resize-fs.sh \
t3200-resize-partition.sh \
diff --git a/tests/t2410-dos-udf-partition-type.sh b/tests/t2410-dos-udf-partition-type.sh
new file mode 100644
index 0000000..7cc8a02
--- /dev/null
+++ b/tests/t2410-dos-udf-partition-type.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+# Ensure that an UDF partition in a dos table gets the right ID
+
+# Copyright (C) 2018 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+dev=loop-file
+ss=$sector_size_
+n_sectors=8000
+
+dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || framework_failure
+
+# create a GPT partition table
+parted -s $dev mklabel msdos \
+ mkpart pri udf 2048s 4095s > out 2>&1 || fail=1
+# expect no output
+compare /dev/null out || fail=1
+
+# Extract the "type" byte of the first partition.
+od -An -j450 -tx1 -N1 $dev > out || fail=1
+printf ' 07\n' > exp || fail=1
+compare exp out || fail=1
+
+Exit $fail