diff mbox series

[RFC] bash: Drop /bin/sh from RPROVIDES

Message ID 20250123201229.182266-1-marex@denx.de
State New
Headers show
Series [RFC] bash: Drop /bin/sh from RPROVIDES | expand

Commit Message

Marek Vasut Jan. 23, 2025, 8:12 p.m. UTC
Remove /bin/sh from bash RPROVIDES as this has a side-effect which
confuses rpm package manager when also busybox provides /bin/sh and
base-files depend on /bin/sh . The problem is broken down below.

First, bash depends on base-files and bash pkg_postinst must run
after base-files was installed, because it requires /etc/shells
provided by base-files to be in place.

Second, base-files depends on /bin/sh, which is provided by either
bash or busybox in this case. This is the actual problem here, if
bash is selected as /bin/sh provider, then there is cyclic dependency
between bash and base-files, and that confuses dnf which may install
the packages in the wrong order, bash first and base-files second .

To make this worse, if busybox is also /bin/sh provider, it can and
does happen that some systems pick busybox as the /bin/sh provider,
while others pick bash as the /bin/sh provider, and that cyclic
dependency does not always appear.

Attempt to break this dependency, drop RPROVIDES /bin/sh from bash
recipe to always force base-files to pick /bin/sh from busybox .
(I am really unsure about this approach)

Signed-off-by: Marek Vasut <marex@denx.de>
---
Cc: Alexander Kanavin <alex@linutronix.de>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 meta/recipes-extended/bash/bash.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Khem Raj Jan. 23, 2025, 9:18 p.m. UTC | #1
On Thu, Jan 23, 2025 at 12:12 PM Marek Vasut via
lists.openembedded.org <marex=denx.de@lists.openembedded.org> wrote:
>
> Remove /bin/sh from bash RPROVIDES as this has a side-effect which
> confuses rpm package manager when also busybox provides /bin/sh and
> base-files depend on /bin/sh . The problem is broken down below.
>
> First, bash depends on base-files and bash pkg_postinst must run
> after base-files was installed, because it requires /etc/shells
> provided by base-files to be in place.
>
> Second, base-files depends on /bin/sh, which is provided by either
> bash or busybox in this case. This is the actual problem here, if
> bash is selected as /bin/sh provider, then there is cyclic dependency
> between bash and base-files, and that confuses dnf which may install
> the packages in the wrong order, bash first and base-files second .
>
> To make this worse, if busybox is also /bin/sh provider, it can and
> does happen that some systems pick busybox as the /bin/sh provider,
> while others pick bash as the /bin/sh provider, and that cyclic
> dependency does not always appear.
>
> Attempt to break this dependency, drop RPROVIDES /bin/sh from bash
> recipe to always force base-files to pick /bin/sh from busybox .
> (I am really unsure about this approach)
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> ---
> Cc: Alexander Kanavin <alex@linutronix.de>
> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
> Cc: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
>  meta/recipes-extended/bash/bash.inc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meta/recipes-extended/bash/bash.inc b/meta/recipes-extended/bash/bash.inc
> index 634209c9115..6a061b8a612 100644
> --- a/meta/recipes-extended/bash/bash.inc
> +++ b/meta/recipes-extended/bash/bash.inc
> @@ -134,4 +134,4 @@ FILES:${PN}-loadable += "${libdir}/bash/*"
>
>  # Limit the RPROVIDES here to class target so that if usrmerge is enabled for nativesdk, it does not
>  # include host system paths in /bin/
> -RPROVIDES:${PN}:append:class-target = " ${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '/bin/sh /bin/bash', '', d)}"
> +RPROVIDES:${PN}:append:class-target = " ${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '/bin/bash', '', d)}"

Does this now mean that system will always need busybox ? some distros
may not want that and simply use
other variants to fill in the shoes. I wonder if shell choice could be
a distro option or image feature which can then
help sort this out ?

> --
> 2.45.2
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#210212): https://lists.openembedded.org/g/openembedded-core/message/210212
> Mute This Topic: https://lists.openembedded.org/mt/110778651/1997914
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/meta/recipes-extended/bash/bash.inc b/meta/recipes-extended/bash/bash.inc
index 634209c9115..6a061b8a612 100644
--- a/meta/recipes-extended/bash/bash.inc
+++ b/meta/recipes-extended/bash/bash.inc
@@ -134,4 +134,4 @@  FILES:${PN}-loadable += "${libdir}/bash/*"
 
 # Limit the RPROVIDES here to class target so that if usrmerge is enabled for nativesdk, it does not
 # include host system paths in /bin/
-RPROVIDES:${PN}:append:class-target = " ${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '/bin/sh /bin/bash', '', d)}"
+RPROVIDES:${PN}:append:class-target = " ${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '/bin/bash', '', d)}"