diff mbox series

bzip2: license and version print should output to stdout and exit

Message ID 20241115031258.191121-1-zhangle.yang@windriver.com
State New
Headers show
Series bzip2: license and version print should output to stdout and exit | expand

Commit Message

zhangle.yang@windriver.com Nov. 15, 2024, 3:12 a.m. UTC
From: Eric Yang <zhangle.yang@windriver.com>

After displaying version or license, bzip2 should exit. It should not continue with compression.

Signed-off-by: Eric Yang <zhangle.yang@windriver.com>
---
 ...ion-print-should-output-to-stdout-an.patch | 53 +++++++++++++++++++
 meta/recipes-extended/bzip2/bzip2_1.0.8.bb    |  1 +
 2 files changed, 54 insertions(+)
 create mode 100644 meta/recipes-extended/bzip2/bzip2/0001-license-and-version-print-should-output-to-stdout-an.patch
diff mbox series

Patch

diff --git a/meta/recipes-extended/bzip2/bzip2/0001-license-and-version-print-should-output-to-stdout-an.patch b/meta/recipes-extended/bzip2/bzip2/0001-license-and-version-print-should-output-to-stdout-an.patch
new file mode 100644
index 0000000000..fe1cb14723
--- /dev/null
+++ b/meta/recipes-extended/bzip2/bzip2/0001-license-and-version-print-should-output-to-stdout-an.patch
@@ -0,0 +1,53 @@ 
+From 65179284ceddc43e6388bf4ed8c2d85cf16e1b2f Mon Sep 17 00:00:00 2001
+From: Rikard Gynnerstedt <rikard.gynnerstedt@gmail.com>
+Date: Thu, 24 Oct 2019 12:48:57 +0200
+Subject: [PATCH] license and version print should output to stdout and exit
+ with code 0
+
+Signed-off-by: Rikard Gynnerstedt <rikard.gynnerstedt@gmail.com>
+
+Upstream-Status: Backport [https://gitlab.com/bzip2/bzip2/-/commit/65179284ceddc43e6388bf4ed8c2d85cf16e1b2f]
+
+Signed-off-by: Eric Yang <zhangle.yang@windriver.com>
+---
+ bzip2.c | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/bzip2.c b/bzip2.c
+index ed1a33f..6da2905 100644
+--- a/bzip2.c
++++ b/bzip2.c
+@@ -1600,7 +1600,7 @@ void testf ( Char *name )
+ static 
+ void license ( void )
+ {
+-   fprintf ( stderr,
++   fprintf ( stdout,
+ 
+     "bzip2, a block-sorting file compressor.  "
+     "Version %s.\n"
+@@ -1890,7 +1890,9 @@ IntNative main ( IntNative argc, Char *argv[] )
+                case '8': blockSize100k    = 8; break;
+                case '9': blockSize100k    = 9; break;
+                case 'V':
+-               case 'L': license();            break;
++               case 'L': license();
++                         exit ( 0 );
++                         break;
+                case 'v': verbosity++; break;
+                case 'h': usage ( progName );
+                          exit ( 0 );
+@@ -1916,8 +1918,8 @@ IntNative main ( IntNative argc, Char *argv[] )
+       if (ISFLAG("--keep"))              keepInputFiles   = True;    else
+       if (ISFLAG("--small"))             smallMode        = True;    else
+       if (ISFLAG("--quiet"))             noisy            = False;   else
+-      if (ISFLAG("--version"))           license();                  else
+-      if (ISFLAG("--license"))           license();                  else
++      if (ISFLAG("--version"))           { license(); exit ( 0 ); }  else
++      if (ISFLAG("--license"))           { license(); exit ( 0 ); }  else
+       if (ISFLAG("--exponential"))       workFactor = 1;             else 
+       if (ISFLAG("--repetitive-best"))   redundant(aa->name);        else
+       if (ISFLAG("--repetitive-fast"))   redundant(aa->name);        else
+-- 
+2.34.1
+
diff --git a/meta/recipes-extended/bzip2/bzip2_1.0.8.bb b/meta/recipes-extended/bzip2/bzip2_1.0.8.bb
index 324276df70..02c05c2902 100644
--- a/meta/recipes-extended/bzip2/bzip2_1.0.8.bb
+++ b/meta/recipes-extended/bzip2/bzip2_1.0.8.bb
@@ -26,6 +26,7 @@  SRC_URI = "https://sourceware.org/pub/${BPN}/${BPN}-${PV}.tar.gz \
            file://configure.ac;subdir=${BP} \
            file://Makefile.am;subdir=${BP} \
            file://run-ptest \
+           file://0001-license-and-version-print-should-output-to-stdout-an.patch \
            "
 SRC_URI[md5sum] = "67e051268d0c475ea773822f7500d0e5"
 SRC_URI[sha256sum] = "ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269"