From 3090a754d28713fbc1a047f7007ef8e487bc2003 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 31 Jan 2024 06:24:47 +0100 Subject: Adding upstream version 1.14. Signed-off-by: Daniel Baumann --- ChangeLog | 16 ++++++------- INSTALL | 2 +- NEWS | 3 +++ README | 14 +++++------ carg_parser.c | 2 +- carg_parser.h | 2 +- configure | 6 ++--- decoder.c | 2 +- decoder.h | 2 +- doc/clzip.1 | 11 ++++----- doc/clzip.info | 69 ++++++++++++++++++++++++------------------------------ doc/clzip.texi | 40 +++++++++++++------------------ encoder.c | 2 +- encoder.h | 2 +- encoder_base.c | 2 +- encoder_base.h | 2 +- fast_encoder.c | 2 +- fast_encoder.h | 2 +- list.c | 2 +- lzip.h | 2 +- lzip_index.c | 2 +- lzip_index.h | 2 +- main.c | 19 ++++++++------- testsuite/check.sh | 2 +- 24 files changed, 98 insertions(+), 112 deletions(-) diff --git a/ChangeLog b/ChangeLog index e3b1859..63e6a0d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,10 @@ -2023-12-20 Antonio Diaz Diaz +2024-01-22 Antonio Diaz Diaz - * Version 1.14-rc1 released. + * Version 1.14 released. * New options '--empty-error' and '--marking-error'. * main.c: Reformat file diagnostics as 'PROGRAM: FILE: MESSAGE'. (show_option_error): New function showing argument and option name. + (main): Make -o preserve date/mode/owner if 1 input file. (open_outstream): Create missing intermediate directories. * lzip.h: Rename verify_* to check_*. * configure, Makefile.in: New variable 'MAKEINFO'. @@ -81,8 +82,8 @@ * Version 1.8 released. * New option '-a, --trailing-error'. - * main.c (decompress): Print up to 6 bytes of trailing data - when '-vvvv' is specified. + * main.c (decompress): Print up to 6 bytes of trailing data when + '-vvvv' is specified. * decoder.c (LZd_verify_trailer): Remove test of final code. * main.c (main): Delete '--output' file if infd is a terminal. * main.c (main): Don't use stdin more than once. @@ -172,8 +173,7 @@ * Translated to C from the C++ source of lzip 1.10. -Copyright (C) 2010-2023 Antonio Diaz Diaz. +Copyright (C) 2010-2024 Antonio Diaz Diaz. -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. +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. diff --git a/INSTALL b/INSTALL index 007b0bc..b405598 100644 --- a/INSTALL +++ b/INSTALL @@ -75,7 +75,7 @@ After running 'configure', you can run 'make' and 'make install' as explained above. -Copyright (C) 2010-2023 Antonio Diaz Diaz. +Copyright (C) 2010-2024 Antonio Diaz Diaz. This file is free documentation: you have unlimited permission to copy, distribute, and modify it. diff --git a/NEWS b/NEWS index 27003a0..83fde4d 100644 --- a/NEWS +++ b/NEWS @@ -11,6 +11,9 @@ File diagnostics have been reformatted as 'PROGRAM: FILE: MESSAGE'. Diagnostics caused by invalid arguments to command-line options now show the argument and the name of the option. +The option '-o, --output' now preserves dates, permissions, and ownership of +the file when (de)compressing exactly one file. + The option '-o, --output' now creates missing intermediate directories when writing to a file. diff --git a/README b/README index a5e55d0..5905364 100644 --- a/README +++ b/README @@ -1,9 +1,8 @@ Description -Clzip is a C language version of lzip, fully compatible with lzip 1.4 or -newer. As clzip is written in C, it may be easier to integrate in -applications like package managers, embedded devices, or systems lacking a -C++ compiler. +Clzip is a C language version of lzip, compatible with lzip 1.4 or newer. As +clzip is written in C, it may be easier to integrate in applications like +package managers, embedded devices, or systems lacking a C++ compiler. Lzip is a lossless data compressor with a user interface similar to the one of gzip or bzip2. Lzip uses a simplified form of the 'Lempel-Ziv-Markov @@ -131,11 +130,10 @@ been compressed. Decompressed is used to refer to data which have undergone the process of decompression. -Copyright (C) 2010-2023 Antonio Diaz Diaz. +Copyright (C) 2010-2024 Antonio Diaz Diaz. This file is free documentation: you have unlimited permission to copy, distribute, and modify it. -The file Makefile.in is a data file used by configure to produce the -Makefile. It has the same copyright owner and permissions that configure -itself. +The file Makefile.in is a data file used by configure to produce the Makefile. +It has the same copyright owner and permissions that configure itself. diff --git a/carg_parser.c b/carg_parser.c index 8882b97..edb4eb9 100644 --- a/carg_parser.c +++ b/carg_parser.c @@ -1,5 +1,5 @@ /* Arg_parser - POSIX/GNU command-line argument parser. (C version) - Copyright (C) 2006-2023 Antonio Diaz Diaz. + Copyright (C) 2006-2024 Antonio Diaz Diaz. This library is free software. Redistribution and use in source and binary forms, with or without modification, are permitted provided diff --git a/carg_parser.h b/carg_parser.h index ec5d3d0..69ce271 100644 --- a/carg_parser.h +++ b/carg_parser.h @@ -1,5 +1,5 @@ /* Arg_parser - POSIX/GNU command-line argument parser. (C version) - Copyright (C) 2006-2023 Antonio Diaz Diaz. + Copyright (C) 2006-2024 Antonio Diaz Diaz. This library is free software. Redistribution and use in source and binary forms, with or without modification, are permitted provided diff --git a/configure b/configure index 7d332b6..a95a89e 100755 --- a/configure +++ b/configure @@ -1,12 +1,12 @@ #! /bin/sh # configure script for Clzip - LZMA lossless data compressor -# Copyright (C) 2010-2023 Antonio Diaz Diaz. +# Copyright (C) 2010-2024 Antonio Diaz Diaz. # # This configure script is free software: you have unlimited permission # to copy, distribute, and modify it. pkgname=clzip -pkgversion=1.14-rc1 +pkgversion=1.14 progname=clzip srctrigger=doc/${pkgname}.texi @@ -171,7 +171,7 @@ echo "MAKEINFO = ${MAKEINFO}" rm -f Makefile cat > Makefile << EOF # Makefile for Clzip - LZMA lossless data compressor -# Copyright (C) 2010-2023 Antonio Diaz Diaz. +# Copyright (C) 2010-2024 Antonio Diaz Diaz. # This file was generated automatically by configure. Don't edit. # # This Makefile is free software: you have unlimited permission diff --git a/decoder.c b/decoder.c index 0217fc6..baea067 100644 --- a/decoder.c +++ b/decoder.c @@ -1,5 +1,5 @@ /* Clzip - LZMA lossless data compressor - Copyright (C) 2010-2023 Antonio Diaz Diaz. + Copyright (C) 2010-2024 Antonio Diaz Diaz. 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 diff --git a/decoder.h b/decoder.h index 3b52eee..d160135 100644 --- a/decoder.h +++ b/decoder.h @@ -1,5 +1,5 @@ /* Clzip - LZMA lossless data compressor - Copyright (C) 2010-2023 Antonio Diaz Diaz. + Copyright (C) 2010-2024 Antonio Diaz Diaz. 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 diff --git a/doc/clzip.1 b/doc/clzip.1 index f801503..46f69e9 100644 --- a/doc/clzip.1 +++ b/doc/clzip.1 @@ -1,15 +1,14 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.2. -.TH CLZIP "1" "December 2023" "clzip 1.14-rc1" "User Commands" +.TH CLZIP "1" "January 2024" "clzip 1.14" "User Commands" .SH NAME clzip \- reduces the size of files .SH SYNOPSIS .B clzip [\fI\,options\/\fR] [\fI\,files\/\fR] .SH DESCRIPTION -Clzip is a C language version of lzip, fully compatible with lzip 1.4 or -newer. As clzip is written in C, it may be easier to integrate in -applications like package managers, embedded devices, or systems lacking a -C++ compiler. +Clzip is a C language version of lzip, compatible with lzip 1.4 or newer. As +clzip is written in C, it may be easier to integrate in applications like +package managers, embedded devices, or systems lacking a C++ compiler. .PP Lzip is a lossless data compressor with a user interface similar to the one of gzip or bzip2. Lzip uses a simplified form of the 'Lempel\-Ziv\-Markov @@ -123,7 +122,7 @@ Report bugs to lzip\-bug@nongnu.org .br Clzip home page: http://www.nongnu.org/lzip/clzip.html .SH COPYRIGHT -Copyright \(co 2023 Antonio Diaz Diaz. +Copyright \(co 2024 Antonio Diaz Diaz. License GPLv2+: GNU GPL version 2 or later .br This is free software: you are free to change and redistribute it. diff --git a/doc/clzip.info b/doc/clzip.info index 8556191..2d83e3c 100644 --- a/doc/clzip.info +++ b/doc/clzip.info @@ -11,7 +11,7 @@ File: clzip.info, Node: Top, Next: Introduction, Up: (dir) Clzip Manual ************ -This manual is for Clzip (version 1.14-rc1, 20 December 2023). +This manual is for Clzip (version 1.14, 22 January 2024). * Menu: @@ -29,7 +29,7 @@ This manual is for Clzip (version 1.14-rc1, 20 December 2023). * Concept index:: Index of concepts - Copyright (C) 2010-2023 Antonio Diaz Diaz. + Copyright (C) 2010-2024 Antonio Diaz Diaz. This manual is free documentation: you have unlimited permission to copy, distribute, and modify it. @@ -40,10 +40,9 @@ File: clzip.info, Node: Introduction, Next: Output, Prev: Top, Up: Top 1 Introduction ************** -Clzip is a C language version of lzip, fully compatible with lzip 1.4 or -newer. As clzip is written in C, it may be easier to integrate in -applications like package managers, embedded devices, or systems lacking a -C++ compiler. +Clzip is a C language version of lzip, compatible with lzip 1.4 or newer. +As clzip is written in C, it may be easier to integrate in applications like +package managers, embedded devices, or systems lacking a C++ compiler. Lzip is a lossless data compressor with a user interface similar to the one of gzip or bzip2. Lzip uses a simplified form of the 'Lempel-Ziv-Markov @@ -464,14 +463,9 @@ method is far more difficult. Lzip has been designed, written, and tested with great care to replace gzip and bzip2 as the standard general-purpose compressed format for Unix-like systems. This chapter describes the lessons learned from these -previous formats, and their application to the design of lzip. - - Lzip is developed by volunteers who lack the resources required for -extensive testing in all circumstances. It is up to you to test lzip before -using it in mission-critical applications. However, a compressor like lzip -is not a toy, and maintaining it is not a hobby. Many people's data depend -on it. Therefore the lzip file format has been reviewed carefully and is -believed to be free from negligent design errors. +previous formats, and their application to the design of lzip. The lzip +format specification has been reviewed carefully and is believed to be free +from design errors. 4.1 Format design @@ -1016,8 +1010,7 @@ decoded) and 'code' (representing the current point within 'range'). 'range' is initialized to 2^32 - 1, and 'code' is initialized to 0. The range encoder produces a first 0 byte that must be ignored by the -range decoder. This is done by shifting 5 bytes in the initialization of -'code' instead of 4. (See the 'Range_decoder' constructor in the source). +range decoder. (See the 'Range_decoder' constructor in the source). 7.4 Decoding and checking the LZMA stream @@ -1197,7 +1190,7 @@ Appendix A Reference source code ******************************** /* Lzd - Educational decompressor for the lzip format - Copyright (C) 2013-2023 Antonio Diaz Diaz. + Copyright (C) 2013-2024 Antonio Diaz Diaz. This program is free software. Redistribution and use in source and binary forms, with or without modification, are permitted provided @@ -1368,9 +1361,9 @@ public: return symbol; } - unsigned decode_bit( Bit_model & bm ) + bool decode_bit( Bit_model & bm ) { - unsigned symbol; + bool symbol; const uint32_t bound = ( range >> bit_model_total_bits ) * bm.probability; if( code < bound ) { @@ -1416,8 +1409,8 @@ public: unsigned symbol = 1; for( int i = 7; i >= 0; --i ) { - const unsigned match_bit = ( match_byte >> i ) & 1; - const unsigned bit = decode_bit( bm[symbol+(match_bit<<8)+0x100] ); + const bool match_bit = ( match_byte >> i ) & 1; + const bool bit = decode_bit( bm[symbol+(match_bit<<8)+0x100] ); symbol = ( symbol << 1 ) | bit; if( match_bit != bit ) { @@ -1621,7 +1614,7 @@ int main( const int argc, const char * const argv[] ) "See the lzip manual for an explanation of the code.\n" "\nUsage: %s [-d] < file.lz > file\n" "Lzd decompresses from standard input to standard output.\n" - "\nCopyright (C) 2023 Antonio Diaz Diaz.\n" + "\nCopyright (C) 2024 Antonio Diaz Diaz.\n" "License 2-clause BSD.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" @@ -1714,22 +1707,22 @@ Concept index  Tag Table: Node: Top205 -Node: Introduction1212 -Node: Output7342 -Node: Invoking clzip8945 -Ref: --trailing-error9823 -Node: Quality assurance19929 -Node: Algorithm29060 -Node: File format32468 -Ref: coded-dict-size33898 -Node: Stream format35129 -Ref: what-is-coded37525 -Node: Trailing data46478 -Node: Examples48816 -Ref: concat-example50266 -Node: Problems51496 -Node: Reference source code52032 -Node: Concept index67094 +Node: Introduction1207 +Node: Output7331 +Node: Invoking clzip8934 +Ref: --trailing-error9812 +Node: Quality assurance19918 +Node: Algorithm28733 +Node: File format32141 +Ref: coded-dict-size33571 +Node: Stream format34802 +Ref: what-is-coded37198 +Node: Trailing data46072 +Node: Examples48410 +Ref: concat-example49860 +Node: Problems51090 +Node: Reference source code51626 +Node: Concept index66672  End Tag Table diff --git a/doc/clzip.texi b/doc/clzip.texi index 633526b..c98e026 100644 --- a/doc/clzip.texi +++ b/doc/clzip.texi @@ -6,8 +6,8 @@ @finalout @c %**end of header -@set UPDATED 20 December 2023 -@set VERSION 1.14-rc1 +@set UPDATED 22 January 2024 +@set VERSION 1.14 @dircategory Compression @direntry @@ -51,7 +51,7 @@ This manual is for Clzip (version @value{VERSION}, @value{UPDATED}). @end menu @sp 1 -Copyright @copyright{} 2010-2023 Antonio Diaz Diaz. +Copyright @copyright{} 2010-2024 Antonio Diaz Diaz. This manual is free documentation: you have unlimited permission to copy, distribute, and modify it. @@ -63,10 +63,9 @@ distribute, and modify it. @cindex introduction @uref{http://www.nongnu.org/lzip/clzip.html,,Clzip} -is a C language version of lzip, fully compatible with @w{lzip 1.4} or -newer. As clzip is written in C, it may be easier to integrate in -applications like package managers, embedded devices, or systems lacking a -C++ compiler. +is a C language version of lzip, compatible with @w{lzip 1.4} or newer. +As clzip is written in C, it may be easier to integrate in applications like +package managers, embedded devices, or systems lacking a C++ compiler. @uref{http://www.nongnu.org/lzip/lzip.html,,Lzip} is a lossless data compressor with a user interface similar to the one @@ -516,14 +515,9 @@ method is far more difficult.@* Lzip has been designed, written, and tested with great care to replace gzip and bzip2 as the standard general-purpose compressed format for Unix-like systems. This chapter describes the lessons learned from these previous -formats, and their application to the design of lzip. - -Lzip is developed by volunteers who lack the resources required for -extensive testing in all circumstances. It is up to you to test lzip before -using it in mission-critical applications. However, a compressor like lzip -is not a toy, and maintaining it is not a hobby. Many people's data depend -on it. Therefore the lzip file format has been reviewed carefully and is -believed to be free from negligent design errors. +formats, and their application to the design of lzip. The lzip format +specification has been reviewed carefully and is believed to be free from +design errors. @sp 1 @section Format design @@ -1092,9 +1086,7 @@ not yet decoded) and @samp{code} (representing the current point within @samp{code} is initialized to 0. The range encoder produces a first 0 byte that must be ignored by the -range decoder. This is done by shifting 5 bytes in the initialization of -@samp{code} instead of 4. (See the @samp{Range_decoder} constructor in -the source). +range decoder. (See the @samp{Range_decoder} constructor in the source). @sp 1 @section Decoding and checking the LZMA stream @@ -1315,7 +1307,7 @@ find by running @w{@samp{clzip --version}}. @verbatim /* Lzd - Educational decompressor for the lzip format - Copyright (C) 2013-2023 Antonio Diaz Diaz. + Copyright (C) 2013-2024 Antonio Diaz Diaz. This program is free software. Redistribution and use in source and binary forms, with or without modification, are permitted provided @@ -1486,9 +1478,9 @@ public: return symbol; } - unsigned decode_bit( Bit_model & bm ) + bool decode_bit( Bit_model & bm ) { - unsigned symbol; + bool symbol; const uint32_t bound = ( range >> bit_model_total_bits ) * bm.probability; if( code < bound ) { @@ -1534,8 +1526,8 @@ public: unsigned symbol = 1; for( int i = 7; i >= 0; --i ) { - const unsigned match_bit = ( match_byte >> i ) & 1; - const unsigned bit = decode_bit( bm[symbol+(match_bit<<8)+0x100] ); + const bool match_bit = ( match_byte >> i ) & 1; + const bool bit = decode_bit( bm[symbol+(match_bit<<8)+0x100] ); symbol = ( symbol << 1 ) | bit; if( match_bit != bit ) { @@ -1739,7 +1731,7 @@ int main( const int argc, const char * const argv[] ) "See the lzip manual for an explanation of the code.\n" "\nUsage: %s [-d] < file.lz > file\n" "Lzd decompresses from standard input to standard output.\n" - "\nCopyright (C) 2023 Antonio Diaz Diaz.\n" + "\nCopyright (C) 2024 Antonio Diaz Diaz.\n" "License 2-clause BSD.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" diff --git a/encoder.c b/encoder.c index a1fd214..1e2bd64 100644 --- a/encoder.c +++ b/encoder.c @@ -1,5 +1,5 @@ /* Clzip - LZMA lossless data compressor - Copyright (C) 2010-2023 Antonio Diaz Diaz. + Copyright (C) 2010-2024 Antonio Diaz Diaz. 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 diff --git a/encoder.h b/encoder.h index f30a8b6..be36341 100644 --- a/encoder.h +++ b/encoder.h @@ -1,5 +1,5 @@ /* Clzip - LZMA lossless data compressor - Copyright (C) 2010-2023 Antonio Diaz Diaz. + Copyright (C) 2010-2024 Antonio Diaz Diaz. 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 diff --git a/encoder_base.c b/encoder_base.c index d0d53e2..5f40f9b 100644 --- a/encoder_base.c +++ b/encoder_base.c @@ -1,5 +1,5 @@ /* Clzip - LZMA lossless data compressor - Copyright (C) 2010-2023 Antonio Diaz Diaz. + Copyright (C) 2010-2024 Antonio Diaz Diaz. 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 diff --git a/encoder_base.h b/encoder_base.h index 49ed200..c947904 100644 --- a/encoder_base.h +++ b/encoder_base.h @@ -1,5 +1,5 @@ /* Clzip - LZMA lossless data compressor - Copyright (C) 2010-2023 Antonio Diaz Diaz. + Copyright (C) 2010-2024 Antonio Diaz Diaz. 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 diff --git a/fast_encoder.c b/fast_encoder.c index 518a514..bab87ca 100644 --- a/fast_encoder.c +++ b/fast_encoder.c @@ -1,5 +1,5 @@ /* Clzip - LZMA lossless data compressor - Copyright (C) 2010-2023 Antonio Diaz Diaz. + Copyright (C) 2010-2024 Antonio Diaz Diaz. 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 diff --git a/fast_encoder.h b/fast_encoder.h index 9e9d010..e4e4000 100644 --- a/fast_encoder.h +++ b/fast_encoder.h @@ -1,5 +1,5 @@ /* Clzip - LZMA lossless data compressor - Copyright (C) 2010-2023 Antonio Diaz Diaz. + Copyright (C) 2010-2024 Antonio Diaz Diaz. 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 diff --git a/list.c b/list.c index a1bb638..22fea92 100644 --- a/list.c +++ b/list.c @@ -1,5 +1,5 @@ /* Clzip - LZMA lossless data compressor - Copyright (C) 2010-2023 Antonio Diaz Diaz. + Copyright (C) 2010-2024 Antonio Diaz Diaz. 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 diff --git a/lzip.h b/lzip.h index fa8caf3..abf1a27 100644 --- a/lzip.h +++ b/lzip.h @@ -1,5 +1,5 @@ /* Clzip - LZMA lossless data compressor - Copyright (C) 2010-2023 Antonio Diaz Diaz. + Copyright (C) 2010-2024 Antonio Diaz Diaz. 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 diff --git a/lzip_index.c b/lzip_index.c index 6f64205..b7d594c 100644 --- a/lzip_index.c +++ b/lzip_index.c @@ -1,5 +1,5 @@ /* Clzip - LZMA lossless data compressor - Copyright (C) 2010-2023 Antonio Diaz Diaz. + Copyright (C) 2010-2024 Antonio Diaz Diaz. 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 diff --git a/lzip_index.h b/lzip_index.h index 5e2f77f..e273eaf 100644 --- a/lzip_index.h +++ b/lzip_index.h @@ -1,5 +1,5 @@ /* Clzip - LZMA lossless data compressor - Copyright (C) 2010-2023 Antonio Diaz Diaz. + Copyright (C) 2010-2024 Antonio Diaz Diaz. 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 diff --git a/main.c b/main.c index e5a8dd5..788699f 100644 --- a/main.c +++ b/main.c @@ -1,5 +1,5 @@ /* Clzip - LZMA lossless data compressor - Copyright (C) 2010-2023 Antonio Diaz Diaz. + Copyright (C) 2010-2024 Antonio Diaz Diaz. 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 @@ -80,7 +80,7 @@ int verbosity = 0; static const char * const program_name = "clzip"; -static const char * const program_year = "2023"; +static const char * const program_year = "2024"; static const char * invocation_name = "clzip"; /* default value */ static const struct { const char * from; const char * to; } known_extensions[] = { @@ -105,10 +105,9 @@ static bool delete_output_on_interrupt = false; static void show_help( void ) { - printf( "Clzip is a C language version of lzip, fully compatible with lzip 1.4 or\n" - "newer. As clzip is written in C, it may be easier to integrate in\n" - "applications like package managers, embedded devices, or systems lacking a\n" - "C++ compiler.\n" + printf( "Clzip is a C language version of lzip, compatible with lzip 1.4 or newer. As\n" + "clzip is written in C, it may be easier to integrate in applications like\n" + "package managers, embedded devices, or systems lacking a C++ compiler.\n" "\nLzip is a lossless data compressor with a user interface similar to the one\n" "of gzip or bzip2. Lzip uses a simplified form of the 'Lempel-Ziv-Markov\n" "chain-Algorithm' (LZMA) stream format to maximize interoperability. The\n" @@ -621,7 +620,7 @@ static void close_and_set_permissions( const struct stat * const in_statsp ) if( in_statsp ) { const mode_t mode = in_statsp->st_mode; - /* fchown will in many cases return with EPERM, which can be safely ignored. */ + /* fchown in many cases returns with EPERM, which can be safely ignored. */ if( fchown( outfd, in_statsp->st_uid, in_statsp->st_gid ) == 0 ) { if( fchmod( outfd, mode ) != 0 ) warning = true; } else @@ -1134,11 +1133,11 @@ int main( const int argc, const char * const argv[] ) int retval = 0; const bool one_to_one = !to_stdout && program_mode != m_test && !to_file; bool stdin_used = false; + struct stat in_stats; for( i = 0; i < num_filenames; ++i ) { const char * input_filename = ""; int infd; - struct stat in_stats; Pp_set_name( &pp, filenames[i] ); if( strcmp( filenames[i], "-" ) == 0 ) @@ -1205,7 +1204,9 @@ int main( const int argc, const char * const argv[] ) ( program_mode != m_compress || volume_size == 0 ) ) remove( input_filename ); } - if( delete_output_on_interrupt ) close_and_set_permissions( 0 ); /* -o */ + if( delete_output_on_interrupt ) /* -o */ + close_and_set_permissions( ( retval == 0 && !stdin_used && + filenames_given && num_filenames == 1 ) ? &in_stats : 0 ); else if( outfd >= 0 && close( outfd ) != 0 ) /* -c */ { show_error( "Error closing stdout", errno, false ); diff --git a/testsuite/check.sh b/testsuite/check.sh index f880280..100deae 100755 --- a/testsuite/check.sh +++ b/testsuite/check.sh @@ -1,6 +1,6 @@ #! /bin/sh # check script for Clzip - LZMA lossless data compressor -# Copyright (C) 2010-2023 Antonio Diaz Diaz. +# Copyright (C) 2010-2024 Antonio Diaz Diaz. # # This script is free software: you have unlimited permission # to copy, distribute, and modify it. -- cgit v1.2.3