To be honest, I wouldn't start tweaking the code with patches just
yet. The existing code doesn't seem wrong, so we need to understand
where and how it breaks, otherwise how would we justify any changes to
upstream?

So I'd keep only the very last bit:

+        # temp change
+        install -m 644 ${S}/udev-md-raid-safe-timeouts.rules
${D}/${sysconfdir}/tmp-file
+
+        if grep -q "BINDIR" ${D}${datadir}/${BPN}/mdcheck; then
+            bberror "Build failed: 'BINDIR' placeholder found in mdcheck."
+            bbfatal_log "sed command in Makefile failed to execute correctly."
+        fi

tmp-file needs to increment every time a new version is sent. E.g.
tmp-file-2 etc.

Alex

On Mon, 16 Feb 2026 at 23:11, Ankur Tyagi via lists.openembedded.org
<[email protected]> wrote:
>
> From: Ankur Tyagi <[email protected]>
>
> This patch is to validate a possible race condition theory during install.
> Also fail the build if sed substitution still fails for further investigation.
>
> Details: https://bugzilla.yoctoproject.org/show_bug.cgi?id=16166
>
> [YOCTO #16166]
>
> Signed-off-by: Ankur Tyagi <[email protected]>
> ---
>  ...1-Makefile-install-rule-improvements.patch | 64 +++++++++++++++++++
>  meta/recipes-extended/mdadm/mdadm_4.5.bb      | 13 +++-
>  2 files changed, 76 insertions(+), 1 deletion(-)
>  create mode 100644 
> meta/recipes-extended/mdadm/files/0001-Makefile-install-rule-improvements.patch
>
> diff --git 
> a/meta/recipes-extended/mdadm/files/0001-Makefile-install-rule-improvements.patch
>  
> b/meta/recipes-extended/mdadm/files/0001-Makefile-install-rule-improvements.patch
> new file mode 100644
> index 0000000000..feb4c5d926
> --- /dev/null
> +++ 
> b/meta/recipes-extended/mdadm/files/0001-Makefile-install-rule-improvements.patch
> @@ -0,0 +1,64 @@
> +From 21310a9249e21c3dbdb6a6b8e07e74bf0a4557bc Mon Sep 17 00:00:00 2001
> +From: Ankur Tyagi <[email protected]>
> +Date: Tue, 17 Feb 2026 08:41:48 +1300
> +Subject: [PATCH] Makefile: install rule improvements
> +
> +- Removed double install logic
> +- Use unique temp files
> +
> +Upstream-Status: Pending
> +
> +Signed-off-by: Ankur Tyagi <[email protected]>
> +---
> + Makefile | 30 ++++++++++++++----------------
> + 1 file changed, 14 insertions(+), 16 deletions(-)
> +
> +diff --git a/Makefile b/Makefile
> +index 788ff5d9..a4d4f178 100644
> +--- a/Makefile
> ++++ b/Makefile
> +@@ -298,30 +298,28 @@ install-man: mdadm.8 md.4 mdadm.conf.5 mdmon.8
> + install-udev: udev-md-raid-arrays.rules udev-md-raid-assembly.rules 
> udev-md-raid-creating.rules \
> +               udev-md-clustered-confirm-device.rules
> +       @for file in $(UDEV_RULES); \
> +-      do sed -e 's,BINDIR,$(BINDIR),g' udev-$${file#??-} > .install.tmp.1 
> && \
> +-         $(ECHO) $(INSTALL) -D -m 644 udev-$${file#??-} 
> $(DESTDIR)$(UDEVDIR)/rules.d/$$file ; \
> +-         $(INSTALL) -D -m 644 .install.tmp.1 
> $(DESTDIR)$(UDEVDIR)/rules.d/$$file ; \
> +-         rm -f .install.tmp.1; \
> ++      do \
> ++              srcfile=udev-$${file#??-} ; \
> ++              sed -e 's,BINDIR,$(BINDIR),g' $$srcfile > $$srcfile.tmp && \
> ++              $(INSTALL) -D -m 644 $$srcfile.tmp 
> $(DESTDIR)$(UDEVDIR)/rules.d/$$file && \
> ++              rm -f $$srcfile.tmp ; \
> +       done
> +
> + install-systemd: systemd/[email protected]
> +       @for file in $(SYSTEMD_UNITS); \
> +-      do sed -e 's,BINDIR,$(BINDIR),g;s,MISCDIR,$(MISCDIR),g' 
> systemd/$$file > .install.tmp.2 && \
> +-         $(ECHO) $(INSTALL) -D -m 644 systemd/$$file 
> $(DESTDIR)$(SYSTEMD_DIR)/$$file ; \
> +-         $(INSTALL) -D -m 644 .install.tmp.2 
> $(DESTDIR)$(SYSTEMD_DIR)/$$file ; \
> +-         rm -f .install.tmp.2; \
> ++      do sed -e 's,BINDIR,$(BINDIR),g;s,MISCDIR,$(MISCDIR),g' 
> systemd/$$file > systemd/$$file.tmp && \
> ++         $(INSTALL) -D -m 644 systemd/$$file.tmp 
> $(DESTDIR)$(SYSTEMD_DIR)/$$file && \
> ++         rm -f systemd/$$file.tmp; \
> +       done
> +       @for file in mdadm.shutdown ; \
> +-      do sed -e 's,BINDIR,$(BINDIR),g' systemd/$$file > .install.tmp.3 && \
> +-         $(ECHO) $(INSTALL) -D -m 755  systemd/$$file 
> $(DESTDIR)$(SYSTEMD_DIR)-shutdown/$$file ; \
> +-         $(INSTALL) -D -m 755  .install.tmp.3 
> $(DESTDIR)$(SYSTEMD_DIR)-shutdown/$$file ; \
> +-         rm -f .install.tmp.3; \
> ++      do sed -e 's,BINDIR,$(BINDIR),g' systemd/$$file > systemd/$$file.tmp 
> && \
> ++         $(INSTALL) -D -m 755  systemd/$$file.tmp 
> $(DESTDIR)$(SYSTEMD_DIR)-shutdown/$$file && \
> ++         rm -f systemd/$$file.tmp; \
> +       done
> +       @for file in mdcheck ; \
> +-      do sed -e 's,BINDIR,$(BINDIR),g' misc/$$file > .install.tmp.4 && \
> +-         $(ECHO) $(INSTALL) -D -m 755  misc/$$file 
> $(DESTDIR)$(MISCDIR)/$$file ; \
> +-         $(INSTALL) -D -m 755  .install.tmp.4 $(DESTDIR)$(MISCDIR)/$$file ; 
> \
> +-         rm -f .install.tmp.4; \
> ++      do sed -e 's,BINDIR,$(BINDIR),g' misc/$$file > misc/$$file.tmp && \
> ++         $(INSTALL) -D -m 755  misc/$$file.tmp $(DESTDIR)$(MISCDIR)/$$file 
> && \
> ++         rm -f misc/$$file.tmp; \
> +       done
> +
> + install-bin: mdadm mdmon
> diff --git a/meta/recipes-extended/mdadm/mdadm_4.5.bb 
> b/meta/recipes-extended/mdadm/mdadm_4.5.bb
> index b30d3d776e..bca70aeaf0 100644
> --- a/meta/recipes-extended/mdadm/mdadm_4.5.bb
> +++ b/meta/recipes-extended/mdadm/mdadm_4.5.bb
> @@ -14,6 +14,7 @@ SRC_URI = 
> "git://git.kernel.org/pub/scm/utils/mdadm/mdadm.git;protocol=https;bra
>             file://mdadm.init \
>             
> file://0002-Create.c-include-linux-falloc.h-for-FALLOC_FL_ZERO_R.patch \
>             
> file://0001-raid6check.c-restripe.c-Use-64-bit-off_t-across-both.patch \
> +           file://0001-Makefile-install-rule-improvements.patch \
>             "
>
>  SRCREV = "8f0c7692d48414ff7b3fe927ce75799c65ef24b1"
> @@ -40,11 +41,21 @@ EXTRA_OEMAKE = 'CHECK_RUN_DIR=0 CWFLAGS="" 
> CXFLAGS="${CFLAGS}" SYSTEMD_DIR=${sys
>  DEBUG_OPTIMIZATION:append = " -Wno-error"
>
>  do_install() {
> -        oe_runmake 'DESTDIR=${D}' install install-systemd
> +        install -d ${D}/${datadir}/
> +
> +        oe_runmake -j 1 'DESTDIR=${D}' install install-systemd
> +
>          install -d ${D}/${sysconfdir}/
>          install -m 644 ${S}/documentation/mdadm.conf-example 
> ${D}${sysconfdir}/mdadm.conf
>          install -d ${D}/${sysconfdir}/init.d
>          install -m 755 ${UNPACKDIR}/mdadm.init 
> ${D}${sysconfdir}/init.d/mdmonitor
> +        # temp change
> +        install -m 644 ${S}/udev-md-raid-safe-timeouts.rules 
> ${D}/${sysconfdir}/tmp-file
> +
> +        if grep -q "BINDIR" ${D}${datadir}/${BPN}/mdcheck; then
> +            bberror "Build failed: 'BINDIR' placeholder found in mdcheck."
> +            bbfatal_log "sed command in Makefile failed to execute 
> correctly."
> +        fi
>  }
>
>  do_compile_ptest() {
>
> 
>
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#231233): 
https://lists.openembedded.org/g/openembedded-core/message/231233
Mute This Topic: https://lists.openembedded.org/mt/117847720/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to