sys-block/parted: Sync with Gentoo

It's from Gentoo commit 8489bdccc712eb390d43de5f3b0918bb839e8361.
This commit is contained in:
Krzesimir Nowak 2023-07-28 12:53:52 +02:00
parent e017b74aec
commit f2a8dbd692
6 changed files with 261 additions and 36 deletions

View File

@ -1,2 +1,2 @@
DIST parted-3.4.tar.xz 1860300 BLAKE2B c724d3d1490c62d440b9e5dc359fef7ff623bc77ae5f867d8905245cb279ec391fa07a1a774488ad3bf7a2c477007264d7bab2635a544be8f94dc706a654a711 SHA512 e69bd1b610778e980d4595d04892f2ea1faf4ae9bfc98cd62abfc70066423f08ddaa396f9461c7beb1330d023232274606b6b26091a0458aeedd0f3f57536690
DIST parted-3.4.tar.xz.sig 508 BLAKE2B 112ad0158b1100bd9150a7c87e8f93e67d42870b82a17d4d0aa8bb5e46306f837f3f99feabaf301f8cd640c299174e5f5acf152dd1f20ea2b7ace73d57d31f14 SHA512 6b11812267e66470ba2908ee1cc78b232b0bc2519787f5a17b92cd5f8ba904b1a836833f19c5244b23d4c7810437eeb26fbbd68fac819391b342709682345472
DIST parted-3.6.tar.xz 1896164 BLAKE2B 99b6d096e4db05144c98e9f0a9a97c647aa911ee5df031244b03d5223f709d43d9302cef12dd4b2f97f42ec476510561b7f8b3b1ef7cb09d0a7c4d512e7a6739 SHA512 034a44b25718acba175212019d24f092972a791c5bd1d921ae91e17478657a77c5c5dd0c832bed7968c3a07ec6c65c0785acfac2f90c1ca5e1692f3c141693ef
DIST parted-3.6.tar.xz.sig 508 BLAKE2B 92fbf624cfeb474e36d43954ecf6c42cf86557b99c7cd477c648bdeefb3ca2b40c51c320b20ea91075276d9ccc1da4219cd843b2916157c564c92a34a35ec55f SHA512 7c845026937b29fb49085ef9e3354226b73a1c3b5f9082d440d9a8ac13d76b1d07dae0bc10d8c974d4e57bc582f38c0a908e80718dd1ff1adfad3b04699c672c

View File

@ -0,0 +1,63 @@
From 9665bdd5d6756058bb3b767eacc1c195667bf276 Mon Sep 17 00:00:00 2001
From: Kerin Millar <kfm@plushkava.net>
Date: Sat, 5 Feb 2022 03:29:34 +0000
Subject: [PATCH] tests: have printf(1) use octal numbers for POSIX conformance
Per https://pubs.opengroup.org/onlinepubs/9699919799/utilities/printf.html,
backslash-escape sequences incorporating hexadecimal numbers are non-standard.
Signed-off-by: Kerin Millar <kfm@plushkava.net>
---
tests/t0205-gpt-list-clobbers-pmbr.sh | 4 ++--
tests/t0206-gpt-print-with-corrupt-primary-clobbers-pmbr.sh | 4 ++--
tests/t2500-probe-corrupt-hfs.sh | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/tests/t0205-gpt-list-clobbers-pmbr.sh b/tests/t0205-gpt-list-clobbers-pmbr.sh
index 52f60cc..b1664fb 100644
--- a/tests/t0205-gpt-list-clobbers-pmbr.sh
+++ b/tests/t0205-gpt-list-clobbers-pmbr.sh
@@ -36,8 +36,8 @@ parted -m -s $dev u s p || fail=1
# Write non-NUL bytes all over the MBR, so we're likely to see any change.
# However, be careful to leave the type of the first partition, 0xEE,
-# as well as the final two magic bytes.
-printf '%0450d\xee%059d\x55\xaa' 0 0 | dd of=$dev count=1 conv=notrunc || fail=1
+# as well as the final two magic bytes, 0x55 0xAA.
+printf '%0450d\356%059d\125\252' 0 0 | dd of=$dev count=1 conv=notrunc || fail=1
dd if=$dev of=before count=1 || fail=1
diff --git a/tests/t0206-gpt-print-with-corrupt-primary-clobbers-pmbr.sh b/tests/t0206-gpt-print-with-corrupt-primary-clobbers-pmbr.sh
index 83c2a9c..8f2a4ef 100755
--- a/tests/t0206-gpt-print-with-corrupt-primary-clobbers-pmbr.sh
+++ b/tests/t0206-gpt-print-with-corrupt-primary-clobbers-pmbr.sh
@@ -32,8 +32,8 @@ parted -m -s $dev u s p || fail=1
# Write non-NUL bytes all over the MBR, so we're likely to see any change.
# However, be careful to leave the type of the first partition, 0xEE,
-# as well as the final two magic bytes.
-printf '%0450d\xee%059d\x55\xaa' 0 0 | dd of=$dev count=1 conv=notrunc || fail=1
+# as well as the final two magic bytes, 0x55 0xAA.
+printf '%0450d\356%059d\125\252' 0 0 | dd of=$dev count=1 conv=notrunc || fail=1
dd if=$dev of=before count=1 || fail=1
diff --git a/tests/t2500-probe-corrupt-hfs.sh b/tests/t2500-probe-corrupt-hfs.sh
index 3b4ade8..32ddcfc 100755
--- a/tests/t2500-probe-corrupt-hfs.sh
+++ b/tests/t2500-probe-corrupt-hfs.sh
@@ -29,8 +29,8 @@ compare /dev/null out || fail=1
parted -s "$dev" u s p || fail=1
-# Poke an HFS+ signature into place
-printf '\x48\x2b' | dd of=$dev seek=$((2048+2)) conv=notrunc || fail=1
+# Poke an HFS+ signature into place (0x48 0x2B)
+printf '\110\053' | dd of=$dev seek=$((2048+2)) conv=notrunc || fail=1
# Or, if starting from a valid HFS/HFS+ file system, poke these:
# offset 18 total_blocks=0(16b)
--
2.35.1

View File

@ -0,0 +1,86 @@
https://debbugs.gnu.org/61128
From c7b5c04083b8fc21c3e0d044375631d559e122e3 Mon Sep 17 00:00:00 2001
From: Kerin Millar <kfm@plushkava.net>
Date: Wed, 25 Jan 2023 15:26:46 +0000
Subject: [PATCH] Use complementation correctly in shell globs
Negation should be performed by using the <exclamation-mark> character.
Attempting to use the <circumflex> shall result in undefined behaviour.
Dash used to tolerate this violation of the spec but the following
commit put a stop to it.
https://git.kernel.org/pub/scm/utils/dash/dash.git/commit/?id=8f9cca0
Signed-off-by: Kerin Millar <kfm@plushkava.net>
Link: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_13
Bug: https://bugs.gentoo.org/890869
--- a/m4/o-direct.m4
+++ b/m4/o-direct.m4
@@ -47,14 +47,14 @@ frobnozzle
/dev/shm) ;;
/*) case $pe_dir in
# Accept $HOME or $TMP only if the value is nice and boring.
- *[^/a-zA-Z0-9_.-]*) ;;
+ *[!/a-zA-Z0-9_.-]*) ;;
*) pe_cand_dirs="$pe_cand_dirs $pe_dir";;
esac
esac
done
case $PARTED_TMPDIR in
- *[^/a-zA-Z0-9_.-]*) ;;
+ *[!/a-zA-Z0-9_.-]*) ;;
*) pe_cand_dirs="$PARTED_TMPDIR $pe_cand_dirs";;
esac
--- a/tests/t-local.sh
+++ b/tests/t-local.sh
@@ -138,7 +138,7 @@ require_512_byte_sector_size_()
peek_()
{
case $# in 2) ;; *) echo "usage: peek_ FILE 0_BASED_OFFSET" >&2; exit 1;; esac
- case $2 in *[^0-9]*) echo "peek_: invalid offset: $2" >&2; exit 1 ;; esac
+ case $2 in *[!0-9]*) echo "peek_: invalid offset: $2" >&2; exit 1 ;; esac
dd if="$1" bs=1 skip="$2" count=1
}
@@ -146,7 +146,7 @@ poke_()
{
case $# in 3) ;; *) echo "usage: poke_ FILE 0_BASED_OFFSET BYTE" >&2; exit 1;;
esac
- case $2 in *[^0-9]*) echo "poke_: invalid offset: $2" >&2; exit 1 ;; esac
+ case $2 in *[!0-9]*) echo "poke_: invalid offset: $2" >&2; exit 1 ;; esac
case $3 in ?) ;; *) echo "poke_: invalid byte: '$3'" >&2; exit 1 ;; esac
printf %s "$3" | dd of="$1" bs=1 seek="$2" count=1 conv=notrunc
}
@@ -155,7 +155,7 @@ poke_()
gpt1_pte_name_offset_()
{
local ss=$1
- case $ss in *[^0-9]*) echo "$0: invalid sector size: $ss">&2; return 1;; esac
+ case $ss in *[!0-9]*) echo "$0: invalid sector size: $ss">&2; return 1;; esac
expr $ss \* 2 + 56
return 0
}
@@ -167,7 +167,7 @@ gpt_corrupt_primary_table_()
case $# in 2) ;; *) echo "$0: expected 2 args, got $#" >&2; return 1;; esac
local dev=$1
local ss=$2
- case $ss in *[^0-9]*) echo "$0: invalid sector size: $ss">&2; return 1;; esac
+ case $ss in *[!0-9]*) echo "$0: invalid sector size: $ss">&2; return 1;; esac
# get the first byte of the name
local orig_pte_name_byte
@@ -188,7 +188,7 @@ gpt_restore_primary_table_()
case $# in 3) ;; *) echo "$0: expected 2 args, got $#" >&2; return 1;; esac
local dev=$1
local ss=$2
- case $ss in *[^0-9]*) echo "$0: invalid sector size: $ss">&2; return 1;; esac
+ case $ss in *[!0-9]*) echo "$0: invalid sector size: $ss">&2; return 1;; esac
local orig_byte=$3
poke_ $dev $(gpt1_pte_name_offset_ $ss) "$orig_byte" || return 1
}
--
2.39.1

View File

@ -0,0 +1,59 @@
https://debbugs.gnu.org/61129
From af8ed66e00bfac4a189ea32c62199bffaa3eb836 Mon Sep 17 00:00:00 2001
From: Kerin Millar <kfm@plushkava.net>
Date: Sun, 29 Jan 2023 00:34:27 +0000
Subject: [PATCH] Use any available UTF-8 locale in t0251; skip if none found
The "t0251-gpt-unicode.sh" test presently suffers from several issues
which are addressed herewith.
Do not begin by trying to match the "en_US.utf8" locale specifically.
The only requirement for the test to be conducted correctly is that the
system character type be set to UTF-8. For this, _any_ UTF-8 supporting
locale will do. Simply select the first locale that ends with ".utf8"
or "UTF-8". After all, not everyone is American, nor do all systems
using GNU glibc yet have a C.UTF-8 locale.
Escape the dot/period in the locale-matching regular expression.
Skip the test outright if no UTF-8 supporting locale can be found,
rather than spuriously fail.
Assign the locale found to LC_CTYPE. There is no need to set any of the
other locale-related environment variables for the purpose of this
test. To guarantee that LC_CTYPE takes effect, unset LC_ALL also.
Signed-off-by: Kerin Millar <kfm@plushkava.net>
Bug: https://bugs.gentoo.org/753677
--- a/tests/t0251-gpt-unicode.sh
+++ b/tests/t0251-gpt-unicode.sh
@@ -17,16 +17,21 @@
. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+# LC_CTYPE must not be overridden
+unset LC_ALL
+
+# any UTF-8 locale will suffice for setting the character type
+LC_CTYPE=$(locale -a | awk '/\.(utf8|UTF-8)$/ { print; exit; }')
+if [ -z "$LC_CTYPE" ]; then
+ skip_ 'no UTF-8 supporting locale is available'
+fi
+export LC_CTYPE
+
dev=loop-file
# create zeroed device
truncate -s 10m $dev || fail=1
-LC_ALL=$(locale -a | grep en_US.utf8)
-if [ -z "$LC_ALL" ]; then
- LC_ALL=C.UTF-8
-fi
-export LC_ALL="$LC_ALL"
# create gpt label with named partition
part_name=$(printf 'foo\341\264\244')
parted -s $dev mklabel gpt mkpart primary ext2 1MiB 2MiB name 1 $part_name > empty 2>&1 || fail=1
--
2.39.1

View File

@ -23,4 +23,7 @@
it. Also, it means we get more bug reports ;)
</flag>
</use>
<upstream>
<remote-id type="savannah">parted</remote-id>
</upstream>
</pkgmetadata>

View File

@ -1,18 +1,22 @@
# Copyright 1999-2022 Gentoo Authors
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit verify-sig
VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/bcl.asc
inherit autotools verify-sig
DESCRIPTION="Create, destroy, resize, check, copy partitions and file systems"
HOMEPAGE="https://www.gnu.org/software/parted/"
SRC_URI="mirror://gnu/${PN}/${P}.tar.xz
verify-sig? ( mirror://gnu/${PN}/${P}.tar.xz.sig )"
SRC_URI="
mirror://gnu/${PN}/${P}.tar.xz
verify-sig? ( mirror://gnu/${PN}/${P}.tar.xz.sig )
"
LICENSE="GPL-3"
LICENSE="GPL-3+"
SLOT="0"
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~mips ppc ppc64 ~riscv ~s390 sparc x86"
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~mips ppc ppc64 ~riscv ~s390 sparc x86"
IUSE="+debug device-mapper nls readline"
# util-linux for libuuid
@ -28,19 +32,32 @@ RDEPEND="
DEPEND="${RDEPEND}"
BDEPEND="
nls? ( >=sys-devel/gettext-0.12.1-r2 )
verify-sig? ( sec-keys/openpgp-keys-bcl )
verify-sig? ( >=sec-keys/openpgp-keys-bcl-20230315 )
virtual/pkgconfig
"
VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/bcl.asc
DOCS=(
AUTHORS BUGS ChangeLog NEWS README THANKS TODO doc/{API,FAT,USER.jp}
)
PATCHES=(
"${FILESDIR}"/${PN}-3.2-po4a-mandir.patch
"${FILESDIR}"/${PN}-3.3-atari.patch
# https://lists.gnu.org/archive/html/bug-parted/2022-02/msg00000.html
"${FILESDIR}"/${PN}-3.4-posix-printf.patch
# https://debbugs.gnu.org/61129
"${FILESDIR}"/${PN}-3.6-tests-unicode.patch
# https://debbugs.gnu.org/61128
"${FILESDIR}"/${PN}-3.6-tests-non-bash.patch
)
# false positive
QA_CONFIG_IMPL_DECL_SKIP="MIN"
src_prepare() {
default
eautoreconf
touch doc/pt_BR/Makefile.in || die
}
@ -56,11 +73,8 @@ src_configure() {
econf "${myconf[@]}"
}
DOCS=(
AUTHORS BUGS ChangeLog NEWS README THANKS TODO doc/{API,FAT,USER.jp}
)
src_install() {
default
find "${ED}" -type f -name '*.la' -delete || die
}