]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
dd: don't mistakenly use O_EXCL on GNU/Hurd
authorCollin Funk <collin.funk1@gmail.com>
Fri, 19 Sep 2025 06:29:02 +0000 (23:29 -0700)
committerCollin Funk <collin.funk1@gmail.com>
Fri, 19 Sep 2025 06:31:18 +0000 (23:31 -0700)
* 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
cfg.mk
src/dd.c

diff --git a/NEWS b/NEWS
index 4c979607b2b6b62e9076edd4cb9dd5bf0fc59f61..d618a0bddaf63f2b69c1b14f417cce2268378d30 100644 (file)
--- 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 0abb5c2262dbd07eb6336dc0c5e0c7467c19b3a0..8e8cae2e66bd13de9b828deff06d841e5f6e95cb 100644 (file)
--- a/cfg.mk
+++ b/cfg.mk
@@ -68,7 +68,8 @@ sc_dd_O_FLAGS:
        @rm -f $@.1 $@.2
        @{ echo O_FULLBLOCK; echo O_NOCACHE;                            \
          perl -nle '/^ +\| (O_\w*)$$/ and print $$1' $(dd); } | sort > $@.1
-       @{ 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 > $@.2
        @diff -u $@.1 $@.2; diff=$$?;                                   \
        rm -f $@.1 $@.2;                                                \
index 33959b4952c9259c39882aefffbe4c708e984fbd..98f36008905111f61ef60d3914256413f78c200e 100644 (file)
--- 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