import lrzip-0.651

LRZIP (Long Range ZIP) is a file compression program designed to
do particularly well on very large files containing long distance
redundancy. The larger the file and the more memory you have, the better
the compression advantage this will provide. A variety of compression
options allow optimizing for size and speed.

From Ruben Llorente (porting at use.startmail com) who is also taking
maintainership, thanks!

some tweaks/suggestions by me and sthen@, ok sthen@
This commit is contained in:
op
2022-06-21 07:11:50 +00:00
parent 65a46855d1
commit 041de4407d
8 changed files with 175 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
COMMENT = compression utility for large files
GH_ACCOUNT = ckolivas
GH_PROJECT = lrzip
GH_TAGNAME = v0.651
CATEGORIES = archivers
MAINTAINER = Ruben Llorente <porting@use.startmail.com>
# GPLv2+
PERMIT_PACKAGE = Yes
WANTLIB += ${COMPILER_LIBCXX} bz2 c lz4 lzo2 m z
COMPILER = base-clang ports-gcc
LIB_DEPENDS = archivers/bzip2 \
archivers/lz4 \
archivers/lzo2
RUN_DEPENDS = shells/bash
CONFIGURE_STYLE = autoreconf
CONFIGURE_ARGS = --disable-doc
CONFIGURE_ENV = CPPFLAGS="-I${LOCALBASE}/include" \
LDFLAGS="-L${LOCALBASE}/lib"
AUTOCONF_VERSION = 2.69
AUTOMAKE_VERSION = 1.16
post-install:
${INSTALL_DATA_DIR} ${PREFIX}/share/examples/lrzip
${INSTALL_DATA} ${WRKSRC}/doc/*.example ${PREFIX}/share/examples/lrzip
.include <bsd.port.mk>
+2
View File
@@ -0,0 +1,2 @@
SHA256 (lrzip-0.651.tar.gz) = 9MhN53igWRIwQGgf1HwXVl/MT+wMzGj88y2X+tFs2JI=
SIZE (lrzip-0.651.tar.gz) = 238854
+14
View File
@@ -0,0 +1,14 @@
Index: Lrzip.h
--- Lrzip.h.orig
+++ Lrzip.h
@@ -29,6 +29,10 @@
# include <inttypes.h>
#endif
+#if defined (__OpenBSD__) || (__NetBSD__)
+# include <stdarg.h>
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
+50
View File
@@ -0,0 +1,50 @@
- Use datasize-max instead of all available physical memory for
determining the decompression window.
- Fix for CVE-2018-5786
Index: lrzip.c
--- lrzip.c.orig
+++ lrzip.c
@@ -90,6 +90,32 @@ i64 get_ram(rzip_control *control)
return ramsize;
}
+#elif defined(__OpenBSD__)
+# include <sys/resource.h>
+i64 get_ram(rzip_control *control)
+{
+ struct rlimit rl;
+ i64 ramsize = (i64)sysconf(_SC_PHYS_PAGES) * PAGE_SIZE;
+
+ /* Raise limits all the way to the max */
+
+ if (getrlimit(RLIMIT_DATA, &rl) == -1)
+ fatal_return(("Failed to get limits in get_ram\n"), -1);
+
+ rl.rlim_cur = rl.rlim_max;
+ if (setrlimit(RLIMIT_DATA, &rl) == -1)
+ fatal_return(("Failed to set limits in get_ram\n"), -1);
+
+ /* Declare detected RAM to be either the max RAM available from
+ physical memory or the max RAM allowed by RLIMIT_DATA, whatever
+ is smaller, to prevent the heuristics from selecting
+ compression windows which cause lrzip to go into deep swap */
+
+ if (rl.rlim_max < ramsize)
+ return rl.rlim_max;
+
+ return ramsize;
+}
#else /* __APPLE__ */
i64 get_ram(rzip_control *control)
{
@@ -1093,7 +1119,7 @@ next_chunk:
do {
i64 head_off;
- if (unlikely(last_head && last_head < second_last))
+ if (unlikely(last_head && last_head <= second_last))
failure_goto(("Invalid earlier last_head position, corrupt archive.\n"), error);
second_last = last_head;
if (unlikely(last_head + ofs > infile_size))
@@ -0,0 +1,21 @@
Index: lrzip_private.h
--- lrzip_private.h.orig
+++ lrzip_private.h
@@ -46,8 +46,6 @@
#ifdef HAVE_ALLOCA_H
# include <alloca.h>
-#elif defined __GNUC__
-# define alloca __builtin_alloca
#elif defined _AIX
# define alloca __alloca
#elif defined _MSC_VER
@@ -144,7 +142,7 @@ extern int errno;
#define unlikely(x) __builtin_expect(!!(x), 0)
#define __maybe_unused __attribute__((unused))
-#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(__ANDROID__) || defined(__APPLE__)
+#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(__ANDROID__) || defined(__APPLE__) || defined(__OpenBSD__)
# define ffsll __builtin_ffsll
#endif
+5
View File
@@ -0,0 +1,5 @@
LRZIP (Long Range ZIP) is a file compression program designed to
do particularly well on very large files containing long distance
redundancy. The larger the file and the more memory you have, the better
the compression advantage this will provide. A variety of compression
options allow optimizing for size and speed.
+40
View File
@@ -0,0 +1,40 @@
bin/lrunzip
bin/lrz
bin/lrzcat
@bin bin/lrzip
bin/lrztar
bin/lrzuntar
@man man/man1/lrunzip.1
@man man/man1/lrz.1
@man man/man1/lrzcat.1
@man man/man1/lrzip.1
@man man/man1/lrztar.1
@man man/man1/lrzuntar.1
@man man/man5/lrzip.conf.5
share/doc/lrzip/
share/doc/lrzip/AUTHORS
share/doc/lrzip/BUGS
share/doc/lrzip/COPYING
share/doc/lrzip/ChangeLog
share/doc/lrzip/README-NOT-BACKWARD-COMPATIBLE
share/doc/lrzip/README.Assembler
share/doc/lrzip/README.benchmarks
share/doc/lrzip/README.lzo_compresses.test.txt
share/doc/lrzip/README.md
share/doc/lrzip/TODO
share/doc/lrzip/WHATS-NEW
share/doc/lrzip/lrzip.conf.example
share/doc/lrzip/lzma/
share/doc/lrzip/lzma/7zC.txt
share/doc/lrzip/lzma/7zFormat.txt
share/doc/lrzip/lzma/Methods.txt
share/doc/lrzip/lzma/README
share/doc/lrzip/lzma/README-Alloc
share/doc/lrzip/lzma/history.txt
share/doc/lrzip/lzma/lzma.txt
share/doc/lrzip/magic.header.txt
share/doc/pkg-readmes/${PKGSTEM}
share/examples/lrzip/
@sample ${SYSCONFDIR}/lrzip/
share/examples/lrzip/lrzip.conf.example
@sample ${SYSCONFDIR}/lrzip/lrzip.conf
+7
View File
@@ -0,0 +1,7 @@
+-----------------------------------------------------------------------
| Running ${FULLPKGNAME} on OpenBSD
+-----------------------------------------------------------------------
Lrzip might require an abusive amount of memory for compression and
decompression. The default limits for datasize may need to be bumped to
use this software.