From e8ee761ead7cd93e0bac33885a3a0dd2beeefe52 Mon Sep 17 00:00:00 2001 From: Andrus Suvalau Date: Mon, 12 Jan 2026 11:58:57 +0100 Subject: [PATCH 1/3] Add iflag=fullblock to dd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit rust-coreutils’ dd implementation tends to perform partial writes, which leads to partial reads and data loss as a result. Strictly speaking, without the fullblock option there is no guarantee that full blocks will be read. Even with GNU dd, partial reads and writes can occur, although they hardly ever happen. --- makeself-header.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/makeself-header.sh b/makeself-header.sh index 2e037a6..4070b0e 100755 --- a/makeself-header.sh +++ b/makeself-header.sh @@ -105,10 +105,10 @@ MS_dd() { blocks=\`expr \$3 / 1024\` bytes=\`expr \$3 % 1024\` - # Test for ibs, obs and conv feature - if dd if=/dev/zero of=/dev/null count=1 ibs=512 obs=512 conv=sync 2> /dev/null; then + # Test for ibs, obs, fullblock and conv feature + if dd if=/dev/zero of=/dev/null count=1 ibs=512 obs=512 iflag=fullblock conv=sync 2> /dev/null; then dd if="\$1" ibs=\$2 skip=1 obs=1024 conv=sync 2> /dev/null | \\ - { test \$blocks -gt 0 && dd ibs=1024 obs=1024 count=\$blocks ; \\ + { test \$blocks -gt 0 && dd ibs=1024 iflag=fullblock obs=1024 count=\$blocks ; \\ test \$bytes -gt 0 && dd ibs=1 obs=1024 count=\$bytes ; } 2> /dev/null else dd if="\$1" bs=\$2 skip=1 2> /dev/null From bdc0e9c3731409018d44b07d6fc5eba834f8f5f4 Mon Sep 17 00:00:00 2001 From: Andrus Suvalau Date: Mon, 12 Jan 2026 16:05:56 +0100 Subject: [PATCH 2/3] Add check for iflag=fullblock --- makeself-header.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/makeself-header.sh b/makeself-header.sh index 4070b0e..4662563 100755 --- a/makeself-header.sh +++ b/makeself-header.sh @@ -105,10 +105,14 @@ MS_dd() { blocks=\`expr \$3 / 1024\` bytes=\`expr \$3 % 1024\` - # Test for ibs, obs, fullblock and conv feature - if dd if=/dev/zero of=/dev/null count=1 ibs=512 obs=512 iflag=fullblock conv=sync 2> /dev/null; then + # Test for ibs, obs and conv feature + if dd if=/dev/zero of=/dev/null count=1 ibs=512 obs=512 conv=sync 2> /dev/null; then + # Test for fullblock feature + if dd if=/dev/zero of=/dev/null count=1 iflag=fullblock 2> /dev/null; then + iflag="iflag=fullblock" + fi dd if="\$1" ibs=\$2 skip=1 obs=1024 conv=sync 2> /dev/null | \\ - { test \$blocks -gt 0 && dd ibs=1024 iflag=fullblock obs=1024 count=\$blocks ; \\ + { test \$blocks -gt 0 && dd ibs=1024 obs=1024 count=\$blocks \$iflag ; \\ test \$bytes -gt 0 && dd ibs=1 obs=1024 count=\$bytes ; } 2> /dev/null else dd if="\$1" bs=\$2 skip=1 2> /dev/null From 086f615bf9da35e7fcfdc5d5b7df24702bd2ce33 Mon Sep 17 00:00:00 2001 From: Andrus Suvalau Date: Tue, 13 Jan 2026 11:06:02 +0100 Subject: [PATCH 3/3] Initialize the iflag variable with an empty string --- makeself-header.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/makeself-header.sh b/makeself-header.sh index a416406..0b50d91 100755 --- a/makeself-header.sh +++ b/makeself-header.sh @@ -107,6 +107,7 @@ MS_dd() bytes=\`expr \$3 % 1024\` # Test for ibs, obs and conv feature if dd if=/dev/zero of=/dev/null count=1 ibs=512 obs=512 conv=sync 2> /dev/null; then + iflag="" # Test for fullblock feature if dd if=/dev/zero of=/dev/null count=1 iflag=fullblock 2> /dev/null; then iflag="iflag=fullblock"