Re: [PATCH] Before calling execvp(), reset needs to flush stdout.

2017-02-17 Thread Denys Vlasenko
Applied, thanks

On Thu, Feb 16, 2017 at 3:45 PM, Glenn Matthews (glmatthe)
 wrote:
> Before calling execvp(), reset needs to flush stdout.
>
> Otherwise the reset sequence gets dropped on the floor.
> ---
>  AUTHORS   | 3 +++
>  console-tools/reset.c | 2 ++
>  2 files changed, 5 insertions(+)
>
> diff --git a/AUTHORS b/AUTHORS
> index fa58697..9410c5e 100644
> --- a/AUTHORS
> +++ b/AUTHORS
> @@ -95,6 +95,9 @@ Stephan Linz 
>  John Lombardo 
>  tr
>
> +Glenn Matthews 
> +Bug fix(es).
> +
>  Glenn McGrath 
>  Common unarchiving code and unarchiving applets, ifupdown, ftpgetput,
>  nameif, sed, patch, fold, install, uudecode.
> diff --git a/console-tools/reset.c b/console-tools/reset.c
> index 57cebb4..7c7b99d 100644
> --- a/console-tools/reset.c
> +++ b/console-tools/reset.c
> @@ -56,6 +56,8 @@ int reset_main(int argc UNUSED_PARAM, char **argv 
> UNUSED_PARAM)
>  #if ENABLE_STTY
> return stty_main(2, (char**)args);
>  #else
> +   /* Make sure stdout gets drained before we execvp */
> +   fflush(stdout);
> execvp("stty", (char**)args);
>  #endif
> }
> --
> 2.9.3
>
>
>
>
> ___
> busybox mailing list
> busybox@busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


[RFC 1/2] Add hidden option FEATURE_HAVE_SEAMLESS_COMPRESSION

2017-02-17 Thread Kang-Che Sung
All applets that allow seamless compression now automatically select
FEATURE_HAVE_SEAMLESS_COMPRESSION, and FEATURE_SEAMLESS_* now depend on
this.

This means that "Make tar, rpm, modprobe etc understand ... data"
questions will no longer be asked if there are no applets requiring it.

Currently the applets that select FEATURE_HAVE_SEAMLESS_COMPRESSION
are: zcat, dpkg, dpkg_deb, rpm, rpm2cpio, tar, loadfont, fbsplash, man,
depmod, insmod, modinfo and modprobe.

I hope this will help tracking which of the applets will use seamless
compression more easily.

Signed-off-by: Kang-Che Sung 
---
 archival/Config.src  | 12 
 archival/bbunzip.c   |  1 +
 archival/dpkg.c  |  1 +
 archival/dpkg_deb.c  |  1 +
 archival/rpm.c   |  1 +
 archival/rpm2cpio.c  |  1 +
 archival/tar.c   |  1 +
 console-tools/loadfont.c |  1 +
 miscutils/fbsplash.c |  1 +
 miscutils/man.c  |  1 +
 modutils/depmod.c|  1 +
 modutils/insmod.c|  1 +
 modutils/modinfo.c   |  1 +
 modutils/modprobe.c  |  1 +
 14 files changed, 25 insertions(+)

diff --git a/archival/Config.src b/archival/Config.src
index 0c97f3d7c..82c8c40eb 100644
--- a/archival/Config.src
+++ b/archival/Config.src
@@ -5,25 +5,37 @@
 
 menu "Archival Utilities"
 
+config FEATURE_HAVE_SEAMLESS_COMPRESSION
+   bool
+   default n
+   #help
+   #  This is automatically selected if any applet that supports seamless
+   #  compression is enabled.
+
 config FEATURE_SEAMLESS_XZ
bool "Make tar, rpm, modprobe etc understand .xz data"
default y
+   depends on FEATURE_HAVE_SEAMLESS_COMPRESSION
 
 config FEATURE_SEAMLESS_LZMA
bool "Make tar, rpm, modprobe etc understand .lzma data"
default y
+   depends on FEATURE_HAVE_SEAMLESS_COMPRESSION
 
 config FEATURE_SEAMLESS_BZ2
bool "Make tar, rpm, modprobe etc understand .bz2 data"
default y
+   depends on FEATURE_HAVE_SEAMLESS_COMPRESSION
 
 config FEATURE_SEAMLESS_GZ
bool "Make tar, rpm, modprobe etc understand .gz data"
default y
+   depends on FEATURE_HAVE_SEAMLESS_COMPRESSION
 
 config FEATURE_SEAMLESS_Z
bool "Make tar, rpm, modprobe etc understand .Z data"
default n  # it is ancient
+   depends on FEATURE_HAVE_SEAMLESS_COMPRESSION
 
 INSERT
 
diff --git a/archival/bbunzip.c b/archival/bbunzip.c
index 0e2a261f0..cb7c9dfd2 100644
--- a/archival/bbunzip.c
+++ b/archival/bbunzip.c
@@ -305,6 +305,7 @@ int uncompress_main(int argc UNUSED_PARAM, char **argv)
 //config:  bool "zcat"
 //config:  default y
 //config:  select FEATURE_GZIP_DECOMPRESS
+//config:  select FEATURE_HAVE_SEAMLESS_COMPRESSION # zcat uses seamless 
magic
 //config:  help
 //config:Alias to "gunzip -c".
 //config:
diff --git a/archival/dpkg.c b/archival/dpkg.c
index f133299e3..f24192161 100644
--- a/archival/dpkg.c
+++ b/archival/dpkg.c
@@ -29,6 +29,7 @@
 //config:config DPKG
 //config:  bool "dpkg"
 //config:  default y
+//config:  select FEATURE_HAVE_SEAMLESS_COMPRESSION
 //config:  select FEATURE_SEAMLESS_GZ
 //config:  help
 //config:dpkg is a medium-level tool to install, build, remove and 
manage
diff --git a/archival/dpkg_deb.c b/archival/dpkg_deb.c
index ebbc7f035..5890587c2 100644
--- a/archival/dpkg_deb.c
+++ b/archival/dpkg_deb.c
@@ -8,6 +8,7 @@
 //config:config DPKG_DEB
 //config:  bool "dpkg_deb"
 //config:  default y
+//config:  select FEATURE_HAVE_SEAMLESS_COMPRESSION
 //config:  select FEATURE_SEAMLESS_GZ
 //config:  help
 //config:dpkg-deb unpacks and provides information about Debian 
archives.
diff --git a/archival/rpm.c b/archival/rpm.c
index 83160f975..9582cf2d2 100644
--- a/archival/rpm.c
+++ b/archival/rpm.c
@@ -10,6 +10,7 @@
 //config:config RPM
 //config:  bool "rpm"
 //config:  default y
+//config:  select FEATURE_HAVE_SEAMLESS_COMPRESSION
 //config:  help
 //config:Mini RPM applet - queries and extracts RPM packages.
 
diff --git a/archival/rpm2cpio.c b/archival/rpm2cpio.c
index 7057570f5..aa23e10b4 100644
--- a/archival/rpm2cpio.c
+++ b/archival/rpm2cpio.c
@@ -10,6 +10,7 @@
 //config:config RPM2CPIO
 //config:  bool "rpm2cpio"
 //config:  default y
+//config:  select FEATURE_HAVE_SEAMLESS_COMPRESSION
 //config:  help
 //config:Converts a RPM file into a CPIO archive.
 
diff --git a/archival/tar.c b/archival/tar.c
index b1d58a2df..a6e55591e 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -44,6 +44,7 @@
 //config:config TAR
 //config:  bool "tar"
 //config:  default y
+//config:  select FEATURE_HAVE_SEAMLESS_COMPRESSION
 //config:  help
 //config:tar is an archiving program. It's commonly used with gzip to
 //config:create compressed archives. It's probably the most widely used
diff --git a/console-tools/loadfont.c b/console-tools/loadfont.c
index 

[RFC 2/2] Simplify check on disabling FEATURE_COMPRESS_USAGE

2017-02-17 Thread Kang-Che Sung
As long as FEATURE_SEAMLESS_BZ2 depends on
FEATURE_HAVE_SEAMLESS_COMPRESSION, we won't need to check individual
applets that use seamless compression.

Also add the missing FEATURE_UNZIP_BZIP2 to the preprocessor check.

TODO: See if we need to address FEATURE_COMPRESS_BBCONFIG here as well.

Signed-off-by: Kang-Che Sung 
---
 libbb/appletlib.c | 21 +++--
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/libbb/appletlib.c b/libbb/appletlib.c
index 7f0d62060..02ffd319b 100644
--- a/libbb/appletlib.c
+++ b/libbb/appletlib.c
@@ -57,22 +57,15 @@
  *  and we don't include bunzip2 code for other reasons"
  *
  * Useful for mass one-applet rebuild (bunzip2 code is ~2.7k).
- *
- * Unlike BUNZIP2, if FEATURE_SEAMLESS_BZ2 is on, bunzip2 code is built but
- * still may be unused if none of the selected applets calls open_zipped()
- * or its friends; we test for (FEATURE_SEAMLESS_BZ2 && ) instead.
- * For example, only if TAR and FEATURE_SEAMLESS_BZ2 are both selected,
- * then bunzip2 code will be linked in anyway, and disabling help compression
- * would be not optimal:
  */
+/* Note: Please keep USE_BUNZIP2_CODE in sync with the entries in
+ * archival/libarchive/Kbuild.src */
+#define USE_BUNZIP2_CODE (ENABLE_FEATURE_SEAMLESS_BZ2 \
+ || ENABLE_FEATURE_BZIP2_DECOMPRESS \
+ || ENABLE_FEATURE_UNZIP_BZIP2)
+
 #if UNPACKED_USAGE_LENGTH < 4*1024 \
- && !(ENABLE_FEATURE_SEAMLESS_BZ2 && ENABLE_TAR) \
- && !(ENABLE_FEATURE_SEAMLESS_BZ2 && ENABLE_MODPROBE) \
- && !(ENABLE_FEATURE_SEAMLESS_BZ2 && ENABLE_INSMOD) \
- && !(ENABLE_FEATURE_SEAMLESS_BZ2 && ENABLE_DEPMOD) \
- && !(ENABLE_FEATURE_SEAMLESS_BZ2 && ENABLE_MAN) \
- && !ENABLE_BUNZIP2 \
- && !ENABLE_BZCAT
+ && !USE_BUNZIP2_CODE
 # undef  ENABLE_FEATURE_COMPRESS_USAGE
 # define ENABLE_FEATURE_COMPRESS_USAGE 0
 #endif
-- 
2.11.0

___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


[PATCH] Fix FEATURE_{GZIP,BZIP2}_DECOMPRESS link error

2017-02-17 Thread Kang-Che Sung
... when gzip is selected but not gunzip nor zcat, or when bzip2 is
selected but not bunzip2 nor bzcat.

This regression is introduced in b130f9f758b6404c6d0911a1c120937ae6ab47f8
("Allow 'gzip -d' and 'bzip2 -d' without gunzip or bunzip2")

Signed-off-by: Kang-Che Sung 
---
 archival/libarchive/Kbuild.src | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/archival/libarchive/Kbuild.src b/archival/libarchive/Kbuild.src
index eaf67451f..942e755b9 100644
--- a/archival/libarchive/Kbuild.src
+++ b/archival/libarchive/Kbuild.src
@@ -51,8 +51,8 @@
 lib-$(CONFIG_UNLZOP)+= lzo1x_1.o lzo1x_1o.o lzo1x_d.o
 lib-$(CONFIG_LZOPCAT)   += lzo1x_1.o lzo1x_1o.o lzo1x_d.o
 lib-$(CONFIG_LZOP_COMPR_HIGH)   += lzo1x_9x.o
-lib-$(CONFIG_BUNZIP2)   += open_transformer.o 
decompress_bunzip2.o
-lib-$(CONFIG_BZCAT) += open_transformer.o 
decompress_bunzip2.o
+# 'bzip2 -d', bunzip2 or bzcat selects FEATURE_BZIP2_DECOMPRESS
+lib-$(CONFIG_FEATURE_BZIP2_DECOMPRESS)  += open_transformer.o 
decompress_bunzip2.o
 lib-$(CONFIG_FEATURE_UNZIP_BZIP2)   += open_transformer.o 
decompress_bunzip2.o
 lib-$(CONFIG_UNLZMA)+= open_transformer.o 
decompress_unlzma.o
 lib-$(CONFIG_LZCAT) += open_transformer.o 
decompress_unlzma.o
@@ -62,8 +62,8 @@
 lib-$(CONFIG_XZCAT) += open_transformer.o decompress_unxz.o
 lib-$(CONFIG_XZ)+= open_transformer.o decompress_unxz.o
 lib-$(CONFIG_FEATURE_UNZIP_XZ)  += open_transformer.o decompress_unxz.o
-lib-$(CONFIG_GUNZIP)+= open_transformer.o 
decompress_gunzip.o
-lib-$(CONFIG_ZCAT)  += open_transformer.o 
decompress_gunzip.o
+# 'gzip -d', gunzip or zcat selects FEATURE_GZIP_DECOMPRESS
+lib-$(CONFIG_FEATURE_GZIP_DECOMPRESS)   += open_transformer.o 
decompress_gunzip.o
 lib-$(CONFIG_UNCOMPRESS)+= open_transformer.o 
decompress_uncompress.o
 lib-$(CONFIG_UNZIP) += open_transformer.o 
decompress_gunzip.o unsafe_prefix.o
 lib-$(CONFIG_RPM2CPIO)  += open_transformer.o 
decompress_gunzip.o get_header_cpio.o
-- 
2.11.0

___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox