Skip to contentSkip to conversation

busybox: Enable long options for enabled applets

PATCH Superseded Khem Raj 2 participants 6 messages Apr 28, 2021 – Apr 30, 2021

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 busybox: Enable long options for enabled applets

certain applets are enabled but the long options are not enabled for them, it results in subtle failures in ptests where its expecting these options e.g. gzip --best is commonly used in many package tests e.g.

root@qemux86-64:/usr/lib# grep -r "\-\-best" *
acl/ptest/Makefile:GZIP_ENV = --best
attr/ptest/Makefile:GZIP_ENV = --best
coreutils/ptest/Makefile:GZIP_ENV = --best
ethtool/ptest/Makefile:GZIP_ENV = --best
libxml2/ptest/Makefile:GZIP_ENV = --best
lttng-tools/ptest/Makefile:GZIP_ENV = --best
opkg/ptest/Makefile:GZIP_ENV = --best
perl/ptest/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm:    COMPRESS     ('gzip --best')
python3.9/test/test_gzip.py:        for compress_level in ('--fast', '--best'):
...

this ensures that these options are enabled by default, which makes them more compatible than now with coreutils provided utilities

busybox size grows by 4K which perhaps is acceptable

--rwxr-xr-x root       root           817704 ./bin/busybox.nosuid
+-rwxr-xr-x root       root           821800 ./bin/busybox.nosuid

This makes autopoint-3/gettext pass

---
 meta/recipes-core/busybox/busybox/getopts.cfg | 7 +++++++
 1 file changed, 7 insertions(+)
meta/recipes-core/busybox/busybox/getopts.cfg +7 -0
index 8db0a4a8f2..aeb5ac691f 100644
@@ -1,3 +1,10 @@
 CONFIG_GETOPT=y
 CONFIG_LONG_OPTS=y
 CONFIG_FEATURE_GETOPT_LONG=y
+CONFIG_FEATURE_GZIP_LONG_OPTIONS=y
+CONFIG_FEATURE_TAR_LONG_OPTIONS=y
+CONFIG_FEATURE_CHOWN_LONG_OPTIONS=y
+CONFIG_FEATURE_CP_LONG_OPTIONS=y
+CONFIG_FEATURE_INSTALL_LONG_OPTIONS=y
+CONFIG_FEATURE_DIFF_LONG_OPTIONS=y
+CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS=y
Signature · 1 line
2.31.1
#1 lore raw
Quoted 37 lines · Khem Raj

certain applets are enabled but the long options are not enabled for them, it results in subtle failures in ptests where its expecting these options e.g. gzip --best is commonly used in many package tests e.g.

root@qemux86-64:/usr/lib# grep -r "\-\-best" *
acl/ptest/Makefile:GZIP_ENV = --best
attr/ptest/Makefile:GZIP_ENV = --best
coreutils/ptest/Makefile:GZIP_ENV = --best
ethtool/ptest/Makefile:GZIP_ENV = --best
libxml2/ptest/Makefile:GZIP_ENV = --best
lttng-tools/ptest/Makefile:GZIP_ENV = --best
opkg/ptest/Makefile:GZIP_ENV = --best
perl/ptest/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm:    COMPRESS     ('gzip --best')
python3.9/test/test_gzip.py:        for compress_level in ('--fast', '--best'):
...

this ensures that these options are enabled by default, which makes them more compatible than now with coreutils provided utilities

busybox size grows by 4K which perhaps is acceptable

--rwxr-xr-x root       root           817704 ./bin/busybox.nosuid
+-rwxr-xr-x root       root           821800 ./bin/busybox.nosuid

This makes autopoint-3/gettext pass

---
 meta/recipes-core/busybox/busybox/getopts.cfg | 7 +++++++
 1 file changed, 7 insertions(+)
meta/recipes-core/busybox/busybox/getopts.cfg +0 -0
index 8db0a4a8f2..aeb5ac691f 100644

meta/recipes-core/busybox/busybox/getopts.cfg line 10

Quoted 10 lines
meta/recipes-core/busybox/busybox/getopts.cfg +7 -0
@@ -1,3 +1,10 @@
 CONFIG_GETOPT=y
 CONFIG_LONG_OPTS=y
 CONFIG_FEATURE_GETOPT_LONG=y
+CONFIG_FEATURE_GZIP_LONG_OPTIONS=y
+CONFIG_FEATURE_TAR_LONG_OPTIONS=y
+CONFIG_FEATURE_CHOWN_LONG_OPTIONS=y
+CONFIG_FEATURE_CP_LONG_OPTIONS=y
+CONFIG_FEATURE_INSTALL_LONG_OPTIONS=y
+CONFIG_FEATURE_DIFF_LONG_OPTIONS=y
+CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS=y

What's the connection between enabling the getopt applet (a utility to help with parsing options in shell scripts etc) and enabling support for long options in a bunch of other unconnected apps?

I think enabling support for long options in a particular app would be better done where that app is enabled (e.g. CONFIG_FEATURE_GZIP_LONG_OPTIONS should be enabled where CONFIG_GZIP is enabled - in the defconfig file).

author
#2 lore raw
Quoted 54 lines · Andre McCurdy
Quoted 37 lines · Khem Raj

certain applets are enabled but the long options are not enabled for them, it results in subtle failures in ptests where its expecting these options e.g. gzip --best is commonly used in many package tests e.g.

root@qemux86-64:/usr/lib# grep -r "\-\-best" *
acl/ptest/Makefile:GZIP_ENV = --best
attr/ptest/Makefile:GZIP_ENV = --best
coreutils/ptest/Makefile:GZIP_ENV = --best
ethtool/ptest/Makefile:GZIP_ENV = --best
libxml2/ptest/Makefile:GZIP_ENV = --best
lttng-tools/ptest/Makefile:GZIP_ENV = --best
opkg/ptest/Makefile:GZIP_ENV = --best
perl/ptest/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm:    COMPRESS     ('gzip --best')
python3.9/test/test_gzip.py:        for compress_level in ('--fast', '--best'):
...

this ensures that these options are enabled by default, which makes them more compatible than now with coreutils provided utilities

busybox size grows by 4K which perhaps is acceptable

--rwxr-xr-x root       root           817704 ./bin/busybox.nosuid
+-rwxr-xr-x root       root           821800 ./bin/busybox.nosuid

This makes autopoint-3/gettext pass

---
 meta/recipes-core/busybox/busybox/getopts.cfg | 7 +++++++
 1 file changed, 7 insertions(+)
meta/recipes-core/busybox/busybox/getopts.cfg +0 -0
index 8db0a4a8f2..aeb5ac691f 100644

meta/recipes-core/busybox/busybox/getopts.cfg line 10

Quoted 10 lines
meta/recipes-core/busybox/busybox/getopts.cfg +7 -0
@@ -1,3 +1,10 @@
 CONFIG_GETOPT=y
 CONFIG_LONG_OPTS=y
 CONFIG_FEATURE_GETOPT_LONG=y
+CONFIG_FEATURE_GZIP_LONG_OPTIONS=y
+CONFIG_FEATURE_TAR_LONG_OPTIONS=y
+CONFIG_FEATURE_CHOWN_LONG_OPTIONS=y
+CONFIG_FEATURE_CP_LONG_OPTIONS=y
+CONFIG_FEATURE_INSTALL_LONG_OPTIONS=y
+CONFIG_FEATURE_DIFF_LONG_OPTIONS=y
+CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS=y

What's the connection between enabling the getopt applet (a utility to help with parsing options in shell scripts etc) and enabling support for long options in a bunch of other unconnected apps?

Quoted 4 lines

I think enabling support for long options in a particular app would be better done where that app is enabled (e.g. CONFIG_FEATURE_GZIP_LONG_OPTIONS should be enabled where CONFIG_GZIP is enabled - in the defconfig file).

Right, these options are only enabling the options which are already enabled in defconfig.
we can move those options out into individual fragments and put the long option config together
as well. or we can just merge them into defconfig

author
#3 lore raw
In reply to Andre McCurdy
Quoted 54 lines · Andre McCurdy
Quoted 37 lines · Khem Raj

certain applets are enabled but the long options are not enabled for them, it results in subtle failures in ptests where its expecting these options e.g. gzip --best is commonly used in many package tests e.g.

root@qemux86-64:/usr/lib# grep -r "\-\-best" *
acl/ptest/Makefile:GZIP_ENV = --best
attr/ptest/Makefile:GZIP_ENV = --best
coreutils/ptest/Makefile:GZIP_ENV = --best
ethtool/ptest/Makefile:GZIP_ENV = --best
libxml2/ptest/Makefile:GZIP_ENV = --best
lttng-tools/ptest/Makefile:GZIP_ENV = --best
opkg/ptest/Makefile:GZIP_ENV = --best
perl/ptest/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm:    COMPRESS     ('gzip --best')
python3.9/test/test_gzip.py:        for compress_level in ('--fast', '--best'):
...

this ensures that these options are enabled by default, which makes them more compatible than now with coreutils provided utilities

busybox size grows by 4K which perhaps is acceptable

--rwxr-xr-x root       root           817704 ./bin/busybox.nosuid
+-rwxr-xr-x root       root           821800 ./bin/busybox.nosuid

This makes autopoint-3/gettext pass

---
 meta/recipes-core/busybox/busybox/getopts.cfg | 7 +++++++
 1 file changed, 7 insertions(+)
meta/recipes-core/busybox/busybox/getopts.cfg +0 -0
index 8db0a4a8f2..aeb5ac691f 100644

meta/recipes-core/busybox/busybox/getopts.cfg line 10

Quoted 10 lines
meta/recipes-core/busybox/busybox/getopts.cfg +7 -0
@@ -1,3 +1,10 @@
 CONFIG_GETOPT=y
 CONFIG_LONG_OPTS=y
 CONFIG_FEATURE_GETOPT_LONG=y
+CONFIG_FEATURE_GZIP_LONG_OPTIONS=y
+CONFIG_FEATURE_TAR_LONG_OPTIONS=y
+CONFIG_FEATURE_CHOWN_LONG_OPTIONS=y
+CONFIG_FEATURE_CP_LONG_OPTIONS=y
+CONFIG_FEATURE_INSTALL_LONG_OPTIONS=y
+CONFIG_FEATURE_DIFF_LONG_OPTIONS=y
+CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS=y

What's the connection between enabling the getopt applet (a utility to help with parsing options in shell scripts etc) and enabling support for long options in a bunch of other unconnected apps?

Quoted 4 lines

I think enabling support for long options in a particular app would be better done where that app is enabled (e.g. CONFIG_FEATURE_GZIP_LONG_OPTIONS should be enabled where CONFIG_GZIP is enabled - in the defconfig file).

I experimented a bit more and it seems that these options are tied to the corresponding feature being enabled
so they can be enabled in a fragment, unless the feature itself is enabled it will be ignored and disabled. So for
disabled features/applets these options are moot. So as such, I think enabling them is a good thing as it will
widen the ecompatibility for busibox systems.

#4 lore raw
Quoted 61 lines · Khem Raj
Quoted 54 lines · Andre McCurdy
Quoted 37 lines · Khem Raj

certain applets are enabled but the long options are not enabled for them, it results in subtle failures in ptests where its expecting these options e.g. gzip --best is commonly used in many package tests e.g.

root@qemux86-64:/usr/lib# grep -r "\-\-best" *
acl/ptest/Makefile:GZIP_ENV = --best
attr/ptest/Makefile:GZIP_ENV = --best
coreutils/ptest/Makefile:GZIP_ENV = --best
ethtool/ptest/Makefile:GZIP_ENV = --best
libxml2/ptest/Makefile:GZIP_ENV = --best
lttng-tools/ptest/Makefile:GZIP_ENV = --best
opkg/ptest/Makefile:GZIP_ENV = --best
perl/ptest/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm:    COMPRESS     ('gzip --best')
python3.9/test/test_gzip.py:        for compress_level in ('--fast', '--best'):
...

this ensures that these options are enabled by default, which makes them more compatible than now with coreutils provided utilities

busybox size grows by 4K which perhaps is acceptable

--rwxr-xr-x root       root           817704 ./bin/busybox.nosuid
+-rwxr-xr-x root       root           821800 ./bin/busybox.nosuid

This makes autopoint-3/gettext pass

---
 meta/recipes-core/busybox/busybox/getopts.cfg | 7 +++++++
 1 file changed, 7 insertions(+)
meta/recipes-core/busybox/busybox/getopts.cfg +0 -0
index 8db0a4a8f2..aeb5ac691f 100644

meta/recipes-core/busybox/busybox/getopts.cfg line 10

Quoted 10 lines
meta/recipes-core/busybox/busybox/getopts.cfg +7 -0
@@ -1,3 +1,10 @@
 CONFIG_GETOPT=y
 CONFIG_LONG_OPTS=y
 CONFIG_FEATURE_GETOPT_LONG=y
+CONFIG_FEATURE_GZIP_LONG_OPTIONS=y
+CONFIG_FEATURE_TAR_LONG_OPTIONS=y
+CONFIG_FEATURE_CHOWN_LONG_OPTIONS=y
+CONFIG_FEATURE_CP_LONG_OPTIONS=y
+CONFIG_FEATURE_INSTALL_LONG_OPTIONS=y
+CONFIG_FEATURE_DIFF_LONG_OPTIONS=y
+CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS=y

What's the connection between enabling the getopt applet (a utility to help with parsing options in shell scripts etc) and enabling support for long options in a bunch of other unconnected apps?

Quoted 4 lines

I think enabling support for long options in a particular app would be better done where that app is enabled (e.g. CONFIG_FEATURE_GZIP_LONG_OPTIONS should be enabled where CONFIG_GZIP is enabled - in the defconfig file).

Quoted 7 lines

I experimented a bit more and it seems that these options are tied to the corresponding feature being enabled
so they can be enabled in a fragment, unless the feature itself is enabled it will be ignored and disabled. So for
disabled features/applets these options are moot. So as such, I think enabling them is a good thing as it will
widen the ecompatibility for busibox systems.

OK, so all that's left to do is to move them into their own config fragment (since they have nothing to do with the existing getops config fragment).

author
#5 lore raw
Quoted 76 lines · Andre McCurdy
Quoted 2 lines · Khem Raj

On Wed, Apr 28, 2021 at 10:40 AM Andre McCurdy <[email protected]>

Quoted 5 lines · wrote:
Quoted 5 lines · Khem Raj
Quoted 3 lines

certain applets are enabled but the long options are not enabled for them, it results in subtle failures in ptests where its expecting

these

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

options e.g. gzip --best is commonly used in many package tests e.g.

root@qemux86-64:/usr/lib# grep -r "\-\-best" *
acl/ptest/Makefile:GZIP_ENV = --best
attr/ptest/Makefile:GZIP_ENV = --best
coreutils/ptest/Makefile:GZIP_ENV = --best
ethtool/ptest/Makefile:GZIP_ENV = --best
libxml2/ptest/Makefile:GZIP_ENV = --best
lttng-tools/ptest/Makefile:GZIP_ENV = --best
opkg/ptest/Makefile:GZIP_ENV = --best
perl/ptest/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm:

COMPRESS ('gzip --best')

Quoted 1 line
Quoted 1 line
Quoted 1 line

python3.9/test/test_gzip.py: for compress_level in ('--fast',

'--best'):

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

...

this ensures that these options are enabled by default, which makes

them more

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

compatible than now with coreutils provided utilities

busybox size grows by 4K which perhaps is acceptable

--rwxr-xr-x root       root           817704 ./bin/busybox.nosuid
+-rwxr-xr-x root       root           821800 ./bin/busybox.nosuid
Quoted 8 lines
Quoted 8 lines

Review

Quoted 8 lines

This makes autopoint-3/gettext pass

---
 meta/recipes-core/busybox/busybox/getopts.cfg | 7 +++++++
 1 file changed, 7 insertions(+)
(quoted diff) +0 -0

b/meta/recipes-core/busybox/busybox/getopts.cfg

Quoted 24 lines
Quoted 19 lines
Quoted 4 lines

index 8db0a4a8f2..aeb5ac691f 100644

meta/recipes-core/busybox/busybox/getopts.cfg line 10

Quoted 10 lines
meta/recipes-core/busybox/busybox/getopts.cfg +7 -0
@@ -1,3 +1,10 @@
 CONFIG_GETOPT=y
 CONFIG_LONG_OPTS=y
 CONFIG_FEATURE_GETOPT_LONG=y
+CONFIG_FEATURE_GZIP_LONG_OPTIONS=y
+CONFIG_FEATURE_TAR_LONG_OPTIONS=y
+CONFIG_FEATURE_CHOWN_LONG_OPTIONS=y
+CONFIG_FEATURE_CP_LONG_OPTIONS=y
+CONFIG_FEATURE_INSTALL_LONG_OPTIONS=y
+CONFIG_FEATURE_DIFF_LONG_OPTIONS=y
+CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS=y

What's the connection between enabling the getopt applet (a utility to help with parsing options in shell scripts etc) and enabling support for long options in a bunch of other unconnected apps?

Quoted 4 lines

I think enabling support for long options in a particular app would be better done where that app is enabled (e.g. CONFIG_FEATURE_GZIP_LONG_OPTIONS should be enabled where CONFIG_GZIP is enabled - in the defconfig file).

Quoted 7 lines

I experimented a bit more and it seems that these options are tied to the corresponding feature being enabled
so they can be enabled in a fragment, unless the feature itself is enabled it will be ignored and disabled. So for
disabled features/applets these options are moot. So as such, I think enabling them is a good thing as it will
widen the ecompatibility for busibox systems.

Quoted 3 lines

OK, so all that's left to do is to move them into their own config fragment (since they have nothing to do with the existing getops config fragment).

Yeah perhaps a single flagment is good enough

Quoted 2 lines