0001-libcap-Makefile-don-t-overwrite-empty-when-generatin.patch 1.9 KB

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