diff mbox series

[meta-oe] xmlrpc-c: Fix race condition triggered during symlink creation

Message ID 20241017061710.1108077-1-raj.khem@gmail.com
State New
Headers show
Series [meta-oe] xmlrpc-c: Fix race condition triggered during symlink creation | expand

Commit Message

Khem Raj Oct. 17, 2024, 6:17 a.m. UTC
This should fix race condition sometime seen in highly parallell builds

   | rm -f libxmlrpc_util.so.4
   | rm -f libxmlrpc_util.so.4
   | ln -s libxmlrpc_util.so.4.60 libxmlrpc_util.so.4
   | ln -s libxmlrpc_util.so.4.60 libxmlrpc_util.so.4
   | rm -f libxmlrpc_util.so
   | ln: failed to create symbolic link 'libxmlrpc_util.so.4': File exists
   | make[2]: *** [/home/kraj01/yoe/build/tmp/work/core2-64-yoe-linux/xmlrpc-c/1.60.03/git/stable/unix-common.mk:72: libxmlrpc_util.so.4] Error 1

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Cc: Martin Jansa <Martin.Jansa@gmail.com>
---
 ...nsuring-Sequential-Execution-of-rm-a.patch | 46 +++++++++++++++++++
 .../xmlrpc-c/xmlrpc-c_1.60.03.bb              |  1 +
 2 files changed, 47 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/xmlrpc-c/xmlrpc-c/0001-unix-common.mk-Ensuring-Sequential-Execution-of-rm-a.patch

Comments

Martin Jansa Oct. 27, 2024, 9:39 p.m. UTC | #1
Acked-by: Martin Jansa <Martin.Jansa@gmail.com>

Thanks Khem!

On Thu, Oct 17, 2024 at 8:17 AM Khem Raj <raj.khem@gmail.com> wrote:
>
> This should fix race condition sometime seen in highly parallell builds
>
>    | rm -f libxmlrpc_util.so.4
>    | rm -f libxmlrpc_util.so.4
>    | ln -s libxmlrpc_util.so.4.60 libxmlrpc_util.so.4
>    | ln -s libxmlrpc_util.so.4.60 libxmlrpc_util.so.4
>    | rm -f libxmlrpc_util.so
>    | ln: failed to create symbolic link 'libxmlrpc_util.so.4': File exists
>    | make[2]: *** [/home/kraj01/yoe/build/tmp/work/core2-64-yoe-linux/xmlrpc-c/1.60.03/git/stable/unix-common.mk:72: libxmlrpc_util.so.4] Error 1
>
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> Cc: Martin Jansa <Martin.Jansa@gmail.com>
> ---
>  ...nsuring-Sequential-Execution-of-rm-a.patch | 46 +++++++++++++++++++
>  .../xmlrpc-c/xmlrpc-c_1.60.03.bb              |  1 +
>  2 files changed, 47 insertions(+)
>  create mode 100644 meta-oe/recipes-devtools/xmlrpc-c/xmlrpc-c/0001-unix-common.mk-Ensuring-Sequential-Execution-of-rm-a.patch
>
> diff --git a/meta-oe/recipes-devtools/xmlrpc-c/xmlrpc-c/0001-unix-common.mk-Ensuring-Sequential-Execution-of-rm-a.patch b/meta-oe/recipes-devtools/xmlrpc-c/xmlrpc-c/0001-unix-common.mk-Ensuring-Sequential-Execution-of-rm-a.patch
> new file mode 100644
> index 0000000000..02b5244f3a
> --- /dev/null
> +++ b/meta-oe/recipes-devtools/xmlrpc-c/xmlrpc-c/0001-unix-common.mk-Ensuring-Sequential-Execution-of-rm-a.patch
> @@ -0,0 +1,46 @@
> +From c9bd05e8f0ad805b81625cfa717d06071cfd9b48 Mon Sep 17 00:00:00 2001
> +From: Khem Raj <raj.khem@gmail.com>
> +Date: Wed, 16 Oct 2024 22:52:38 -0700
> +Subject: [PATCH] unix-common.mk: Ensuring Sequential Execution of rm and ln commands
> +
> +With high parallel execution, it results in race condition where
> +its trying to create symlink while the original symlink while rm is
> +not done deleting the existing file yet.
> +
> +force sequential execution by adding dependencies between the steps
> +or combining them into a single shell command
> +
> +Here, && ensures that the ln -s command only runs after rm -f target
> +successfully completes.
> +
> +Similar error reported here [1]
> +
> +[1] https://bugs.gentoo.org/932835
> +
> +Upstream-Status: Pending
> +Signed-off-by: Khem Raj <raj.khem@gmail.com>
> +---
> + unix-common.mk | 6 ++----
> + 1 file changed, 2 insertions(+), 4 deletions(-)
> +
> +diff --git a/unix-common.mk b/unix-common.mk
> +index 6954faf5..983c48cd 100644
> +--- a/unix-common.mk
> ++++ b/unix-common.mk
> +@@ -62,14 +62,12 @@ SHLIB_CMD = $(CCLD) $(LADD) $(LDFLAGS_SHLIB) -o $@ $^
> + SHLIB_LE_TARGETS = $(call shliblefn, $(SHARED_LIBS_TO_BUILD))
> +
> + $(SHLIB_LE_TARGETS):%:%.$(MAJ)
> +-      rm -f $@
> +-      $(LN_S) $< $@
> ++      rm -f $@ && $(LN_S) $< $@
> +
> + SONAME_TARGETS = $(SHLIB_LE_TARGETS:%=%.$(MAJ))
> +
> + $(SONAME_TARGETS):%:%.$(MIN)
> +-      rm -f $@
> +-      $(LN_S) $< $@
> ++      rm -f $@ && $(LN_S) $< $@
> +
> + .PHONY: $(SHLIB_INSTALL_TARGETS)
> + .PHONY: install-shared-libraries
> diff --git a/meta-oe/recipes-devtools/xmlrpc-c/xmlrpc-c_1.60.03.bb b/meta-oe/recipes-devtools/xmlrpc-c/xmlrpc-c_1.60.03.bb
> index a34256c275..f5ee920cad 100644
> --- a/meta-oe/recipes-devtools/xmlrpc-c/xmlrpc-c_1.60.03.bb
> +++ b/meta-oe/recipes-devtools/xmlrpc-c/xmlrpc-c_1.60.03.bb
> @@ -7,6 +7,7 @@ LIC_FILES_CHKSUM = "file://doc/COPYING;md5=aefbf81ba0750f02176b6f86752ea951"
>
>  SRC_URI = "git://github.com/mirror/xmlrpc-c.git;branch=master;protocol=https \
>             file://0001-test-cpp-server_abyss-Fix-build-with-clang-libc.patch \
> +           file://0001-unix-common.mk-Ensuring-Sequential-Execution-of-rm-a.patch \
>             "
>  # one more commit after Release 1.60.03 in the Stable series
>  SRCREV = "a823b0bb5cf0a4dbd34f929cbfdfb0439c5d9b0e"
Martin Jansa Nov. 3, 2024, 10:48 a.m. UTC | #2
Looks like I spoke too soon, got the same build failure 3 more times
in last 2 days.

rm -f libxmlrpc_util.so.4 && ln -s libxmlrpc_util.so.4.60 libxmlrpc_util.so.4
rm -f xmlrpc_util++.pc
rm -f libxmlrpc_util.so && ln -s libxmlrpc_util.so.4 libxmlrpc_util.so
Echoes to 'xmlrpc_util++.pc' suppressed here ...
make[3]: Entering directory 'xmlrpc-c/1.60.03/git/stable/lib/libutil'
rm -f libxmlrpc_util.so && ln -s libxmlrpc_util.so.4 libxmlrpc_util.so
make[3]: Leaving directory 'xmlrpc-c/1.60.03/git/stable/lib/libutil'
ln: failed to create symbolic link 'libxmlrpc_util.so': File exists
make[3]: *** [xmlrpc-c/1.60.03/git/stable/unix-common.mk:65:
libxmlrpc_util.so] Error 1

Looks like it calls:

make -C xmlrpc-c/1.60.03/git/stable/lib/libutil/ -f
xmlrpc-c/1.60.03/git/stable/lib/libutil/Makefile \
    libxmlrpc_util.so

twice and the added && isn't enough to avoid the race between the 2.

On Sun, Oct 27, 2024 at 10:40 PM Martin Jansa via
lists.openembedded.org <martin.jansa=gmail.com@lists.openembedded.org>
wrote:
>
> Acked-by: Martin Jansa <Martin.Jansa@gmail.com>
>
> Thanks Khem!
>
> On Thu, Oct 17, 2024 at 8:17 AM Khem Raj <raj.khem@gmail.com> wrote:
> >
> > This should fix race condition sometime seen in highly parallell builds
> >
> >    | rm -f libxmlrpc_util.so.4
> >    | rm -f libxmlrpc_util.so.4
> >    | ln -s libxmlrpc_util.so.4.60 libxmlrpc_util.so.4
> >    | ln -s libxmlrpc_util.so.4.60 libxmlrpc_util.so.4
> >    | rm -f libxmlrpc_util.so
> >    | ln: failed to create symbolic link 'libxmlrpc_util.so.4': File exists
> >    | make[2]: *** [/home/kraj01/yoe/build/tmp/work/core2-64-yoe-linux/xmlrpc-c/1.60.03/git/stable/unix-common.mk:72: libxmlrpc_util.so.4] Error 1
> >
> > Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > Cc: Martin Jansa <Martin.Jansa@gmail.com>
> > ---
> >  ...nsuring-Sequential-Execution-of-rm-a.patch | 46 +++++++++++++++++++
> >  .../xmlrpc-c/xmlrpc-c_1.60.03.bb              |  1 +
> >  2 files changed, 47 insertions(+)
> >  create mode 100644 meta-oe/recipes-devtools/xmlrpc-c/xmlrpc-c/0001-unix-common.mk-Ensuring-Sequential-Execution-of-rm-a.patch
> >
> > diff --git a/meta-oe/recipes-devtools/xmlrpc-c/xmlrpc-c/0001-unix-common.mk-Ensuring-Sequential-Execution-of-rm-a.patch b/meta-oe/recipes-devtools/xmlrpc-c/xmlrpc-c/0001-unix-common.mk-Ensuring-Sequential-Execution-of-rm-a.patch
> > new file mode 100644
> > index 0000000000..02b5244f3a
> > --- /dev/null
> > +++ b/meta-oe/recipes-devtools/xmlrpc-c/xmlrpc-c/0001-unix-common.mk-Ensuring-Sequential-Execution-of-rm-a.patch
> > @@ -0,0 +1,46 @@
> > +From c9bd05e8f0ad805b81625cfa717d06071cfd9b48 Mon Sep 17 00:00:00 2001
> > +From: Khem Raj <raj.khem@gmail.com>
> > +Date: Wed, 16 Oct 2024 22:52:38 -0700
> > +Subject: [PATCH] unix-common.mk: Ensuring Sequential Execution of rm and ln commands
> > +
> > +With high parallel execution, it results in race condition where
> > +its trying to create symlink while the original symlink while rm is
> > +not done deleting the existing file yet.
> > +
> > +force sequential execution by adding dependencies between the steps
> > +or combining them into a single shell command
> > +
> > +Here, && ensures that the ln -s command only runs after rm -f target
> > +successfully completes.
> > +
> > +Similar error reported here [1]
> > +
> > +[1] https://bugs.gentoo.org/932835
> > +
> > +Upstream-Status: Pending
> > +Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > +---
> > + unix-common.mk | 6 ++----
> > + 1 file changed, 2 insertions(+), 4 deletions(-)
> > +
> > +diff --git a/unix-common.mk b/unix-common.mk
> > +index 6954faf5..983c48cd 100644
> > +--- a/unix-common.mk
> > ++++ b/unix-common.mk
> > +@@ -62,14 +62,12 @@ SHLIB_CMD = $(CCLD) $(LADD) $(LDFLAGS_SHLIB) -o $@ $^
> > + SHLIB_LE_TARGETS = $(call shliblefn, $(SHARED_LIBS_TO_BUILD))
> > +
> > + $(SHLIB_LE_TARGETS):%:%.$(MAJ)
> > +-      rm -f $@
> > +-      $(LN_S) $< $@
> > ++      rm -f $@ && $(LN_S) $< $@
> > +
> > + SONAME_TARGETS = $(SHLIB_LE_TARGETS:%=%.$(MAJ))
> > +
> > + $(SONAME_TARGETS):%:%.$(MIN)
> > +-      rm -f $@
> > +-      $(LN_S) $< $@
> > ++      rm -f $@ && $(LN_S) $< $@
> > +
> > + .PHONY: $(SHLIB_INSTALL_TARGETS)
> > + .PHONY: install-shared-libraries
> > diff --git a/meta-oe/recipes-devtools/xmlrpc-c/xmlrpc-c_1.60.03.bb b/meta-oe/recipes-devtools/xmlrpc-c/xmlrpc-c_1.60.03.bb
> > index a34256c275..f5ee920cad 100644
> > --- a/meta-oe/recipes-devtools/xmlrpc-c/xmlrpc-c_1.60.03.bb
> > +++ b/meta-oe/recipes-devtools/xmlrpc-c/xmlrpc-c_1.60.03.bb
> > @@ -7,6 +7,7 @@ LIC_FILES_CHKSUM = "file://doc/COPYING;md5=aefbf81ba0750f02176b6f86752ea951"
> >
> >  SRC_URI = "git://github.com/mirror/xmlrpc-c.git;branch=master;protocol=https \
> >             file://0001-test-cpp-server_abyss-Fix-build-with-clang-libc.patch \
> > +           file://0001-unix-common.mk-Ensuring-Sequential-Execution-of-rm-a.patch \
> >             "
> >  # one more commit after Release 1.60.03 in the Stable series
> >  SRCREV = "a823b0bb5cf0a4dbd34f929cbfdfb0439c5d9b0e"
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#113253): https://lists.openembedded.org/g/openembedded-devel/message/113253
> Mute This Topic: https://lists.openembedded.org/mt/109059191/3617156
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [martin.jansa@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Martin Jansa Nov. 4, 2024, 11:02 a.m. UTC | #3
For libutil++ it calls "all" and "libxmlrpc_util++.so" only, but for
libutil it calls "all" and then 13 times libxmlrpc_util.so
(after-clean-j1.log is the make output with -n and -j1 instead of
-j70), still trying to figure out why, my autofoo is rusty :).

martin@jama /OE/build/oe-core/tmp/work/core2-64-oe-linux/xmlrpc-c/1.60.03/git/stable
$ grep -A 1 lib/libutil++/Makefile after-clean-j1.log
make -C libutil++/ -f
/OE/build/oe-core/tmp/work/core2-64-oe-linux/xmlrpc-c/1.60.03/git/stable/lib/libutil++/Makefile
\
    all
--
make -C /OE/build/oe-core/tmp/work/core2-64-oe-linux/xmlrpc-c/1.60.03/git/stable/lib/libutil++/
-f /OE/build/oe-core/tmp/work/core2-64-oe-linux/xmlrpc-c/1.60.03/git/stable/lib/libutil++/Makefile
\
    libxmlrpc_util++.so
martin@jama /OE/build/oe-core/tmp/work/core2-64-oe-linux/xmlrpc-c/1.60.03/git/stable
$ grep -A 1 lib/libutil/Makefile after-clean-j1.log
make -C libutil/ -f
/OE/build/oe-core/tmp/work/core2-64-oe-linux/xmlrpc-c/1.60.03/git/stable/lib/libutil/Makefile
\
    all
--
make -C /OE/build/oe-core/tmp/work/core2-64-oe-linux/xmlrpc-c/1.60.03/git/stable/lib/libutil/
-f /OE/build/oe-core/tmp/work/core2-64-oe-linux/xmlrpc-c/1.60.03/git/stable/lib/libutil/Makefile
\
    libxmlrpc_util.so
--
make -C /OE/build/oe-core/tmp/work/core2-64-oe-linux/xmlrpc-c/1.60.03/git/stable/lib/libutil/
-f /OE/build/oe-core/tmp/work/core2-64-oe-linux/xmlrpc-c/1.60.03/git/stable/lib/libutil/Makefile
\
    libxmlrpc_util.so
--
make -C /OE/build/oe-core/tmp/work/core2-64-oe-linux/xmlrpc-c/1.60.03/git/stable/lib/libutil/
-f /OE/build/oe-core/tmp/work/core2-64-oe-linux/xmlrpc-c/1.60.03/git/stable/lib/libutil/Makefile
\
    libxmlrpc_util.so
--
make -C /OE/build/oe-core/tmp/work/core2-64-oe-linux/xmlrpc-c/1.60.03/git/stable/lib/libutil/
-f /OE/build/oe-core/tmp/work/core2-64-oe-linux/xmlrpc-c/1.60.03/git/stable/lib/libutil/Makefile
\
    libxmlrpc_util.so
--
make -C /OE/build/oe-core/tmp/work/core2-64-oe-linux/xmlrpc-c/1.60.03/git/stable/lib/libutil/
-f /OE/build/oe-core/tmp/work/core2-64-oe-linux/xmlrpc-c/1.60.03/git/stable/lib/libutil/Makefile
\
    libxmlrpc_util.so
--
make -C /OE/build/oe-core/tmp/work/core2-64-oe-linux/xmlrpc-c/1.60.03/git/stable/lib/libutil/
-f /OE/build/oe-core/tmp/work/core2-64-oe-linux/xmlrpc-c/1.60.03/git/stable/lib/libutil/Makefile
\
    libxmlrpc_util.so
--
make -C /OE/build/oe-core/tmp/work/core2-64-oe-linux/xmlrpc-c/1.60.03/git/stable/lib/libutil/
-f /OE/build/oe-core/tmp/work/core2-64-oe-linux/xmlrpc-c/1.60.03/git/stable/lib/libutil/Makefile
\
    libxmlrpc_util.so
--
make -C /OE/build/oe-core/tmp/work/core2-64-oe-linux/xmlrpc-c/1.60.03/git/stable/lib/libutil/
-f /OE/build/oe-core/tmp/work/core2-64-oe-linux/xmlrpc-c/1.60.03/git/stable/lib/libutil/Makefile
\
    libxmlrpc_util.so
--
make -C /OE/build/oe-core/tmp/work/core2-64-oe-linux/xmlrpc-c/1.60.03/git/stable/lib/libutil/
-f /OE/build/oe-core/tmp/work/core2-64-oe-linux/xmlrpc-c/1.60.03/git/stable/lib/libutil/Makefile
\
    libxmlrpc_util.so
--
make -C /OE/build/oe-core/tmp/work/core2-64-oe-linux/xmlrpc-c/1.60.03/git/stable/lib/libutil/
-f /OE/build/oe-core/tmp/work/core2-64-oe-linux/xmlrpc-c/1.60.03/git/stable/lib/libutil/Makefile
\
    libxmlrpc_util.so
--
make -C /OE/build/oe-core/tmp/work/core2-64-oe-linux/xmlrpc-c/1.60.03/git/stable/lib/libutil/
-f /OE/build/oe-core/tmp/work/core2-64-oe-linux/xmlrpc-c/1.60.03/git/stable/lib/libutil/Makefile
\
    libxmlrpc_util.so
--
make -C /OE/build/oe-core/tmp/work/core2-64-oe-linux/xmlrpc-c/1.60.03/git/stable/lib/libutil/
-f /OE/build/oe-core/tmp/work/core2-64-oe-linux/xmlrpc-c/1.60.03/git/stable/lib/libutil/Makefile
\
    libxmlrpc_util.so
--
make -C /OE/build/oe-core/tmp/work/core2-64-oe-linux/xmlrpc-c/1.60.03/git/stable/lib/libutil/
-f /OE/build/oe-core/tmp/work/core2-64-oe-linux/xmlrpc-c/1.60.03/git/stable/lib/libutil/Makefile
\
    libxmlrpc_util.so

On Sun, Nov 3, 2024 at 11:48 AM Martin Jansa via
lists.openembedded.org <martin.jansa=gmail.com@lists.openembedded.org>
wrote:
>
> Looks like I spoke too soon, got the same build failure 3 more times
> in last 2 days.
>
> rm -f libxmlrpc_util.so.4 && ln -s libxmlrpc_util.so.4.60 libxmlrpc_util.so.4
> rm -f xmlrpc_util++.pc
> rm -f libxmlrpc_util.so && ln -s libxmlrpc_util.so.4 libxmlrpc_util.so
> Echoes to 'xmlrpc_util++.pc' suppressed here ...
> make[3]: Entering directory 'xmlrpc-c/1.60.03/git/stable/lib/libutil'
> rm -f libxmlrpc_util.so && ln -s libxmlrpc_util.so.4 libxmlrpc_util.so
> make[3]: Leaving directory 'xmlrpc-c/1.60.03/git/stable/lib/libutil'
> ln: failed to create symbolic link 'libxmlrpc_util.so': File exists
> make[3]: *** [xmlrpc-c/1.60.03/git/stable/unix-common.mk:65:
> libxmlrpc_util.so] Error 1
>
> Looks like it calls:
>
> make -C xmlrpc-c/1.60.03/git/stable/lib/libutil/ -f
> xmlrpc-c/1.60.03/git/stable/lib/libutil/Makefile \
>     libxmlrpc_util.so
>
> twice and the added && isn't enough to avoid the race between the 2.
>
> On Sun, Oct 27, 2024 at 10:40 PM Martin Jansa via
> lists.openembedded.org <martin.jansa=gmail.com@lists.openembedded.org>
> wrote:
> >
> > Acked-by: Martin Jansa <Martin.Jansa@gmail.com>
> >
> > Thanks Khem!
> >
> > On Thu, Oct 17, 2024 at 8:17 AM Khem Raj <raj.khem@gmail.com> wrote:
> > >
> > > This should fix race condition sometime seen in highly parallell builds
> > >
> > >    | rm -f libxmlrpc_util.so.4
> > >    | rm -f libxmlrpc_util.so.4
> > >    | ln -s libxmlrpc_util.so.4.60 libxmlrpc_util.so.4
> > >    | ln -s libxmlrpc_util.so.4.60 libxmlrpc_util.so.4
> > >    | rm -f libxmlrpc_util.so
> > >    | ln: failed to create symbolic link 'libxmlrpc_util.so.4': File exists
> > >    | make[2]: *** [/home/kraj01/yoe/build/tmp/work/core2-64-yoe-linux/xmlrpc-c/1.60.03/git/stable/unix-common.mk:72: libxmlrpc_util.so.4] Error 1
> > >
> > > Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > > Cc: Martin Jansa <Martin.Jansa@gmail.com>
> > > ---
> > >  ...nsuring-Sequential-Execution-of-rm-a.patch | 46 +++++++++++++++++++
> > >  .../xmlrpc-c/xmlrpc-c_1.60.03.bb              |  1 +
> > >  2 files changed, 47 insertions(+)
> > >  create mode 100644 meta-oe/recipes-devtools/xmlrpc-c/xmlrpc-c/0001-unix-common.mk-Ensuring-Sequential-Execution-of-rm-a.patch
> > >
> > > diff --git a/meta-oe/recipes-devtools/xmlrpc-c/xmlrpc-c/0001-unix-common.mk-Ensuring-Sequential-Execution-of-rm-a.patch b/meta-oe/recipes-devtools/xmlrpc-c/xmlrpc-c/0001-unix-common.mk-Ensuring-Sequential-Execution-of-rm-a.patch
> > > new file mode 100644
> > > index 0000000000..02b5244f3a
> > > --- /dev/null
> > > +++ b/meta-oe/recipes-devtools/xmlrpc-c/xmlrpc-c/0001-unix-common.mk-Ensuring-Sequential-Execution-of-rm-a.patch
> > > @@ -0,0 +1,46 @@
> > > +From c9bd05e8f0ad805b81625cfa717d06071cfd9b48 Mon Sep 17 00:00:00 2001
> > > +From: Khem Raj <raj.khem@gmail.com>
> > > +Date: Wed, 16 Oct 2024 22:52:38 -0700
> > > +Subject: [PATCH] unix-common.mk: Ensuring Sequential Execution of rm and ln commands
> > > +
> > > +With high parallel execution, it results in race condition where
> > > +its trying to create symlink while the original symlink while rm is
> > > +not done deleting the existing file yet.
> > > +
> > > +force sequential execution by adding dependencies between the steps
> > > +or combining them into a single shell command
> > > +
> > > +Here, && ensures that the ln -s command only runs after rm -f target
> > > +successfully completes.
> > > +
> > > +Similar error reported here [1]
> > > +
> > > +[1] https://bugs.gentoo.org/932835
> > > +
> > > +Upstream-Status: Pending
> > > +Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > > +---
> > > + unix-common.mk | 6 ++----
> > > + 1 file changed, 2 insertions(+), 4 deletions(-)
> > > +
> > > +diff --git a/unix-common.mk b/unix-common.mk
> > > +index 6954faf5..983c48cd 100644
> > > +--- a/unix-common.mk
> > > ++++ b/unix-common.mk
> > > +@@ -62,14 +62,12 @@ SHLIB_CMD = $(CCLD) $(LADD) $(LDFLAGS_SHLIB) -o $@ $^
> > > + SHLIB_LE_TARGETS = $(call shliblefn, $(SHARED_LIBS_TO_BUILD))
> > > +
> > > + $(SHLIB_LE_TARGETS):%:%.$(MAJ)
> > > +-      rm -f $@
> > > +-      $(LN_S) $< $@
> > > ++      rm -f $@ && $(LN_S) $< $@
> > > +
> > > + SONAME_TARGETS = $(SHLIB_LE_TARGETS:%=%.$(MAJ))
> > > +
> > > + $(SONAME_TARGETS):%:%.$(MIN)
> > > +-      rm -f $@
> > > +-      $(LN_S) $< $@
> > > ++      rm -f $@ && $(LN_S) $< $@
> > > +
> > > + .PHONY: $(SHLIB_INSTALL_TARGETS)
> > > + .PHONY: install-shared-libraries
> > > diff --git a/meta-oe/recipes-devtools/xmlrpc-c/xmlrpc-c_1.60.03.bb b/meta-oe/recipes-devtools/xmlrpc-c/xmlrpc-c_1.60.03.bb
> > > index a34256c275..f5ee920cad 100644
> > > --- a/meta-oe/recipes-devtools/xmlrpc-c/xmlrpc-c_1.60.03.bb
> > > +++ b/meta-oe/recipes-devtools/xmlrpc-c/xmlrpc-c_1.60.03.bb
> > > @@ -7,6 +7,7 @@ LIC_FILES_CHKSUM = "file://doc/COPYING;md5=aefbf81ba0750f02176b6f86752ea951"
> > >
> > >  SRC_URI = "git://github.com/mirror/xmlrpc-c.git;branch=master;protocol=https \
> > >             file://0001-test-cpp-server_abyss-Fix-build-with-clang-libc.patch \
> > > +           file://0001-unix-common.mk-Ensuring-Sequential-Execution-of-rm-a.patch \
> > >             "
> > >  # one more commit after Release 1.60.03 in the Stable series
> > >  SRCREV = "a823b0bb5cf0a4dbd34f929cbfdfb0439c5d9b0e"
> >
> >
> >
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#113395): https://lists.openembedded.org/g/openembedded-devel/message/113395
> Mute This Topic: https://lists.openembedded.org/mt/109059191/3617156
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [martin.jansa@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/meta-oe/recipes-devtools/xmlrpc-c/xmlrpc-c/0001-unix-common.mk-Ensuring-Sequential-Execution-of-rm-a.patch b/meta-oe/recipes-devtools/xmlrpc-c/xmlrpc-c/0001-unix-common.mk-Ensuring-Sequential-Execution-of-rm-a.patch
new file mode 100644
index 0000000000..02b5244f3a
--- /dev/null
+++ b/meta-oe/recipes-devtools/xmlrpc-c/xmlrpc-c/0001-unix-common.mk-Ensuring-Sequential-Execution-of-rm-a.patch
@@ -0,0 +1,46 @@ 
+From c9bd05e8f0ad805b81625cfa717d06071cfd9b48 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 16 Oct 2024 22:52:38 -0700
+Subject: [PATCH] unix-common.mk: Ensuring Sequential Execution of rm and ln commands
+
+With high parallel execution, it results in race condition where
+its trying to create symlink while the original symlink while rm is
+not done deleting the existing file yet.
+
+force sequential execution by adding dependencies between the steps
+or combining them into a single shell command
+
+Here, && ensures that the ln -s command only runs after rm -f target
+successfully completes.
+
+Similar error reported here [1]
+
+[1] https://bugs.gentoo.org/932835
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ unix-common.mk | 6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/unix-common.mk b/unix-common.mk
+index 6954faf5..983c48cd 100644
+--- a/unix-common.mk
++++ b/unix-common.mk
+@@ -62,14 +62,12 @@ SHLIB_CMD = $(CCLD) $(LADD) $(LDFLAGS_SHLIB) -o $@ $^
+ SHLIB_LE_TARGETS = $(call shliblefn, $(SHARED_LIBS_TO_BUILD))
+ 
+ $(SHLIB_LE_TARGETS):%:%.$(MAJ)
+-	rm -f $@
+-	$(LN_S) $< $@
++	rm -f $@ && $(LN_S) $< $@
+ 
+ SONAME_TARGETS = $(SHLIB_LE_TARGETS:%=%.$(MAJ))
+ 
+ $(SONAME_TARGETS):%:%.$(MIN)
+-	rm -f $@
+-	$(LN_S) $< $@
++	rm -f $@ && $(LN_S) $< $@
+ 
+ .PHONY: $(SHLIB_INSTALL_TARGETS)
+ .PHONY: install-shared-libraries
diff --git a/meta-oe/recipes-devtools/xmlrpc-c/xmlrpc-c_1.60.03.bb b/meta-oe/recipes-devtools/xmlrpc-c/xmlrpc-c_1.60.03.bb
index a34256c275..f5ee920cad 100644
--- a/meta-oe/recipes-devtools/xmlrpc-c/xmlrpc-c_1.60.03.bb
+++ b/meta-oe/recipes-devtools/xmlrpc-c/xmlrpc-c_1.60.03.bb
@@ -7,6 +7,7 @@  LIC_FILES_CHKSUM = "file://doc/COPYING;md5=aefbf81ba0750f02176b6f86752ea951"
 
 SRC_URI = "git://github.com/mirror/xmlrpc-c.git;branch=master;protocol=https \
            file://0001-test-cpp-server_abyss-Fix-build-with-clang-libc.patch \
+           file://0001-unix-common.mk-Ensuring-Sequential-Execution-of-rm-a.patch \
            "
 # one more commit after Release 1.60.03 in the Stable series
 SRCREV = "a823b0bb5cf0a4dbd34f929cbfdfb0439c5d9b0e"