From 4da2a2c02c0a86224d0465f10fd24aa625c285e6 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 26 Feb 2010 14:53:33 +0100 Subject: [PATCH] tests: exercise today's HFS partition type fix * tests/t2400-dos-hfs-partition-type.sh: New script. * tests/Makefile.am: Add it. * NEWS (Bug fixes): Mention it. --- NEWS | 4 +++ tests/Makefile.am | 1 + tests/t2400-dos-hfs-partition-type.sh | 48 +++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 tests/t2400-dos-hfs-partition-type.sh diff --git a/NEWS b/NEWS index 53f83ce..c390fcd 100644 --- a/NEWS +++ b/NEWS @@ -19,6 +19,10 @@ GNU parted NEWS -*- outline -*- Parted no longer uses a physical sector size of 0 or of any other value smaller than the logical sector size. + dos: creating an HFS or HFS+ partition in an msdos partition table + used to set the partition type to 0x83. That is wrong. The required + number is 0xaf, and that is what is used now. + gpt: read-only operation could clobber MBR part of hybrid GPT+MBR table [bug introduced in parted-2.1] diff --git a/tests/Makefile.am b/tests/Makefile.am index 8159a32..0cc7279 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -22,6 +22,7 @@ TESTS = \ t2100-mkswap.sh \ t2200-dos-label-recog.sh \ t2300-dos-label-extended-bootcode.sh \ + t2400-dos-hfs-partition-type.sh \ t3000-resize-fs.sh \ t4000-sun-raid-type.sh \ t4001-sun-vtoc.sh \ diff --git a/tests/t2400-dos-hfs-partition-type.sh b/tests/t2400-dos-hfs-partition-type.sh new file mode 100644 index 0000000..1b1ffe6 --- /dev/null +++ b/tests/t2400-dos-hfs-partition-type.sh @@ -0,0 +1,48 @@ +#!/bin/sh +# Ensure that an HFS partition in a dos table gets the right ID + +# Copyright (C) 2010 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 . + +if test "$VERBOSE" = yes; then + set -x + parted --version +fi + +: ${srcdir=.} +. $srcdir/t-lib.sh + +dev=loop-file +ss=$sector_size_ +n_sectors=8000 + +fail=0 + +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 hfs 2048s 4095s \ + mkpart pri hfs+ 4096s 6143s > out 2>&1 || fail=1 +# expect no output +compare out /dev/null || fail=1 + +# Extract the "type" byte of the first partition. +od -An -j450 -tx1 -N1 $dev > out || fail=1 +od -An -j466 -tx1 -N1 $dev >> out || fail=1 +printf ' af\n af\n' > exp || fail=1 +compare out exp || fail=1 + +Exit $fail -- 2.11.0