<div dir="ltr"><div>The tools conditional nesting is a bit tortuous. I wonder given the remedy is the same in each case if there is value in converting something like this once per package:<br></div><div><br></div><div> [ -e $(pkgdir_bin) ] && find $(pkgdir_bin) -print0 | xargs -0 chown 0:0</div><div><br></div><div>-apw<br></div><div><div class="gmail-post__header" style="box-sizing:border-box;display:flex;margin:0px;white-space:nowrap;width:547.5px;height:0px;float:left;color:rgb(255,255,255);font-family:"Open Sans",sans-serif;font-size:14px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;word-spacing:0px;background-color:rgb(51,51,51);text-decoration-style:initial;text-decoration-color:initial"><div class="gmail-col" style="box-sizing:border-box;max-width:100%"><div class="gmail-post__header--info" style="box-sizing:border-box;padding:0px"><br class="gmail-Apple-interchange-newline"></div></div></div></div><div><div class="gmail-post__header" style="box-sizing:border-box;display:flex;margin:0px;white-space:nowrap;width:547.5px;padding:0px 55px 0px 0px;height:0px;float:left;color:rgb(255,255,255);font-family:"Open Sans",sans-serif;font-size:14px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;word-spacing:0px;background-color:rgba(255,255,255,0.04);text-decoration-style:initial;text-decoration-color:initial"><div class="gmail-col" style="box-sizing:border-box;max-width:100%"><div class="gmail-post__header--info" style="box-sizing:border-box;padding:0px"><div class="gmail-col" style="box-sizing:border-box;max-width:100%"><a id="gmail-CENTER_time_w8ss9brfobgtpdegmrni3jsbee" class="gmail-post__permalink" href="https://chat.canonical.com/canonical/pl/w8ss9brfobgtpdegmrni3jsbee" style="box-sizing:border-box;background-color:transparent;color:inherit;text-decoration:none;word-break:break-word;display:inline-block"><br class="gmail-Apple-interchange-newline">14:17</a></div><div class="gmail-col gmail-post-menu" style="box-sizing:border-box;max-width:100%;border-radius:4px;border:1px solid rgba(255,255,255,0.2);display:flex;padding:4px;white-space:normal"><div class="gmail-MenuWrapper" style="box-sizing:border-box"><button id="gmail-CENTER_button_w8ss9brfobgtpdegmrni3jsbee" class="gmail-post-menu__item" type="button" style="box-sizing:border-box;font:inherit;margin:0px;overflow:visible;text-transform:none;display:inline-flex;border:medium none;background:transparent none repeat scroll 0% 0%;border-radius:4px;width:28px;height:28px"><span class="gmail-icon gmail-icon--small" style="box-sizing:border-box;display:flex;font-size:18px;height:16px;width:16px"></span></button></div><button id="gmail-CENTER_reaction_w8ss9brfobgtpdegmrni3jsbee" class="gmail-post-menu__item gmail-post-menu__item--reactions" style="box-sizing:border-box;font:inherit;margin:0px;overflow:visible;text-transform:none;display:inline-flex;border:medium none;background:transparent none repeat scroll 0% 0%;border-radius:4px;width:28px;height:28px"><span class="gmail-icon gmail-icon--small" style="box-sizing:border-box;display:flex;font-size:18px;height:16px;width:16px"></span></button><button id="gmail-CENTER_flagIcon_w8ss9brfobgtpdegmrni3jsbee" class="gmail-post-menu__item" style="box-sizing:border-box;font:inherit;margin:0px;overflow:visible;text-transform:none;display:inline-flex;border:medium none;background:transparent none repeat scroll 0% 0%;border-radius:4px;width:28px;height:28px"><span class="gmail-icon gmail-icon--small" style="box-sizing:border-box;display:flex;font-size:18px;height:16px;width:16px"></span></button><button id="gmail-CENTER_commentIcon_w8ss9brfobgtpdegmrni3jsbee" class="gmail-post-menu__item gmail-post-menu__item--wide gmail-pull-right" style="box-sizing:border-box;font:inherit;margin:0px;overflow:visible;text-transform:none;float:right;display:inline-flex;border:medium none;background:transparent none repeat scroll 0% 0%;border-radius:4px;width:auto;height:28px;padding:0px 6px"><span class="gmail-d-flex gmail-align-items-center" style="box-sizing:border-box;display:flex"><span class="gmail-icon gmail-icon--small" style="box-sizing:border-box;display:flex;font-size:18px;height:16px;width:16px"></span></span></button></div></div></div></div><div style="box-sizing:border-box;color:rgb(255,255,255);font-family:"Open Sans",sans-serif;font-size:14px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgba(255,255,255,0.04);text-decoration-style:initial;text-decoration-color:initial"><div id="gmail-w8ss9brfobgtpdegmrni3jsbee_message" class="gmail-post__body" style="box-sizing:border-box;padding:0px 0px 0.2em;width:547.5px;background:transparent none repeat scroll 0% 0%"><div class="gmail-post-message gmail-post-message--collapsed" style="box-sizing:border-box;overflow:hidden"><div class="gmail-post-message__text-container" style="box-sizing:border-box;max-height:600px"><div tabindex="0" id="gmail-postMessageText_w8ss9brfobgtpdegmrni3jsbee" class="gmail-post-message__text" style="box-sizing:border-box"><p style="box-sizing:border-box;margin:0px;font-size:13.5px;line-height:1.6em;white-space:pre-wrap;width:547.5px;word-break:break-word"><span class="gmail-codespan__pre-wrap" style="box-sizing:border-box"><code style="box-sizing:border-box;font-family:Menlo,Monaco,Consolas,"Courier New",monospace;font-size:12.15px;padding:2px 4px;color:inherit;border-radius:4px;white-space:pre-wrap">[ -e $(pkgdir_bin) ] && find $(pkgdir_bin) -print0 | xargs -0 chown 0:0</code></span></p></div></div></div></div></div></div><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 3 Jun 2021 at 14:06, Seth Forshee <<a href="mailto:seth.forshee@canonical.com">seth.forshee@canonical.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">BugLink: <a href="https://bugs.launchpad.net/bugs/1930713" rel="noreferrer" target="_blank">https://bugs.launchpad.net/bugs/1930713</a><br>
<br>
We now install some files during build. This may be run separately<br>
from building packages, in which case fakeroot will not record the<br>
correct ownership in package archives.<br>
<br>
Fix this by adding a new fixowner target which fixes the ownership<br>
for the files installed during the build and is a dependency of the<br>
build targets.<br>
<br>
Signed-off-by: Seth Forshee <<a href="mailto:seth.forshee@canonical.com" target="_blank">seth.forshee@canonical.com</a>><br>
---<br>
debian/rules.d/<a href="http://2-binary-arch.mk" rel="noreferrer" target="_blank">2-binary-arch.mk</a> | 38 ++++++++++++++++++++++++++++++++-<br>
1 file changed, 37 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/debian/rules.d/<a href="http://2-binary-arch.mk" rel="noreferrer" target="_blank">2-binary-arch.mk</a> b/debian/rules.d/<a href="http://2-binary-arch.mk" rel="noreferrer" target="_blank">2-binary-arch.mk</a><br>
index 7e2c8b7ae169..cbfc604607f7 100644<br>
--- a/debian/rules.d/<a href="http://2-binary-arch.mk" rel="noreferrer" target="_blank">2-binary-arch.mk</a><br>
+++ b/debian/rules.d/<a href="http://2-binary-arch.mk" rel="noreferrer" target="_blank">2-binary-arch.mk</a><br>
@@ -35,11 +35,47 @@ $(stampdir)/stamp-prepare-tree-%: $(commonconfdir)/config.common.$(family) $(arc<br>
$(build_cd) $(kmake) $(build_O) -j1 syncconfig prepare scripts<br>
touch $@<br>
<br>
+# Fix ownership for files potentially installed while not under fakeroot<br>
+fixowner-%: pkgdir_bin = $(CURDIR)/debian/$(bin_pkg_name)-$*<br>
+fixowner-%: pkgdir = $(CURDIR)/debian/$(mods_pkg_name)-$*<br>
+fixowner-%: pkgdir_ex = $(CURDIR)/debian/$(mods_extra_pkg_name)-$*<br>
+fixowner-%: pkgdir_bldinfo = $(CURDIR)/debian/$(bldinfo_pkg_name)-$*<br>
+fixowner-%: dbgpkgdir = $(CURDIR)/debian/$(bin_pkg_name)-$*-dbgsym<br>
+fixowner-%: signingv = $(CURDIR)/debian/$(bin_pkg_name)-signing/$(release)-$(revision)<br>
+fixowner-%: toolspkgdir = $(CURDIR)/debian/$(tools_flavour_pkg_name)-$*<br>
+fixowner-%: cloudpkgdir = $(CURDIR)/debian/$(cloud_flavour_pkg_name)-$*<br>
+fixowner-%: basepkg = $(hdrs_pkg_name)<br>
+fixowner-%: indeppkg = $(indep_hdrs_pkg_name)<br>
+fixowner-%: $(stampdir)/stamp-install-%<br>
+ @echo Debug: $@<br>
+ find $(pkgdir_bin) -print0 | xargs -0 chown 0:0<br>
+ find $(pkgdir) -print0 | xargs -0 chown 0:0<br>
+ifeq ($(do_extras_package),true)<br>
+ find $(pkgdir_ex) -print0 | xargs -0 chown 0:0<br>
+endif<br>
+ find $(pkgdir_bldinfo) -print0 | xargs -0 chown 0:0<br>
+ifneq ($(skipdbg),true)<br>
+ find $(dbgpkgdir) -print0 | xargs -0 chown 0:0<br>
+endif<br>
+ifeq ($(any_signed),true)<br>
+ find $(signingv) -print0 | xargs -0 chown 0:0<br>
+endif<br>
+ifeq ($(do_linux_tools),true)<br>
+ find $(toolspkgdir) -print0 | xargs -0 chown 0:0<br>
+ifeq ($(do_cloud_tools),true)<br>
+ifeq ($(do_tools_hyperv),true)<br>
+ find $(cloudpkgdir) -print0 | xargs -0 chown 0:0<br>
+endif<br>
+endif<br>
+endif<br>
+ find $(basepkg) -print0 | xargs -0 chown 0:0<br>
+ find $(indeppkg) -print0 | xargs -0 chown 0:0<br>
+<br>
# Used by developers as a shortcut to prepare a tree for compilation.<br>
prepare-%: $(stampdir)/stamp-prepare-%<br>
@echo Debug: $@<br>
# Used by developers to allow efficient pre-building without fakeroot.<br>
-build-%: $(stampdir)/stamp-install-%<br>
+build-%: fixowner-%<br>
@echo Debug: $@<br>
<br>
# Do the actual build, including image and modules<br>
-- <br>
2.31.1<br>
<br>
<br>
-- <br>
kernel-team mailing list<br>
<a href="mailto:kernel-team@lists.ubuntu.com" target="_blank">kernel-team@lists.ubuntu.com</a><br>
<a href="https://lists.ubuntu.com/mailman/listinfo/kernel-team" rel="noreferrer" target="_blank">https://lists.ubuntu.com/mailman/listinfo/kernel-team</a><br>
</blockquote></div></div></div>