Skip to contentSkip to conversation

package/busybox: disable setfattr when attr package is enabled

PATCH New Yann E. MORIN 2 participants 4 messages May 4, 2018 – May 5, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/busybox: disable setfattr when attr package is enabled

The install procedure of attr is kinda borked: it does not unlink any existing destination file during installation, but directly wites into it. So, when busybox is instaleld before attr and installs its applets as hardlinks, attr will overwrite the setfattr file, thus borking the busybox binary and all its applets.

So, when the attr package is enabled, we disable the setfattr applet.

Fixes #10986.
Reported-by mzweerspenko+bugzilla at gmail.com
Cc mzweerspenko+bugzilla at gmail.com
---
 package/busybox/busybox.mk | 9 +++++++++
 1 file changed, 9 insertions(+)
package/busybox/busybox.mk +9 -0
index 60a55a2c78..5f4b18e47f 100644
@@ -254,6 +254,14 @@ define BUSYBOX_LINUX_PAM
 endef
 endif
 
+# attr's install procedure is borked and overwrites any existing
+# destination file. So, disable conflicting applets in that case
+ifeq ($(BR2_PACKAGE_ATTR),y)
+define BUSYBOX_DISABLE_ATTR
+	$(call KCONFIG_DISABLE_OPT,CONFIG_SETFATTR,$(BUSYBOX_BUILD_CONFIG))
+endef
+endif
+
 # Telnet support
 define BUSYBOX_INSTALL_TELNET_SCRIPT
 	if grep -q CONFIG_FEATURE_TELNETD_STANDALONE=y $(@D)/.config; then \
@@ -294,6 +302,7 @@ define BUSYBOX_KCONFIG_FIXUP_CMDS
 	$(BUSYBOX_SET_SELINUX)
 	$(BUSYBOX_SET_INDIVIDUAL_BINARIES)
 	$(BUSYBOX_MUSL_TWEAKS)
+	$(BUSYBOX_DISABLE_ATTR)
 endef
 
 define BUSYBOX_CONFIGURE_CMDS
Signature · 1 line
2.14.1
#1 lore raw

PATCH 1/1 package/busybox: disable setfattr when attr package is enabled

Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

The install procedure of attr is kinda borked: it does not unlink any existing destination file during installation, but directly wites into it. So, when busybox is instaleld before attr and installs its applets as hardlinks, attr will overwrite the setfattr file, thus borking the busybox binary and all its applets.

Quoted 7 lines

So, when the attr package is enabled, we disable the setfattr applet.

Fixes #10986.
Reported-by mzweerspenko+bugzilla at gmail.com
Cc mzweerspenko+bugzilla at gmail.com

It would be nicer to instead fix the attr build system. I took a quick look, and the problem seems to be that installation is done with their own install-sh script which uses cp (and no --remove-destination).

I *THINK* a fix would just be to change the 'INSTALL =' line in include/buildmacros to use normal install instead of this install-sh script.

Could you give that a try?

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

PATCH 1/1 package/busybox: disable setfattr when attr package is enabled

Peter, All,

On 2018-05-05 13:48 +0200, Peter Korsgaard spake thusly:

Quoted 20 lines
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

The install procedure of attr is kinda borked: it does not unlink any existing destination file during installation, but directly wites into it. So, when busybox is instaleld before attr and installs its applets as hardlinks, attr will overwrite the setfattr file, thus borking the busybox binary and all its applets.

Quoted 7 lines

So, when the attr package is enabled, we disable the setfattr applet.

Fixes #10986.
Reported-by mzweerspenko+bugzilla at gmail.com
Cc mzweerspenko+bugzilla at gmail.com

It would be nicer to instead fix the attr build system. I took a quick look, and the problem seems to be that installation is done with their own install-sh script which uses cp (and no --remove-destination).

Quoted 5 lines

I *THINK* a fix would just be to change the 'INSTALL =' line in include/buildmacros to use normal install instead of this install-sh script.

Could you give that a try?

I'm first going to bump to the latest version, 2.4.48 (from 2.4.47), because 2.4.48 has had a complete overhaul of its buildsystem.

If that gets too comples, then I'll try to fix the current attr code.

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#3 lore raw

PATCH 1/1 package/busybox: disable setfattr when attr package is enabled

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

Hi,

Quoted 8 lines
Quoted 8 lines

It would be nicer to instead fix the attr build system. I took a quick look, and the problem seems to be that installation is done with their own install-sh script which uses cp (and no --remove-destination).

I *THINK* a fix would just be to change the 'INSTALL =' line in include/buildmacros to use normal install instead of this install-sh script.

Quoted 6 lines
Quoted 1 line

Could you give that a try?

I'm first going to bump to the latest version, 2.4.48 (from 2.4.47), because 2.4.48 has had a complete overhaul of its buildsystem.

If that gets too comples, then I'll try to fix the current attr code.

Ok, thanks!

Signature · 1 line
Bye, Peter Korsgaard