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