Use INSTALL after sed in Makefile for install targets#3912
Use INSTALL after sed in Makefile for install targets#3912mulkieran wants to merge 1 commit intostratis-storage:masterfrom
Conversation
Install sets the file permissions; sed might default to setting file permissions incorrectly. 0755 for files that might need to be executed; 0644 for those that will not. Signed-off-by: mulhern <amulhern@redhat.com>
WalkthroughThe Makefile now generates config and service files by piping sed output into install, setting explicit permissions (0644 for services, 0755 for a module script). Targets for dracut and systemd switch from redirection to install -Dpm… while preserving file contents. Changes
Sequence Diagram(s)Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs. ✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
Makefile (2)
248-249: Safer sed→install: avoid -p and guard against sed failurePiping into install can create zero-byte files if sed errors; -p also tries to preserve timestamps from /dev/stdin. Prefer a tmp-file handoff and drop -p. Also add “--” before DEST to guard against dash-prefixed paths.
Option A (robust):
- sed 's|@LIBEXECDIR@|$(LIBEXECDIR)|' dracut/90stratis/stratisd-min.service.in | $(INSTALL) -Dpm0644 /dev/stdin $(DESTDIR)$(DRACUTDIR)/modules.d/90stratis/stratisd-min.service - sed 's|@LIBEXECDIR@|$(LIBEXECDIR)|' dracut/90stratis/module-setup.sh.in | $(INSTALL) -Dpm0755 /dev/stdin $(DESTDIR)$(DRACUTDIR)/modules.d/90stratis/module-setup.sh + tmp="$$(mktemp)"; sed 's|@LIBEXECDIR@|$(LIBEXECDIR)|' dracut/90stratis/stratisd-min.service.in > "$$tmp" && $(INSTALL) -Dm0644 "$$tmp" -- $(DESTDIR)$(DRACUTDIR)/modules.d/90stratis/stratisd-min.service && rm -f "$$tmp" + tmp="$$(mktemp)"; sed 's|@LIBEXECDIR@|$(LIBEXECDIR)|' dracut/90stratis/module-setup.sh.in > "$$tmp" && $(INSTALL) -Dm0755 "$$tmp" -- $(DESTDIR)$(DRACUTDIR)/modules.d/90stratis/module-setup.sh && rm -f "$$tmp"Option B (minimal change):
- sed 's|@LIBEXECDIR@|$(LIBEXECDIR)|' dracut/90stratis/stratisd-min.service.in | $(INSTALL) -Dpm0644 /dev/stdin $(DESTDIR)$(DRACUTDIR)/modules.d/90stratis/stratisd-min.service - sed 's|@LIBEXECDIR@|$(LIBEXECDIR)|' dracut/90stratis/module-setup.sh.in | $(INSTALL) -Dpm0755 /dev/stdin $(DESTDIR)$(DRACUTDIR)/modules.d/90stratis/module-setup.sh + sed 's|@LIBEXECDIR@|$(LIBEXECDIR)|' dracut/90stratis/stratisd-min.service.in | $(INSTALL) -Dm0644 /dev/stdin -- $(DESTDIR)$(DRACUTDIR)/modules.d/90stratis/stratisd-min.service + sed 's|@LIBEXECDIR@|$(LIBEXECDIR)|' dracut/90stratis/module-setup.sh.in | $(INSTALL) -Dm0755 /dev/stdin -- $(DESTDIR)$(DRACUTDIR)/modules.d/90stratis/module-setup.sh
259-262: Same here: make pipeline resilient and drop -pMirror the dracut fix: prevent empty installs on sed error and skip timestamp preservation from stdin.
Option A (robust):
- sed 's|@LIBEXECDIR@|$(LIBEXECDIR)|' systemd/stratisd.service.in | $(INSTALL) -Dpm0644 /dev/stdin $(DESTDIR)$(UNITDIR)/stratisd.service - sed 's|@LIBEXECDIR@|$(LIBEXECDIR)|' systemd/stratisd-min-postinitrd.service.in | $(INSTALL) -Dpm0644 /dev/stdin $(DESTDIR)$(UNITDIR)/stratisd-min-postinitrd.service - sed 's|@UNITEXECDIR@|$(UNITEXECDIR)|' systemd/stratis-fstab-setup@.service.in | $(INSTALL) -Dpm0644 /dev/stdin $(DESTDIR)$(UNITDIR)/stratis-fstab-setup@.service - sed 's|@UNITEXECDIR@|$(UNITEXECDIR)|' systemd/stratis-fstab-setup-with-network@.service.in | $(INSTALL) -Dpm0644 /dev/stdin $(DESTDIR)$(UNITDIR)/stratis-fstab-setup-with-network@.service + tmp="$$(mktemp)"; sed 's|@LIBEXECDIR@|$(LIBEXECDIR)|' systemd/stratisd.service.in > "$$tmp" && $(INSTALL) -Dm0644 "$$tmp" -- $(DESTDIR)$(UNITDIR)/stratisd.service && rm -f "$$tmp" + tmp="$$(mktemp)"; sed 's|@LIBEXECDIR@|$(LIBEXECDIR)|' systemd/stratisd-min-postinitrd.service.in > "$$tmp" && $(INSTALL) -Dm0644 "$$tmp" -- $(DESTDIR)$(UNITDIR)/stratisd-min-postinitrd.service && rm -f "$$tmp" + tmp="$$(mktemp)"; sed 's|@UNITEXECDIR@|$(UNITEXECDIR)|' systemd/stratis-fstab-setup@.service.in > "$$tmp" && $(INSTALL) -Dm0644 "$$tmp" -- $(DESTDIR)$(UNITDIR)/stratis-fstab-setup@.service && rm -f "$$tmp" + tmp="$$(mktemp)"; sed 's|@UNITEXECDIR@|$(UNITEXECDIR)|' systemd/stratis-fstab-setup-with-network@.service.in > "$$tmp" && $(INSTALL) -Dm0644 "$$tmp" -- $(DESTDIR)$(UNITDIR)/stratis-fstab-setup-with-network@.service && rm -f "$$tmp"Option B (minimal change):
- sed 's|@LIBEXECDIR@|$(LIBEXECDIR)|' systemd/stratisd.service.in | $(INSTALL) -Dpm0644 /dev/stdin $(DESTDIR)$(UNITDIR)/stratisd.service - sed 's|@LIBEXECDIR@|$(LIBEXECDIR)|' systemd/stratisd-min-postinitrd.service.in | $(INSTALL) -Dpm0644 /dev/stdin $(DESTDIR)$(UNITDIR)/stratisd-min-postinitrd.service - sed 's|@UNITEXECDIR@|$(UNITEXECDIR)|' systemd/stratis-fstab-setup@.service.in | $(INSTALL) -Dpm0644 /dev/stdin $(DESTDIR)$(UNITDIR)/stratis-fstab-setup@.service - sed 's|@UNITEXECDIR@|$(UNITEXECDIR)|' systemd/stratis-fstab-setup-with-network@.service.in | $(INSTALL) -Dpm0644 /dev/stdin $(DESTDIR)$(UNITDIR)/stratis-fstab-setup-with-network@.service + sed 's|@LIBEXECDIR@|$(LIBEXECDIR)|' systemd/stratisd.service.in | $(INSTALL) -Dm0644 /dev/stdin -- $(DESTDIR)$(UNITDIR)/stratisd.service + sed 's|@LIBEXECDIR@|$(LIBEXECDIR)|' systemd/stratisd-min-postinitrd.service.in | $(INSTALL) -Dm0644 /dev/stdin -- $(DESTDIR)$(UNITDIR)/stratisd-min-postinitrd.service + sed 's|@UNITEXECDIR@|$(UNITEXECDIR)|' systemd/stratis-fstab-setup@.service.in | $(INSTALL) -Dm0644 /dev/stdin -- $(DESTDIR)$(UNITDIR)/stratis-fstab-setup@.service + sed 's|@UNITEXECDIR@|$(UNITEXECDIR)|' systemd/stratis-fstab-setup-with-network@.service.in | $(INSTALL) -Dm0644 /dev/stdin -- $(DESTDIR)$(UNITDIR)/stratis-fstab-setup-with-network@.service
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
Makefile(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (33)
- GitHub Check: rpm-build:fedora-42-x86_64:copr_pull
- GitHub Check: rpm-build:fedora-rawhide-x86_64:copr_pull
- GitHub Check: rpm-build:fedora-43-x86_64:copr_pull
- GitHub Check: rpm-build:fedora-41-x86_64:copr_pull
- GitHub Check: testing-farm:fedora-rawhide-x86_64:cockpit
- GitHub Check: testing-farm:fedora-43-x86_64:cockpit
- GitHub Check: testing-farm:fedora-42-x86_64:local
- GitHub Check: testing-farm:fedora-41-x86_64:local
- GitHub Check: testing-farm:fedora-rawhide-x86_64:local
- GitHub Check: testing-farm:fedora-43-x86_64:local
- GitHub Check: rpm-build:fedora-42-x86_64:copr_pull
- GitHub Check: rpm-build:fedora-41-x86_64:copr_pull
- GitHub Check: rpm-build:fedora-rawhide-x86_64:copr_pull
- GitHub Check: rpm-build:fedora-43-x86_64:copr_pull
- GitHub Check: checks (make -f Makefile build-no-ipc, 1.89.0, cargo)
- GitHub Check: checks (make -f Makefile test, 1.89.0, cargo)
- GitHub Check: checks (make -f Makefile docs-ci, 1.89.0, cargo)
- GitHub Check: checks (make -f Makefile build-min, 1.89.0, cargo)
- GitHub Check: checks (PROFILEDIR=debug make -f Makefile build-no-ipc, 1.89.0, cargo)
- GitHub Check: checks (PROFILEDIR=debug make -f Makefile build, 1.89.0, cargo)
- GitHub Check: checks (PROFILEDIR=debug make -f Makefile build-min-no-systemd, 1.89.0, cargo)
- GitHub Check: checks (PROFILEDIR=debug make -f Makefile build-utils, 1.89.0, cargo)
- GitHub Check: checks (make -f Makefile clippy, 1.89.0, clippy)
- GitHub Check: checks (PROFILEDIR=debug make -f Makefile build-min, 1.89.0, cargo)
- GitHub Check: checks (PROFILEDIR=debug make -f Makefile stratisd-tools, 1.89.0, cargo)
- GitHub Check: checks (make -f Makefile check-typos, 1.89.0, cargo)
- GitHub Check: tests-with-testing-repo (master)
- GitHub Check: stratis-min-cli-checks
- GitHub Check: checks (make -f Makefile fmt-ci, 1.89.0, rustfmt)
- GitHub Check: stratis-cli-checks
- GitHub Check: checks_with_udev (RUST_LOG=stratisd=debug make -f Makefile test-loop-root, 1.89.0, cargo)
- GitHub Check: checks_with_tang_should_fail (TANG_URL=localhost make -f Makefile test-clevis-loop-should-fail-ro...
- GitHub Check: checks_with_udev (RUST_LOG=stratisd=debug make -f Makefile test-loop-root, 1.89.0, cargo)
|
I bet dracut doesn't even care about exec permission...but the install is less repeatable because the timestamp does change... |
|
Congratulations! One of the builds has completed. 🍾 You can install the built RPMs by following these steps:
Please note that the RPMs should be used only in a testing environment. |
Summary by CodeRabbit