1
0
Fork 0

Merging upstream version 1.15.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-17 22:33:22 +01:00
parent 85b7715347
commit 21ada3a77d
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
15 changed files with 47 additions and 45 deletions

View file

@ -1,6 +1,6 @@
2024-11-17 Antonio Diaz Diaz <antonio@gnu.org> 2025-01-07 Antonio Diaz Diaz <antonio@gnu.org>
* Version 1.15-rc1 released. * Version 1.15 released.
* Remove options '--empty-error' and '--marking-error'. * Remove options '--empty-error' and '--marking-error'.
* main.c (Pp_free): New function. * main.c (Pp_free): New function.
* decoder.c (LZd_decode_member): Remove support for Sync Flush marker. * decoder.c (LZd_decode_member): Remove support for Sync Flush marker.
@ -142,7 +142,7 @@
* Created from the decompression code of clzip 1.1. * Created from the decompression code of clzip 1.1.
Copyright (C) 2010-2024 Antonio Diaz Diaz. Copyright (C) 2010-2025 Antonio Diaz Diaz.
This file is a collection of facts, and thus it is not copyrightable, but just This file is a collection of facts, and thus it is not copyrightable, but just
in case, you have unlimited permission to copy, distribute, and modify it. in case, you have unlimited permission to copy, distribute, and modify it.

View file

@ -3,7 +3,8 @@ Requirements
You will need a C99 compiler. (gcc 3.3.6 or newer is recommended). You will need a C99 compiler. (gcc 3.3.6 or newer is recommended).
I use gcc 6.1.0 and 3.3.6, but the code should compile with any standards I use gcc 6.1.0 and 3.3.6, but the code should compile with any standards
compliant compiler. compliant compiler.
Gcc is available at http://gcc.gnu.org. Gcc is available at http://gcc.gnu.org
Lzip is available at http://www.nongnu.org/lzip/lzip.html
The operating system must allow signal handlers read access to objects with The operating system must allow signal handlers read access to objects with
static storage duration so that the cleanup handler for Control-C can delete static storage duration so that the cleanup handler for Control-C can delete
@ -74,7 +75,7 @@ After running 'configure', you can run 'make' and 'make install' as
explained above. explained above.
Copyright (C) 2010-2024 Antonio Diaz Diaz. Copyright (C) 2010-2025 Antonio Diaz Diaz.
This file is free documentation: you have unlimited permission to copy, This file is free documentation: you have unlimited permission to copy,
distribute, and modify it. distribute, and modify it.

18
README
View file

@ -1,3 +1,5 @@
See the file INSTALL for compilation and installation instructions.
Description Description
Lunzip is a decompressor for the lzip format written in C. Its small size Lunzip is a decompressor for the lzip format written in C. Its small size
@ -19,11 +21,10 @@ compressed format for Unix-like systems.
The lzip file format is designed for data sharing and long-term archiving, The lzip file format is designed for data sharing and long-term archiving,
taking into account both data integrity and decoder availability: taking into account both data integrity and decoder availability:
* The lzip format provides very safe integrity checking and some data * The program lziprecover can repair bit flip errors (one of the most
recovery means. The program lziprecover can repair bit flip errors common forms of data corruption) in lzip files, and provides data
(one of the most common forms of data corruption) in lzip files, and recovery capabilities, including error-checked merging of damaged
provides data recovery capabilities, including error-checked merging copies of a file.
of damaged copies of a file.
* The lzip format is as simple as possible (but not simpler). The lzip * The lzip format is as simple as possible (but not simpler). The lzip
manual provides the source code of a simple decompressor along with a manual provides the source code of a simple decompressor along with a
@ -50,7 +51,7 @@ compress the file. To activate it, specify the size of the output buffer
with the option '--buffer-size' and lunzip will use the decompressed with the option '--buffer-size' and lunzip will use the decompressed
file as dictionary for distances beyond the buffer size. Of course, the file as dictionary for distances beyond the buffer size. Of course, the
larger the difference between the buffer size and the dictionary size, the larger the difference between the buffer size and the dictionary size, the
more accesses to disk are needed and the slower the decompression is. more accesses to disc are needed and the slower the decompression is.
This 'low memory' mode only works when decompressing to a regular file This 'low memory' mode only works when decompressing to a regular file
and is intended for systems without enough memory (RAM + swap) to keep and is intended for systems without enough memory (RAM + swap) to keep
the whole dictionary at once. It has been tested on a laptop with a 486 the whole dictionary at once. It has been tested on a laptop with a 486
@ -99,8 +100,11 @@ LANGUAGE NOTE: Uncompressed = not compressed = plain data; it may never have
been compressed. Decompressed is used to refer to data which have undergone been compressed. Decompressed is used to refer to data which have undergone
the process of decompression. the process of decompression.
Lunzip uses Arg_parser for command-line argument parsing:
http://www.nongnu.org/arg-parser/arg_parser.html
Copyright (C) 2010-2024 Antonio Diaz Diaz.
Copyright (C) 2010-2025 Antonio Diaz Diaz.
This file is free documentation: you have unlimited permission to copy, This file is free documentation: you have unlimited permission to copy,
distribute, and modify it. distribute, and modify it.

View file

@ -1,5 +1,5 @@
/* Arg_parser - POSIX/GNU command-line argument parser. (C version) /* Arg_parser - POSIX/GNU command-line argument parser. (C version)
Copyright (C) 2006-2024 Antonio Diaz Diaz. Copyright (C) 2006-2025 Antonio Diaz Diaz.
This library is free software. Redistribution and use in source and This library is free software. Redistribution and use in source and
binary forms, with or without modification, are permitted provided binary forms, with or without modification, are permitted provided

View file

@ -1,5 +1,5 @@
/* Arg_parser - POSIX/GNU command-line argument parser. (C version) /* Arg_parser - POSIX/GNU command-line argument parser. (C version)
Copyright (C) 2006-2024 Antonio Diaz Diaz. Copyright (C) 2006-2025 Antonio Diaz Diaz.
This library is free software. Redistribution and use in source and This library is free software. Redistribution and use in source and
binary forms, with or without modification, are permitted provided binary forms, with or without modification, are permitted provided

6
configure vendored
View file

@ -1,12 +1,12 @@
#! /bin/sh #! /bin/sh
# configure script for Lunzip - Decompressor for the lzip format # configure script for Lunzip - Decompressor for the lzip format
# Copyright (C) 2010-2024 Antonio Diaz Diaz. # Copyright (C) 2010-2025 Antonio Diaz Diaz.
# #
# This configure script is free software: you have unlimited permission # This configure script is free software: you have unlimited permission
# to copy, distribute, and modify it. # to copy, distribute, and modify it.
pkgname=lunzip pkgname=lunzip
pkgversion=1.15-rc1 pkgversion=1.15
progname=lunzip progname=lunzip
srctrigger=doc/${progname}.1 srctrigger=doc/${progname}.1
@ -171,7 +171,7 @@ echo "MAKEINFO = ${MAKEINFO}"
rm -f Makefile rm -f Makefile
cat > Makefile << EOF cat > Makefile << EOF
# Makefile for Lunzip - Decompressor for the lzip format # Makefile for Lunzip - Decompressor for the lzip format
# Copyright (C) 2010-2024 Antonio Diaz Diaz. # Copyright (C) 2010-2025 Antonio Diaz Diaz.
# This file was generated automatically by configure. Don't edit. # This file was generated automatically by configure. Don't edit.
# #
# This Makefile is free software: you have unlimited permission # This Makefile is free software: you have unlimited permission

View file

@ -1,5 +1,5 @@
/* Lunzip - Decompressor for the lzip format /* Lunzip - Decompressor for the lzip format
Copyright (C) 2010-2024 Antonio Diaz Diaz. Copyright (C) 2010-2025 Antonio Diaz Diaz.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -102,7 +102,7 @@ void LZd_flush_data( LZ_decoder * const d )
CRC32_update_buf( &d->crc, d->buffer + d->stream_pos, size ); CRC32_update_buf( &d->crc, d->buffer + d->stream_pos, size );
if( d->outfd >= 0 && if( d->outfd >= 0 &&
writeblock( d->outfd, d->buffer + d->stream_pos, size ) != size ) writeblock( d->outfd, d->buffer + d->stream_pos, size ) != size )
{ show_error( write_error_msg, errno, false ); cleanup_and_fail( 1 ); } { show_error( wr_err_msg, errno, false ); cleanup_and_fail( 1 ); }
if( d->pos >= d->buffer_size ) if( d->pos >= d->buffer_size )
{ d->partial_data_pos += d->pos; d->pos = 0; { d->partial_data_pos += d->pos; d->pos = 0;
if( d->partial_data_pos >= d->dictionary_size ) d->pos_wrapped = true; } if( d->partial_data_pos >= d->dictionary_size ) d->pos_wrapped = true; }
@ -234,7 +234,7 @@ int LZd_decode_member( LZ_decoder * const d, Pretty_print * const pp )
if( Rd_decode_bit( rdec, &bm_rep0[state] ) == 0 ) /* 3rd bit */ if( Rd_decode_bit( rdec, &bm_rep0[state] ) == 0 ) /* 3rd bit */
{ {
if( Rd_decode_bit( rdec, &bm_len[state][pos_state] ) == 0 ) /* 4th bit */ if( Rd_decode_bit( rdec, &bm_len[state][pos_state] ) == 0 ) /* 4th bit */
{ state = St_set_short_rep( state ); { state = St_set_shortrep( state );
LZd_put_byte( d, LZd_peek( d, rep0 ) ); continue; } LZd_put_byte( d, LZd_peek( d, rep0 ) ); continue; }
} }
else else

View file

@ -1,5 +1,5 @@
/* Lunzip - Decompressor for the lzip format /* Lunzip - Decompressor for the lzip format
Copyright (C) 2010-2024 Antonio Diaz Diaz. Copyright (C) 2010-2025 Antonio Diaz Diaz.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -204,9 +204,8 @@ static inline unsigned Rd_decode_tree8( Range_decoder * const rdec,
return symbol & 0xFF; return symbol & 0xFF;
} }
static inline unsigned static inline unsigned Rd_decode_tree_reversed( Range_decoder * const rdec,
Rd_decode_tree_reversed( Range_decoder * const rdec, Bit_model bm[], const int num_bits )
Bit_model bm[], const int num_bits )
{ {
unsigned model = 1; unsigned model = 1;
unsigned symbol = 0; unsigned symbol = 0;
@ -244,8 +243,7 @@ static inline unsigned Rd_decode_matched( Range_decoder * const rdec,
} }
static inline unsigned Rd_decode_len( Range_decoder * const rdec, static inline unsigned Rd_decode_len( Range_decoder * const rdec,
Len_model * const lm, Len_model * const lm, const int pos_state )
const int pos_state )
{ {
Bit_model * bm; Bit_model * bm;
unsigned mask, offset, symbol = 1; unsigned mask, offset, symbol = 1;
@ -386,8 +384,7 @@ static inline void LZd_free( LZ_decoder * const d )
static inline unsigned LZd_crc( const LZ_decoder * const d ) static inline unsigned LZd_crc( const LZ_decoder * const d )
{ return d->crc ^ 0xFFFFFFFFU; } { return d->crc ^ 0xFFFFFFFFU; }
static inline unsigned long long static inline unsigned long long LZd_data_position( const LZ_decoder * const d )
LZd_data_position( const LZ_decoder * const d )
{ return d->partial_data_pos + d->pos; } { return d->partial_data_pos + d->pos; }
int LZd_decode_member( LZ_decoder * const d, Pretty_print * const pp ); int LZd_decode_member( LZ_decoder * const d, Pretty_print * const pp );

View file

@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.2. .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.2.
.TH LUNZIP "1" "November 2024" "lunzip 1.15-rc1" "User Commands" .TH LUNZIP "1" "January 2025" "lunzip 1.15" "User Commands"
.SH NAME .SH NAME
lunzip \- decompressor for the lzip format lunzip \- decompressor for the lzip format
.SH SYNOPSIS .SH SYNOPSIS
@ -28,7 +28,7 @@ compress the file. To activate it, specify the size of the output buffer
with the option \fB\-\-buffer\-size\fR and lunzip will use the decompressed with the option \fB\-\-buffer\-size\fR and lunzip will use the decompressed
file as dictionary for distances beyond the buffer size. Of course, the file as dictionary for distances beyond the buffer size. Of course, the
larger the difference between the buffer size and the dictionary size, the larger the difference between the buffer size and the dictionary size, the
more accesses to disk are needed and the slower the decompression is. more accesses to disc are needed and the slower the decompression is.
This 'low memory' mode only works when decompressing to a regular file This 'low memory' mode only works when decompressing to a regular file
and is intended for systems without enough memory (RAM + swap) to keep and is intended for systems without enough memory (RAM + swap) to keep
the whole dictionary at once. the whole dictionary at once.
@ -101,7 +101,7 @@ Report bugs to lzip\-bug@nongnu.org
.br .br
Lunzip home page: http://www.nongnu.org/lzip/lunzip.html Lunzip home page: http://www.nongnu.org/lzip/lunzip.html
.SH COPYRIGHT .SH COPYRIGHT
Copyright \(co 2024 Antonio Diaz Diaz. Copyright \(co 2025 Antonio Diaz Diaz.
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html> License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
.br .br
This is free software: you are free to change and redistribute it. This is free software: you are free to change and redistribute it.

4
list.c
View file

@ -1,5 +1,5 @@
/* Lunzip - Decompressor for the lzip format /* Lunzip - Decompressor for the lzip format
Copyright (C) 2010-2024 Antonio Diaz Diaz. Copyright (C) 2010-2025 Antonio Diaz Diaz.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -115,7 +115,7 @@ int list_files( const char * const filenames[], const int num_filenames,
fflush( stdout ); fflush( stdout );
} }
if( verbosity >= 0 && ( ferror( stdout ) || fclose( stdout ) != 0 ) ) if( verbosity >= 0 && ( ferror( stdout ) || fclose( stdout ) != 0 ) )
{ show_file_error( "(stdout)", write_error_msg, errno ); { show_file_error( "(stdout)", wr_err_msg, errno );
set_retval( &retval, 1 ); } set_retval( &retval, 1 ); }
return retval; return retval;
} }

6
lzip.h
View file

@ -1,5 +1,5 @@
/* Lunzip - Decompressor for the lzip format /* Lunzip - Decompressor for the lzip format
Copyright (C) 2010-2024 Antonio Diaz Diaz. Copyright (C) 2010-2025 Antonio Diaz Diaz.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -36,7 +36,7 @@ static inline State St_set_match( const State st )
{ return ( st < 7 ) ? 7 : 10; } { return ( st < 7 ) ? 7 : 10; }
static inline State St_set_rep( const State st ) static inline State St_set_rep( const State st )
{ return ( st < 7 ) ? 8 : 11; } { return ( st < 7 ) ? 8 : 11; }
static inline State St_set_short_rep( const State st ) static inline State St_set_shortrep( const State st )
{ return ( st < 7 ) ? 9 : 11; } { return ( st < 7 ) ? 9 : 11; }
@ -256,7 +256,7 @@ static const char * const empty_msg = "Empty member not allowed.";
static const char * const mem_msg = "Not enough memory."; static const char * const mem_msg = "Not enough memory.";
static const char * const nonzero_msg = "Nonzero first LZMA byte."; static const char * const nonzero_msg = "Nonzero first LZMA byte.";
static const char * const trailing_msg = "Trailing data not allowed."; static const char * const trailing_msg = "Trailing data not allowed.";
static const char * const write_error_msg = "Write error"; static const char * const wr_err_msg = "Write error";
/* defined in decoder.c */ /* defined in decoder.c */
int readblock( const int fd, uint8_t * const buf, const int size ); int readblock( const int fd, uint8_t * const buf, const int size );

View file

@ -1,5 +1,5 @@
/* Lunzip - Decompressor for the lzip format /* Lunzip - Decompressor for the lzip format
Copyright (C) 2010-2024 Antonio Diaz Diaz. Copyright (C) 2010-2025 Antonio Diaz Diaz.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -208,7 +208,7 @@ bool Li_init( Lzip_index * const li, const int infd,
( !Li_read_header( li, infd, header, 0 ) || ( !Li_read_header( li, infd, header, 0 ) ||
!Li_check_header( li, header ) ) ) return false; !Li_check_header( li, header ) ) ) return false;
if( li->insize < min_member_size ) if( li->insize < min_member_size )
{ add_error( li, "Input file is too short." ); li->retval = 2; { add_error( li, "Input file is truncated." ); li->retval = 2;
return false; } return false; }
if( li->insize > INT64_MAX ) if( li->insize > INT64_MAX )
{ add_error( li, "Input file is too long (2^63 bytes or more)." ); { add_error( li, "Input file is too long (2^63 bytes or more)." );

View file

@ -1,5 +1,5 @@
/* Lunzip - Decompressor for the lzip format /* Lunzip - Decompressor for the lzip format
Copyright (C) 2010-2024 Antonio Diaz Diaz. Copyright (C) 2010-2025 Antonio Diaz Diaz.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by

10
main.c
View file

@ -1,5 +1,5 @@
/* Lunzip - Decompressor for the lzip format /* Lunzip - Decompressor for the lzip format
Copyright (C) 2010-2024 Antonio Diaz Diaz. Copyright (C) 2010-2025 Antonio Diaz Diaz.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -78,7 +78,7 @@
int verbosity = 0; int verbosity = 0;
static const char * const program_name = "lunzip"; static const char * const program_name = "lunzip";
static const char * const program_year = "2024"; static const char * const program_year = "2025";
static const char * invocation_name = "lunzip"; /* default value */ static const char * invocation_name = "lunzip"; /* default value */
static const struct { const char * from; const char * to; } known_extensions[] = { static const struct { const char * from; const char * to; } known_extensions[] = {
@ -117,7 +117,7 @@ static void show_help( void )
"with the option --buffer-size and lunzip will use the decompressed\n" "with the option --buffer-size and lunzip will use the decompressed\n"
"file as dictionary for distances beyond the buffer size. Of course, the\n" "file as dictionary for distances beyond the buffer size. Of course, the\n"
"larger the difference between the buffer size and the dictionary size, the\n" "larger the difference between the buffer size and the dictionary size, the\n"
"more accesses to disk are needed and the slower the decompression is.\n" "more accesses to disc are needed and the slower the decompression is.\n"
"This 'low memory' mode only works when decompressing to a regular file\n" "This 'low memory' mode only works when decompressing to a regular file\n"
"and is intended for systems without enough memory (RAM + swap) to keep\n" "and is intended for systems without enough memory (RAM + swap) to keep\n"
"the whole dictionary at once.\n" "the whole dictionary at once.\n"
@ -279,7 +279,7 @@ void show_header( const unsigned dictionary_size )
} }
/* separate numbers of 6 or more digits in groups of 3 digits using '_' */ /* separate numbers of 5 or more digits in groups of 3 digits using '_' */
static const char * format_num3( unsigned long long num ) static const char * format_num3( unsigned long long num )
{ {
enum { buffers = 8, bufsize = 4 * sizeof num, n = 10 }; enum { buffers = 8, bufsize = 4 * sizeof num, n = 10 };
@ -302,7 +302,7 @@ static const char * format_num3( unsigned long long num )
{ num /= 1000; prefix = si_prefix[i]; } { num /= 1000; prefix = si_prefix[i]; }
if( prefix ) *(--p) = prefix; if( prefix ) *(--p) = prefix;
} }
const bool split = num >= 100000; const bool split = num >= 10000;
for( i = 0; ; ) for( i = 0; ; )
{ {

View file

@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# check script for Lunzip - Decompressor for the lzip format # check script for Lunzip - Decompressor for the lzip format
# Copyright (C) 2010-2024 Antonio Diaz Diaz. # Copyright (C) 2010-2025 Antonio Diaz Diaz.
# #
# This script is free software: you have unlimited permission # This script is free software: you have unlimited permission
# to copy, distribute, and modify it. # to copy, distribute, and modify it.