1From dc507a812d931c24f1ac98c811fdd29bffa21da9 Mon Sep 17 00:00:00 2001 2From: "Arnout Vandecappelle (Essensium/Mind)" <arnout@mind.be> 3Date: Tue, 24 Aug 2021 00:36:40 +0200 4Subject: [PATCH] libcap/Makefile: don't overwrite 'empty' when generating 5 loader.txt 6 7objcopy takes an input file and an output file as arguments. If the 8output file is left out, the input file will be overwritten. 9 10Since the objcopy command used to generate loader.txt only does a 11dump-section and no filtering, in practice there is no change to empty. 12However, as a side-effect, its timestamp is updated. The timestamp of 13empty and of loader.txt will be more or less the same; however, 14loader.txt is closed just before the output file is closed, so it's 15possible that the timestamp of loader.txt is just a little bit earlier. 16If this happens, it causes loader.txt to be rebuilt later, which in turn 17causes a number of other object files to be rebuilt. 18 19Usually that's harmless, but it sometimes causes the rebuild to happen 20during 'make install'. This is particularly annoying if 'make install' 21is done as root, since loader.txt becomes owned by root in that case. 22 23Fix this by specifying a harmless output file: /dev/null. 24 25While we're at it, take in an upstream change that removes the redundant 26redirect. 27 28Fixes: ee3b25c0a877fa74d1aec88f325ac45b09963c82 29 30Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> 31--- 32 libcap/Makefile | 2 +- 33 1 file changed, 1 insertion(+), 1 deletion(-) 34 35diff --git a/libcap/Makefile b/libcap/Makefile 36index 47cf8f4..18e4f4f 100644 37--- a/libcap/Makefile 38+++ b/libcap/Makefile 39@@ -105,7 +105,7 @@ empty: empty.c 40 $(CC) -o $@ $< 41 42 loader.txt: empty 43- $(OBJCOPY) --dump-section .interp=/dev/stdout $< > $@ 44+ $(OBJCOPY) --dump-section .interp=$@ $< /dev/null 45 46 cap_magic.o: execable.h execable.c loader.txt 47 $(CC) $(CFLAGS) $(IPATH) -DLIBRARY_VERSION=\"$(LIBTITLE)-$(VERSION).$(MINOR)\" -DSHARED_LOADER=\"$(shell cat loader.txt)\" -c execable.c -o $@ 48-- 492.31.1 50 51