From faea7e5fb5b3f0862d7bf9adabacf621df5dc092 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Tue, 14 May 2019 23:17:10 +0200 Subject: [PATCH] unzip: fix build and re-add missing stuff in unix.c Now builds and properly extracts attributes again. Note that we should update to newer versions of upstream, where part of our patches (but not what I just added) are now integrated. --- app-arch/unzip/patches/unzip-6.10c23.patchset | 67 +++++++++++++++++-- app-arch/unzip/unzip-6.10c23.recipe | 6 +- 2 files changed, 66 insertions(+), 7 deletions(-) diff --git a/app-arch/unzip/patches/unzip-6.10c23.patchset b/app-arch/unzip/patches/unzip-6.10c23.patchset index a84a01699..8f4d98309 100644 --- a/app-arch/unzip/patches/unzip-6.10c23.patchset +++ b/app-arch/unzip/patches/unzip-6.10c23.patchset @@ -1,4 +1,4 @@ -From 5e93b50f6067bc15f4002f4c06d1f769bae7ca47 Mon Sep 17 00:00:00 2001 +From c5e1d2451e5718b9068c08af28c27b43760f16c0 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sun, 21 Jan 2018 13:41:08 +0100 Subject: Import revised patch from upstream. @@ -548,10 +548,10 @@ index 1361f34..89f3e00 100644 #endif -- -2.15.1 +2.21.0 -From a3246a4c178c7bfb59b0c1b442d20765806067fc Mon Sep 17 00:00:00 2001 +From ad8faa63b707080301ea344f227192a404063915 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sun, 21 Jan 2018 14:07:25 +0100 Subject: Fix build and re-enable -DICONV_MAPPING for Haiku @@ -600,5 +600,64 @@ index ffb997b..b6e14fa 100644 wrote_bytes = fs_write_attr(fd, attr_name, attr_type, 0, -- -2.15.1 +2.21.0 + + +From fd60f91e80bcfdbe87ffa0df10f2e75c90f3389c Mon Sep 17 00:00:00 2001 +From: Adrien Destugues +Date: Tue, 14 May 2019 23:15:32 +0200 +Subject: Fix extraction of file attributes + +Part of the code was missed when migrating from beos.c. + +diff --git a/unix/unix.c b/unix/unix.c +index b6e14fa..12dbf44 100644 +--- a/unix/unix.c ++++ b/unix/unix.c +@@ -1483,6 +1483,24 @@ void close_outfile(__G) /* GRR: change to return PK-style warning level */ + # endif /* defined( UNIX) && defined( __APPLE__) */ + } + ++#ifdef __HAIKU__ ++ /* handle the BeOS extra field if present */ ++ if (!uO.J_flag) { ++ void *ptr = scanBeOSexfield(G.extra_field, ++ G.lrec.extra_field_length); ++ ++ if (ptr) { ++ setBeOSexfield(G.filename, ptr); ++#ifdef BEOS_ASSIGN_FILETYPE ++ } else { ++ /* Otherwise, ask the system to try assigning a MIME type. */ ++ assign_MIME( G.filename ); ++#endif ++ } ++ } ++#endif ++ ++ + # if defined( NO_FCHOWN) || defined( NO_FCHMOD) + /* We lack fchown() or fchmod(), so the file has been closed. We may + * have done chown() above, but not chmod(). +@@ -2406,11 +2424,17 @@ static int set_file_attrs( const char *name, + unsigned char *ptr; + const unsigned char *guard; + int fd; ++ bool isDir; ++ ++ if (name[strlen(name) - 1] == '/') ++ isDir = true; ++ else ++ isDir = false; + + ptr = (unsigned char *)attr_buff; + guard = ptr + total_attr_size; + +- fd = open(name, O_RDONLY | O_NOTRAVERSE); ++ fd = open(name, (isDir ? O_RDONLY : O_RDWR) | O_NOTRAVERSE); + if (fd < 0) { + return errno; /* should it be -fd ? */ + } +-- +2.21.0 diff --git a/app-arch/unzip/unzip-6.10c23.recipe b/app-arch/unzip/unzip-6.10c23.recipe index bcf3b1b21..09a45fefe 100644 --- a/app-arch/unzip/unzip-6.10c23.recipe +++ b/app-arch/unzip/unzip-6.10c23.recipe @@ -5,7 +5,7 @@ or test its integrity." HOMEPAGE="http://www.info-zip.org/UnZip.html" COPYRIGHT="1990-2017 Info-ZIP" LICENSE="Info-ZIP" -REVISION="3" +REVISION="4" SOURCE_URI="http://antinode.info/ftp/info-zip/unzip610c23.zip" CHECKSUM_SHA256="a9c3f0b4377aa593a77574e2fb69aeab97e66e93d8b110797f7b329e09848b62" SOURCE_DIR="unzip610c23" @@ -37,12 +37,12 @@ BUILD_PREREQUIRES=" BUILD() { - make -f unix/Makefile haiku MANDIR=$manDir/man1 + make -f unix/Makefile haiku MANDIR=$manDir/man1 LN="ln -s" } INSTALL() { - make -f unix/Makefile install PREFIX=$prefix MANDIR=$manDir/man1 + make -f unix/Makefile install PREFIX=$prefix MANDIR=$manDir/man1 LN="ln -s" } TEST()