Bruno Haible via GNU coreutils General Discussion <[email protected]>
writes:
> When I disable this test, "make check" completes, and there are
> 9 test failures:
>
> FAIL: tests/factor/factor-parallel.sh
> FAIL: tests/nice/nice.sh
> FAIL: tests/tail/tail-c.sh
> FAIL: tests/cp/parent-perm-race.sh
> FAIL: tests/cp/sparse-to-pipe.sh
> FAIL: tests/cp/special-f.sh
> FAIL: tests/dd/bytes.sh
> FAIL: tests/mv/backup-dir.sh
> FAIL: tests/mv/trailing-slash.sh
>
> Here is the relevant part of the log file.
Thanks. This patch fixes tests/dd/bytes.sh. The issue can be seen in
GDB. The 'opts' variable is what we pass to open ():
File creation flags on GNU/Hurd:
(gdb) print /x opts
$1 = 0x30
print /x O_SEEK_BYTES
$2 = 0x20
On GNU/Hurd this is equivalent to (O_EXCL | O_CREAT). Where 0x20 is
O_EXCL and 0x10 is O_CREAT.
This causes the following on GNU/Hurd:
$ dd seek=8 oflag=seek_bytes bs=5 of=out2 count=0 status=none
$ dd seek=8 oflag=seek_bytes bs=5 of=out2 count=0 status=none
dd: failed to open 'out2': File exists
However, on GNU/Linux we get the expected behavior, i.e. no error:
$ dd seek=8 oflag=seek_bytes bs=5 of=out2 count=0 status=none
$ dd seek=8 oflag=seek_bytes bs=5 of=out2 count=0 status=none
I pushed this patch to fix it. I added a news entry referencing
Coreutils 8.16 since that was when count_bytes, and the bug would have
existed then. However, before that release it is possible there was a
similar bug.
Collin
>From 2662ddf335c9c5bafefa9c8c0b25c26e73d192ab Mon Sep 17 00:00:00 2001
Message-ID: <2662ddf335c9c5bafefa9c8c0b25c26e73d192ab.1758265313.git.collin.fu...@gmail.com>
From: Collin Funk <[email protected]>
Date: Thu, 18 Sep 2025 23:29:02 -0700
Subject: [PATCH] dd: don't mistakenly use O_EXCL on GNU/Hurd
* src/dd.c (v): Add the O_EXCL flag to the set of bits that we do not
want to use for our definitions.
* cfg.mk (sc_dd_O_FLAGS): Adjust to pass syntax-check.
* NEWS: Mention the fix.
Reported by Bruno Haible.
---
NEWS | 4 ++++
cfg.mk | 3 ++-
src/dd.c | 1 +
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/NEWS b/NEWS
index 4c979607b..d618a0bdd 100644
--- a/NEWS
+++ b/NEWS
@@ -38,6 +38,10 @@ GNU coreutils NEWS -*- outline -*-
precedence. Previously multiple specifications would induce an error.
[bug introduced in coreutils-5.90]
+ 'dd oflag=seek_bytes' no longer mistakenly reports errors when the
+ output file exists on GNU/Hurd.
+ [bug introduced in coreutils-8.16]
+
'fold' no longer exhausts memory when processing large inputs
with a very large --width argument.
[This bug was present in "the beginning".]
diff --git a/cfg.mk b/cfg.mk
index 0abb5c226..8e8cae2e6 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -68,7 +68,8 @@ sc_dd_O_FLAGS:
@rm -f [email protected] [email protected]
@{ echo O_FULLBLOCK; echo O_NOCACHE; \
perl -nle '/^ +\| (O_\w*)$$/ and print $$1' $(dd); } | sort > [email protected]
- @{ echo O_NOFOLLOW; perl -nle '/{"[a-z]+",\s*(O_\w+)},/ and print $$1' \
+ @{ echo O_NOFOLLOW; echo O_EXCL; \
+ perl -nle '/{"[a-z]+",\s*(O_\w+)},/ and print $$1' \
$(dd); } | sort > [email protected]
@diff -u [email protected] [email protected]; diff=$$?; \
rm -f [email protected] [email protected]; \
diff --git a/src/dd.c b/src/dd.c
index 33959b495..98f360089 100644
--- a/src/dd.c
+++ b/src/dd.c
@@ -295,6 +295,7 @@ enum
| O_DIRECT
| O_DIRECTORY
| O_DSYNC
+ | O_EXCL
| O_NOATIME
| O_NOCTTY
| O_NOFOLLOW
--
2.51.0