Skip to contentSkip to conversation

busybox: preserve ncurses progs/tools

PATCH New Matt Weber 5 participants 13 messages Apr 14, 2017 – Apr 24, 2017

lore
Share & tools
lore

Matt Weber

author
#0 lore raw

PATCH 1/1 busybox: preserve ncurses progs/tools

The ncurses package installs a full version of clear and reset(tset) tools. Preserve these by disabling the options in the busybox config file. This removes the need for ncurses to depend on busybox for solely ordering of target install.

This commit resolves the following python circular dependency with python. busybox -> libselinux -> python3 -> ncurses -> busybox

Fixes:
http://autobuild.buildroot.net/results/db1/db1e6f3054092fc5576ccab8e04a3b9d74ca9a8c/

---
 package/busybox/busybox.mk | 12 ++++++++++++
 package/ncurses/ncurses.mk |  5 -----
 2 files changed, 12 insertions(+), 5 deletions(-)
package/busybox/busybox.mk +12 -0
index f9dacc7..b159b44 100644
@@ -148,6 +148,17 @@ define BUSYBOX_MUSL_TWEAKS
 endef
 endif
 
+ifeq ($(BR2_PACKAGE_NCURSES_TARGET_PROGS),y)
+# Ncurses package overlaps:
+#     /usr/bin/clear
+#     /usr/bin/reset -> /usr/bin/tset (symlink)
+#
+define BUSYBOX_NCURSE_PROGS_TWEAKS
+	$(call KCONFIG_DISABLE_OPT,CONFIG_CLEAR,$(BUSYBOX_BUILD_CONFIG))
+	$(call KCONFIG_DISABLE_OPT,CONFIG_RESET,$(BUSYBOX_BUILD_CONFIG))
+endef
+endif
+
 define BUSYBOX_INSTALL_UDHCPC_SCRIPT
 	if grep -q CONFIG_UDHCPC=y $(@D)/.config; then \
 		$(INSTALL) -m 0755 -D package/busybox/udhcpc.script \
@@ -229,6 +240,7 @@ define BUSYBOX_KCONFIG_FIXUP_CMDS
 	$(BUSYBOX_SET_WATCHDOG)
 	$(BUSYBOX_SET_SELINUX)
 	$(BUSYBOX_MUSL_TWEAKS)
+	$(BUSYBOX_NCURSE_PROGS_TWEAKS)
 endef
 
 define BUSYBOX_CONFIGURE_CMDS
package/ncurses/ncurses.mk +0 -5
index 68c77ac..2b99d3f 100644
@@ -29,11 +29,6 @@ NCURSES_CONF_OPTS = \
 	$(if $(BR2_PACKAGE_NCURSES_TARGET_PROGS),,--without-progs) \
 	--without-manpages
 
-# Install after busybox for the full-blown versions
-ifeq ($(BR2_PACKAGE_BUSYBOX),y)
-NCURSES_DEPENDENCIES += busybox
-endif
-
 ifeq ($(BR2_STATIC_LIBS),y)
 NCURSES_CONF_OPTS += --without-shared --with-normal
 else ifeq ($(BR2_SHARED_LIBS),y)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 busybox: preserve ncurses progs/tools

Hello,

Quoted 1 line · Matt Weber

+define BUSYBOX_NCURSE_PROGS_TWEAKS

I've changed the name of this variable to:

BUSYBOX_DISABLE_NCURSES_PROGS

and applied. Thanks a lot!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#2 lore raw

PATCH 1/1 busybox: preserve ncurses progs/tools

Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Hello,
On Thu, 13 Apr 2017 22:20:47 -0500, Matt Weber wrote:

Quoted 7 lines
Quoted 1 line

+define BUSYBOX_NCURSE_PROGS_TWEAKS

I've changed the name of this variable to:

BUSYBOX_DISABLE_NCURSES_PROGS

and applied. Thanks a lot!

Committed to 2017.02.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#3 lore raw

PATCH 1/1 busybox: preserve ncurses progs/tools

In reply to Matt Weber

This is the correct approach I think. I think we could also do this for all the
other cases where we have a -> busybox dependency just because they install the same apps.

Quoted 6 lines · Matt Weber

The ncurses package installs a full version of clear and reset(tset) tools. Preserve these by disabling the options in the busybox config file. This removes the need for ncurses to depend on busybox for solely ordering of target install.

This commit resolves the following python circular dependency with python.

"python circular dependency with python" is a bit circular :-) You can actually
enter the circle from any of these packages. So just "This commit resolves the following circular dependency".

It would be nice to add a defconfig fragment to show how to trigger the
circular dependency.

Quoted 6 lines

busybox -> libselinux -> python3 -> ncurses -> busybox

Fixes:
http://autobuild.buildroot.net/results/db1/db1e6f3054092fc5576ccab8e04a3b9d74ca9a8c/

Looks good to me, except for the variable naming...

Quoted 10 lines
---
 package/busybox/busybox.mk | 12 ++++++++++++
 package/ncurses/ncurses.mk |  5 -----
 2 files changed, 12 insertions(+), 5 deletions(-)
package/busybox/busybox.mk +0 -0
index f9dacc7..b159b44 100644

package/busybox/busybox.mk define BUSYBOX_MUSL_TWEAKS · line 155

Quoted 8 lines
package/busybox/busybox.mk +5 -0
@@ -148,6 +148,17 @@ define BUSYBOX_MUSL_TWEAKS
 endef
 endif
 
+ifeq ($(BR2_PACKAGE_NCURSES_TARGET_PROGS),y)
+# Ncurses package overlaps:
+#     /usr/bin/clear
+#     /usr/bin/reset -> /usr/bin/tset (symlink)
+#

I think the #-line is redundant.

package/busybox/busybox.mk define BUSYBOX_MUSL_TWEAKS · line 156

Quoted 1 line
package/busybox/busybox.mk +1 -0
+define BUSYBOX_NCURSE_PROGS_TWEAKS
                        ^S

But perhaps a better name is BUSYBOX_UNSET_NCURSES_PROGS

package/busybox/busybox.mk define BUSYBOX_KCONFIG_FIXUP_CMDS · line 243

Quoted 13 lines
package/busybox/busybox.mk +6 -0
+	$(call KCONFIG_DISABLE_OPT,CONFIG_CLEAR,$(BUSYBOX_BUILD_CONFIG))
+	$(call KCONFIG_DISABLE_OPT,CONFIG_RESET,$(BUSYBOX_BUILD_CONFIG))
+endef
+endif
+
 define BUSYBOX_INSTALL_UDHCPC_SCRIPT
 	if grep -q CONFIG_UDHCPC=y $(@D)/.config; then \
 		$(INSTALL) -m 0755 -D package/busybox/udhcpc.script \
@@ -229,6 +240,7 @@ define BUSYBOX_KCONFIG_FIXUP_CMDS
 	$(BUSYBOX_SET_WATCHDOG)
 	$(BUSYBOX_SET_SELINUX)
 	$(BUSYBOX_MUSL_TWEAKS)
+	$(BUSYBOX_NCURSE_PROGS_TWEAKS)
                        ^S

Regards,
Arnout

Quoted 20 lines
package/busybox/busybox.mk +0 -0
 endef
 
 define BUSYBOX_CONFIGURE_CMDS
package/ncurses/ncurses.mk +0 -5
index 68c77ac..2b99d3f 100644
@@ -29,11 +29,6 @@ NCURSES_CONF_OPTS = \
 	$(if $(BR2_PACKAGE_NCURSES_TARGET_PROGS),,--without-progs) \
 	--without-manpages
 
-# Install after busybox for the full-blown versions
-ifeq ($(BR2_PACKAGE_BUSYBOX),y)
-NCURSES_DEPENDENCIES += busybox
-endif
-
 ifeq ($(BR2_STATIC_LIBS),y)
 NCURSES_CONF_OPTS += --without-shared --with-normal
 else ifeq ($(BR2_SHARED_LIBS),y)
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#4 lore raw

PATCH 1/1 busybox: preserve ncurses progs/tools

Quoted 3 lines · Arnout Vandecappelle

This is the correct approach I think. I think we could also do this for all the
other cases where we have a -> busybox dependency just because they install the same apps.

Sorry, I was writing this on the train and hadn't seen Thomas's "Applied,
thanks" mail.

Please ignore.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#5 lore raw

PATCH 1/1 busybox: preserve ncurses progs/tools

In reply to Arnout Vandecappelle

Hello,

Quoted 3 lines · Arnout Vandecappelle

This is the correct approach I think. I think we could also do this for all the
other cases where we have a -> busybox dependency just because they install the same apps.

Yes, I'm also wondering if it isn't better to disable the Busybox applets (like Matt does in this patch for ncurses) rather then overwriting the symlinks.

First of all, overwriting the symlinks means that if you "make busybox-reinstall", you no longer get the right thing (for sure, we never guarantee that partial builds/rebuilds give the correct output, but it's nice when they do). And then of course, it means that there is code in Busybox, consuming some space, that is never used.

The only annoyance that I can see is a potential blotification of busybox.mk, with lots of conditional for various packages.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#6 lore raw

PATCH 1/1 busybox: preserve ncurses progs/tools

Thomas,

Quoted 8 lines · Thomas Petazzoni

Hello,

Quoted 3 lines · Arnout Vandecappelle

This is the correct approach I think. I think we could also do this for all the
other cases where we have a -> busybox dependency just because they install the same apps.

Quoted 8 lines

Yes, I'm also wondering if it isn't better to disable the Busybox applets (like Matt does in this patch for ncurses) rather then overwriting the symlinks.

First of all, overwriting the symlinks means that if you "make busybox-reinstall", you no longer get the right thing (for sure, we never guarantee that partial builds/rebuilds give the correct output, but it's nice when they do).

Actually, I think this situation is prevented by "busybox: enable noclobber option in install.sh",
https://git.buildroot.net/buildroot/commit/?id=802bff9c42376078f28aa49d3eab630120940eb0

But of course, the bloat factor is there regardless.

Danomi -

Quoted 17 lines

And then of course, it means that there is
code in Busybox, consuming some space, that is never used.

The only annoyance that I can see is a potential blotification of busybox.mk, with lots of conditional for various packages.

Best regards,

Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#7 lore raw

PATCH 1/1 busybox: preserve ncurses progs/tools

In reply to Thomas Petazzoni
Quoted 13 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Hello,

Quoted 3 lines · Arnout Vandecappelle

This is the correct approach I think. I think we could also do this for all the other cases where we have a -> busybox dependency just because they install the same apps.

Yes, I'm also wondering if it isn't better to disable the Busybox applets (like Matt does in this patch for ncurses) rather then overwriting the symlinks.

Quoted 8 lines

First of all, overwriting the symlinks means that if you "make busybox-reinstall", you no longer get the right thing (for sure, we never guarantee that partial builds/rebuilds give the correct output, but it's nice when they do). And then of course, it means that there is code in Busybox, consuming some space, that is never used.

The only annoyance that I can see is a potential blotification of busybox.mk, with lots of conditional for various packages.

That and the fact that we're adding more "magic" to silently override the configuration behind the users' back. I get it that people may be less likely to tweak their busybox config than E.G. the kernel, but just like for the kernel config I prefer to keep the config overrides to the minimum.

Signature · 1 line
Bye, Peter Korsgaard
#8 lore raw

PATCH 1/1 busybox: preserve ncurses progs/tools

Quoted 19 lines · Peter Korsgaard
Quoted 18 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Hello,

Quoted 3 lines · Arnout Vandecappelle

This is the correct approach I think. I think we could also do this for all the other cases where we have a -> busybox dependency just because they install the same apps.

Yes, I'm also wondering if it isn't better to disable the Busybox applets (like Matt does in this patch for ncurses) rather then overwriting the symlinks.

First of all, overwriting the symlinks means that if you "make busybox-reinstall", you no longer get the right thing (for sure, we never guarantee that partial builds/rebuilds give the correct output, but it's nice when they do). And then of course, it means that there is code in Busybox, consuming some space, that is never used.

Quoted 8 lines
Quoted 2 lines

The only annoyance that I can see is a potential blotification of busybox.mk, with lots of conditional for various packages.

That and the fact that we're adding more "magic" to silently override the configuration behind the users' back. I get it that people may be less likely to tweak their busybox config than E.G. the kernel, but just like for the kernel config I prefer to keep the config overrides to the minimum.

Well, we are "overriding" the user's busybox config, but since the alternative
is deleting the busybox-installed tool, whatever the user has configured is not available anyway...

Well, except that it still is available by calling it as "busybox clear".

So, the choice comes down to:

1. Add a dependency on busybox like we do now, but it's actually a fake dependency and can lead to circular dependencies. And it's anyway not failsafe because a "busybox-rebuild" will again overwrite it. On addition, it has the bloatification that Thomas mentions.

2. Make sure that busybox doesn't overwrite a tool that already exists. Needs to be done for all the different ways that busybox can install things. Then the order doesn't matter. Great solution, except for the bloatification. Also, it is not great when you have FEATURE_INDIVIDUAL selected in busybox, because a busybox-rebuild will not actually rebuild anything.

3. Like proposed in this patch, adapt busybox config. Has the advantage of no bloatification, but it means that the user sees his own config overridden which isn't nice. In addition, it's quite ugly for the busybox.mk to have all these references to other packages (about 40!).

Of course, we can also choose to apply solution 3 only to the situation where 1
doesn't work because of circular dependencies.

I can't say which solution is the best. I therefore tend to say: stick to what
we have, and find a workaround if needed. In other words, apply this patch, but don't do it for other packages until required.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#9 lore raw

PATCH 1/1 busybox: preserve ncurses progs/tools

Arnout,

Quoted 5 lines · Arnout Vandecappelle

2. Make sure that busybox doesn't overwrite a tool that already exists. Needs to be done for all the different ways that busybox can install things. Then the order doesn't matter. Great solution, except for the bloatification. Also, it is not great when you have FEATURE_INDIVIDUAL selected in busybox, because a busybox-rebuild will not actually rebuild anything.

Does https://git.buildroot.net/buildroot/commit/?id=802bff9c42376078f28aa49d3eab630120940eb0
not take care of overwriting tools that already exist?

Danomi -

#10 lore raw

PATCH 1/1 busybox: preserve ncurses progs/tools

Quoted 11 lines · Danomi Manchego

Arnout,

Quoted 5 lines · Arnout Vandecappelle

2. Make sure that busybox doesn't overwrite a tool that already exists. Needs to be done for all the different ways that busybox can install things. Then the order doesn't matter. Great solution, except for the bloatification. Also, it is not great when you have FEATURE_INDIVIDUAL selected in busybox, because a busybox-rebuild will not actually rebuild anything.

Does https://git.buildroot.net/buildroot/commit/?id=802bff9c42376078f28aa49d3eab630120940eb0
not take care of overwriting tools that already exist?

Hey, I missed that one! So, that means that the dependencies on busybox are in
fact redundant, right? So we could actually revert the busybox.mk part of 33c72344a? Yep, tried that, I'll send a patch.

So in fact, we can remove all dependencies on busybox? That's nice!

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#11 lore raw

PATCH 1/1 busybox: preserve ncurses progs/tools

In reply to Arnout Vandecappelle
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Arnout" == Arnout Vandecappelle <[email protected]> writes:

Hi,

Quoted 6 lines

Of course, we can also choose to apply solution 3 only to the situation where 1
doesn't work because of circular dependencies.

I can't say which solution is the best. I therefore tend to say: stick to what
we have, and find a workaround if needed. In other words, apply this patch, but don't do it for other packages until required.

I'm in the same boat - So agreed!

Signature · 1 line
Bye, Peter Korsgaard
#12 lore raw

PATCH 1/1 busybox: preserve ncurses progs/tools

Quoted 4 lines · Peter Korsgaard
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Arnout" == Arnout Vandecappelle <[email protected]> writes:

Hi,

Quoted 8 lines
Quoted 6 lines

Of course, we can also choose to apply solution 3 only to the situation where 1
doesn't work because of circular dependencies.

I can't say which solution is the best. I therefore tend to say: stick to what
we have, and find a workaround if needed. In other words, apply this patch, but don't do it for other packages until required.

I'm in the same boat - So agreed!

Well, as Danomi indicated, the current situation is in fact choice 2 (busybox
doesn't overwrite the apps so the order doesn't matter) and not choice 1. So in fact we can simply remove all the dependencies on busybox.

Anyone feel up to it?

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF