From 337d44af5af916ada243f0ab2008aeab8a822ade Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Thu, 21 Jun 2018 17:31:25 +0200
Subject: gcc2 fix


diff --git a/zzip/mmapped.c b/zzip/mmapped.c
index 2071882..dc643f5 100644
--- a/zzip/mmapped.c
+++ b/zzip/mmapped.c
@@ -459,12 +459,14 @@ zzip_disk_findfirst(ZZIP_DISK * disk)
                 errno = EFBIG;
                 return 0;
             }
+        {
             zzip_size_t rootseek = zzip_disk64_trailer_get_rootseek(trailer);
 	    rootsize = zzip_disk64_trailer_get_rootsize(trailer);
             DBG2("disk64 rootseek at %lli", (long long)rootseek);
             root = disk->buffer + rootseek;
             if (root > p)
                 continue;
+	    }
         } else
         {
             continue;
-- 
2.30.0


From 84aa69222fb02c3ef58a803bad0e32a8aa915b86 Mon Sep 17 00:00:00 2001
From: Leorize <alaviss@users.noreply.github.com>
Date: Thu, 21 Jun 2018 17:34:03 +0200
Subject: test: set LIBRARY_PATH instead of LD_LIBRARY_PATH


diff --git a/test/Makefile.am b/test/Makefile.am
index 49b3fc0..f0639ef 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -80,7 +80,7 @@ zzshowme$(EXEEXT) : zzipself$(EXEEXT) zzipsetstub$(EXEEXT)
 
 check-sfx : zzshowme$(EXEEXT)
 	echo :$@: "./zzshowme readme >readme.out 2>readme.err" 
-	export LD_LIBRARY_PATH="../zzip/.libs:$$LD_LIBRARY_PATH" \
+	export LIBRARY_PATH="../zzip/.libs:$$LD_LIBRARY_PATH" \
 	; ./zzshowme readme >readme.out 2>readme.err ; true
 	@ echo 'diff readme.out $(README) || grep "libzzip-" readme.err' \
 	; if test -s readme.out ; then diff readme.out $(README) \
-- 
2.30.0


From feca7337a49f664836aa65efa3844e136b0d5284 Mon Sep 17 00:00:00 2001
From: Leorize <alaviss@users.noreply.github.com>
Date: Thu, 21 Jun 2018 17:36:28 +0200
Subject: test: use rpath to direct zzipself to correct libpath


diff --git a/test/Makefile.am b/test/Makefile.am
index f0639ef..bd42521 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -64,7 +64,7 @@ check-readme : $(zzcat)  test.zip
 
 noinst_PROGRAMS = zzipself zzipsetstub
 
-zzipself_LDFLAGS = @ZZIPLIB_LDFLAGS@
+zzipself_LDFLAGS = @ZZIPLIB_LDFLAGS@ -Wl,-rpath,\$$ORIGIN/../zzip/.libs
 zzipself_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz
 
 ../zzip/libzzip.la : @top_srcdir@/zzip/*.c
-- 
2.30.0


From 5e435c473ce8b9c146fd4d5cff9fab16dbc464dd Mon Sep 17 00:00:00 2001
From: Leorize <leorize+oss@disroot.org>
Date: Sun, 7 Jun 2020 11:11:25 -0500
Subject: zziptests: avoid large file list on the command line

Some OS, like Haiku, have a small limit on the size of the argument
list. This causes the test to fail due to the large amount of files
passed through the command line.

This commit walkaround the issue by streaming the list of files to zip
stdin, bypassing the limit. However this depends on the underlying shell
to have a printf builtin (so that the argument list limit won't apply to
it).

diff --git a/test/zziptests.py b/test/zziptests.py
index f315dc7..b97dd94 100644
--- a/test/zziptests.py
+++ b/test/zziptests.py
@@ -321,7 +321,7 @@ class ZZipTest(unittest.TestCase):
     filename = os.path.join(tmpdir,"README")
     filetext = self.readme()
     self.mkfile(filename, filetext)
-    shell("{exe} ../{zipfile} ??*.* README".format(**locals()), cwd=tmpdir)
+    shell("printf '%s\\n' ??*.* README | {exe} ../{zipfile} -@".format(**locals()), cwd=tmpdir)
     self.assertGreater(os.path.getsize(zipfile), 10)
   def test_10002_make_test2_zip(self):
     """ create a test2.zip for later tests using standard 'zip'
@@ -337,7 +337,7 @@ class ZZipTest(unittest.TestCase):
     filename = os.path.join(tmpdir,"README")
     filetext = self.readme()
     self.mkfile(filename, filetext)
-    shell("{exe} ../{zipfile} ??*.* README".format(**locals()), cwd=tmpdir)
+    shell("printf '%s\\n' ??*.* README | {exe} ../{zipfile} -@".format(**locals()), cwd=tmpdir)
     self.assertGreater(os.path.getsize(zipfile), 10)
   def test_10003_make_test3_zip(self):
     """ create a test3.zip for later tests using standard 'zip'
@@ -353,7 +353,7 @@ class ZZipTest(unittest.TestCase):
     filename = os.path.join(tmpdir,"README")
     filetext = self.readme()
     self.mkfile(filename, filetext)
-    shell("{exe} ../{zipfile} ??*.* README".format(**locals()), cwd=tmpdir)
+    shell("printf '%s\\n' ??*.* README | {exe} ../{zipfile} -@".format(**locals()), cwd=tmpdir)
     self.assertGreater(os.path.getsize(zipfile), 10)
   def test_10004_make_test4_zip(self):
     """ create a test4.zip for later tests using standard 'zip'
@@ -370,7 +370,7 @@ class ZZipTest(unittest.TestCase):
     filename = os.path.join(tmpdir,"README")
     filetext = self.readme()
     self.mkfile(filename, filetext)
-    shell("{exe} -n README ../{zipfile} ??*.* README".format(**locals()), cwd=tmpdir)
+    shell("printf '%s\\n' ??*.* README | {exe} -n README ../{zipfile} -@".format(**locals()), cwd=tmpdir)
     self.assertGreater(os.path.getsize(zipfile), 1000000)
   def test_10005_make_test5_zip(self):
     """ create a test5.zip for later tests using standard 'zip'
@@ -394,7 +394,7 @@ class ZZipTest(unittest.TestCase):
     filename = os.path.join(tmpdir,"README")
     filetext = self.readme()
     self.mkfile(filename, filetext)
-    shell("{exe} ../{zipfile} -r file* subdir* README".format(**locals()), cwd=tmpdir)
+    shell("printf '%s\\n' file* subdir* README | {exe} ../{zipfile} -r -@".format(**locals()), cwd=tmpdir)
     self.assertGreater(os.path.getsize(zipfile), 1000000)
   def test_10010_make_test0_dat(self):
     """ create test.dat from test.zip with xorcopy """
-- 
2.30.0


From c87b7913740034006c1de93d00f795275de55411 Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Sun, 27 Sep 2020 09:41:53 +0000
Subject: Fix crash


diff --git a/test/zziptests.py b/test/zziptests.py
index b97dd94..e9a04dd 100644
--- a/test/zziptests.py
+++ b/test/zziptests.py
@@ -3662,7 +3662,7 @@ class ZZipTest(unittest.TestCase):
     self.assertFalse(run.returncode)
     # list the ZIPfile
     exe=self.bins("unzip-mem");
-    run = shell("{chdir} {tmpdir} && ../{exe} -v {zipname}.zip".format(**locals()), returncodes = [0,-8])
+    run = shell("printf '%s\\n' ??*.* | {chdir} {tmpdir} && ../{exe} -v {zipname}.zip".format(**locals()), returncodes = [0,-8])
     logg.error("FIXME: unzip-mem test_65485 is not solved")
     self.skipTest("FIXME: not solved")
     self.assertFalse(run.returncode)
-- 
2.30.0


From 2993f0bfc32fd518495638b35ea3f47a12b2ec73 Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Sun, 27 Sep 2020 09:42:50 +0000
Subject: Invalid compiler options for gcc2


diff --git a/zzip/CMakeLists.txt b/zzip/CMakeLists.txt
index c95e1d3..64d62c8 100644
--- a/zzip/CMakeLists.txt
+++ b/zzip/CMakeLists.txt
@@ -109,8 +109,8 @@ if(UNIX)
         -Wmissing-declarations
         # -Wdeclaration-after-statement
         -Werror-implicit-function-declaration
-        -Wstrict-aliasing
-        -Warray-bounds
+#        -Wstrict-aliasing
+#        -Warray-bounds
     )
 endif()
 
-- 
2.30.0


From b4860bb00e6ccd366b1739ccb10fbc4321a3cb73 Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Tue, 29 Sep 2020 12:26:58 +0000
Subject: Installing man3 pages


diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt
index 9271dd9..980a482 100644
--- a/docs/CMakeLists.txt
+++ b/docs/CMakeLists.txt
@@ -129,6 +129,7 @@ add_custom_command(OUTPUT manpages.tar
     COMMAND ${BASH} -c "ls -l `pwd`/manpages.tar >&2 || true"
     DEPENDS zziplib.xml zzipmmapped.xml zzipfseeko.xml
     VERBATIM)
+if(ZZIPLIB_HTMPAGES)
 add_custom_command(OUTPUT htmpages.tar
     COMMAND ${BASH} -c "test -d html && rm -rf html; mkdir html"
     COMMAND ${PY} ${srcdir}/dbk2man.py -o html html zziplib.xml
@@ -139,6 +140,7 @@ add_custom_command(OUTPUT htmpages.tar
     COMMAND ${BASH} -c "ls -l `pwd`/htmpages.tar || true"
     DEPENDS zziplib.xml zzipmmapped.xml zzipfseeko.xml
     VERBATIM)
+endif()
 
 add_custom_target(manpages DEPENDS manpages.tar)
 add_custom_target(htmpages DEPENDS htmpages.tar)
-- 
2.30.0

