summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Voelker <mail@bernhard-voelker.de>2015-02-09 08:19:01 +0100
committerBernhard Voelker <mail@bernhard-voelker.de>2015-02-09 10:42:10 +0100
commit99f76aec8a7e74f2e1622b74b1011fac6f677f4e (patch)
tree86f89bf8936a3c90eb21060be404cf3d586a3c7e
parentebb71efc1e74076017f3a983b4cb4a3311925d14 (diff)
downloadcoreutils-99f76aec8a7e74f2e1622b74b1011fac6f677f4e.tar.xz
maint: make sc_dd_O_FLAGS more robust
The construct "diff ... || diff=1 || diff=" does not set the variable in all cases. This could be triggered with: $ env make diff=1 make sc_dd_O_FLAGS dd_O_FLAGS maint.mk: ./src/dd.c has inconsistent O_ flag lists cfg.mk:59: recipe for target 'sc_dd_O_FLAGS' failed make: *** [sc_dd_O_FLAGS] Error 1 * cfg.mk (sc_dd_O_FLAGS): Remember $? of the diff command directly and check its value later rather than using the above mentioned mapping.
-rw-r--r--cfg.mk8
1 files changed, 4 insertions, 4 deletions
diff --git a/cfg.mk b/cfg.mk
index 4803074f8..770527a1c 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -61,11 +61,11 @@ sc_dd_O_FLAGS:
perl -nle '/^ +\| (O_\w*)$$/ and print $$1' $(dd); } | sort > $@.1
@{ echo O_NOFOLLOW; perl -nle '/{"[a-z]+",\s*(O_\w+)},/ and print $$1' \
$(dd); } | sort > $@.2
- @diff -u $@.1 $@.2 || diff=1 || diff=; \
+ @diff -u $@.1 $@.2; diff=$$?; \
rm -f $@.1 $@.2; \
- test "$$diff" \
- && { echo '$(ME): $(dd) has inconsistent O_ flag lists'>&2; \
- exit 1; } || :
+ test "$$diff" = 0 \
+ || { echo '$(ME): $(dd) has inconsistent O_ flag lists'>&2; \
+ exit 1; }
# Ensure that dd's definition of LONGEST_SYMBOL stays in sync
# with the strings from the two affected variables.