commit:     d5bc17a97c9c2c6fe6026f719e3dc6f73c75b329
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sat Feb  5 21:52:41 2022 +0000
Commit:     David Seifert <soap <AT> gentoo <DOT> org>
CommitDate: Sat Feb  5 21:52:41 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d5bc17a9

sys-block/parted: replace non-portable printf in tests

Closes: https://bugs.gentoo.org/774363
Signed-off-by: David Seifert <soap <AT> gentoo.org>

 .../parted/files/parted-3.4-posix-printf.patch     | 63 ++++++++++++++++++++++
 sys-block/parted/parted-3.4.ebuild                 |  2 +
 2 files changed, 65 insertions(+)

diff --git a/sys-block/parted/files/parted-3.4-posix-printf.patch 
b/sys-block/parted/files/parted-3.4-posix-printf.patch
new file mode 100644
index 000000000000..9aeb37c2cf27
--- /dev/null
+++ b/sys-block/parted/files/parted-3.4-posix-printf.patch
@@ -0,0 +1,63 @@
+From 9665bdd5d6756058bb3b767eacc1c195667bf276 Mon Sep 17 00:00:00 2001
+From: Kerin Millar <k...@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 <k...@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
+

diff --git a/sys-block/parted/parted-3.4.ebuild 
b/sys-block/parted/parted-3.4.ebuild
index 67d60f004ca8..338886d0c62d 100644
--- a/sys-block/parted/parted-3.4.ebuild
+++ b/sys-block/parted/parted-3.4.ebuild
@@ -37,6 +37,8 @@ 
VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/bcl.asc
 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}"/${P}-posix-printf.patch
 )
 
 src_prepare() {

Reply via email to