[DTrace-devel] [PATCH] dtprobed: don't chown systemd service files to root during install

Nick Alcock nick.alcock at oracle.com
Mon Nov 11 10:46:46 UTC 2024


I put this in while thinking vaguely that "systemd requires these
to be root-owned, we're not using install(1) so we should fix that".
If redirecting, the ownership will be the ownership of the running
process unless the file already exists (and the thing to do there is
to rm -f it first, not to chown it afterwards): and if we're not
root, chowning isn't going to work anyway (and will abort the
install).

So take the chown out and replace it with an rm -f in the right place.

Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
---
 dtprobed/Build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dtprobed/Build b/dtprobed/Build
index c43b62778381..a242afab94fc 100644
--- a/dtprobed/Build
+++ b/dtprobed/Build
@@ -41,8 +41,8 @@ install-dtprobed-autostart::
 ifneq ($(WITH_SYSTEMD),)
 	mkdir -p $(INSTSYSTEMDUNITDIR) $(INSTSYSTEMDPRESETDIR)
 	$(call describe-install-target,$(INSTSYSTEMDUNITDIR),dtprobed.service)
+	rm -f $(INSTSYSTEMDUNITDIR)/dtprobed.service
 	sed 's, at SBINDIR@,$(SBINDIR),' < $(dtprobed_DIR)dtprobed.service.in > $(INSTSYSTEMDUNITDIR)/dtprobed.service
-        chown root:root $(INSTSYSTEMDUNITDIR)/dtprobed.service
 	chmod 0644 $(INSTSYSTEMDUNITDIR)/dtprobed.service
 	$(call describe-install-target,$(INSTSYSTEMDUNITDIR),dtrace-usdt.target)
 	install -m 644 $(dtprobed_DIR)dtrace-usdt.target $(INSTSYSTEMDUNITDIR)

base-commit: ba6e6542c44f22b3707949e859b13209bebefae2
-- 
2.46.0.278.g36e3a12567




More information about the DTrace-devel mailing list