summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2023-06-16 03:56:01 +0100
committerSam James <sam@gentoo.org>2023-06-16 03:56:01 +0100
commit8489bdccc712eb390d43de5f3b0918bb839e8361 (patch)
tree666b698768abdbf0b9c26dde4060223abc9e84bc /sys-block
parentsys-libs/minizip-ng: drop 3.0.8, 3.0.9 (diff)
downloadgentoo-8489bdccc712eb390d43de5f3b0918bb839e8361.tar.gz
gentoo-8489bdccc712eb390d43de5f3b0918bb839e8361.tar.bz2
gentoo-8489bdccc712eb390d43de5f3b0918bb839e8361.zip
sys-block/parted: fix test portability issues
Closes: https://bugs.gentoo.org/753677 Closes: https://bugs.gentoo.org/890869 Thanks-to: Kerin Millar <kfm@plushkava.net> Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'sys-block')
-rw-r--r--sys-block/parted/files/parted-3.6-tests-non-bash.patch86
-rw-r--r--sys-block/parted/files/parted-3.6-tests-unicode.patch59
-rw-r--r--sys-block/parted/parted-3.6.ebuild6
3 files changed, 150 insertions, 1 deletions
diff --git a/sys-block/parted/files/parted-3.6-tests-non-bash.patch b/sys-block/parted/files/parted-3.6-tests-non-bash.patch
new file mode 100644
index 000000000000..02c44f68998a
--- /dev/null
+++ b/sys-block/parted/files/parted-3.6-tests-non-bash.patch
@@ -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
diff --git a/sys-block/parted/files/parted-3.6-tests-unicode.patch b/sys-block/parted/files/parted-3.6-tests-unicode.patch
new file mode 100644
index 000000000000..316c184f460d
--- /dev/null
+++ b/sys-block/parted/files/parted-3.6-tests-unicode.patch
@@ -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
diff --git a/sys-block/parted/parted-3.6.ebuild b/sys-block/parted/parted-3.6.ebuild
index a6fac85ad7db..e70d45603592 100644
--- a/sys-block/parted/parted-3.6.ebuild
+++ b/sys-block/parted/parted-3.6.ebuild
@@ -45,6 +45,10 @@ PATCHES=(
"${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
@@ -52,7 +56,7 @@ QA_CONFIG_IMPL_DECL_SKIP="MIN"
src_prepare() {
default
- eautoconf
+ eautoreconf
touch doc/pt_BR/Makefile.in || die
}