On 7/26/2010 18:38, Antonio Diaz Diaz wrote:
Version 1.11-rc2 of lzip is ready for testing here
http://download.savannah.gnu.org/releases/lzip/lzip-1.11-rc2.tar.gz
http://download.savannah.gnu.org/releases/lzip/lzip-1.11-rc2.tar.lz
The md5sums are:
b949dd2692c52e0819fad895d19b18c1 lzip-1.11-rc2.tar.gz
b6e0093288718779d7930c06b8f4fe6f lzip-1.11-rc2.tar.lz
Please, test it and report any bugs you find.
Lzip is a lossless data compressor based on the LZMA algorithm, with
very safe integrity checking and a user interface similar to the one of
gzip or bzip2.
The homepage is at http://www.nongnu.org/lzip/lzip.html.
Changes in this version:
* Lziprecover is now able to repair any 1-byte error in the lzma stream
of damaged lzip files.
* Decompressor has been modified to detect file errors earlier,
improving efficiency of lziprecover's new repair capability. This change
also prevents (harmless) access to uninitialized memory when
decompressing a corrupt file.
Regards,
Antonio Diaz, lzip author and maintainer.
Hi,
on Win32, the open with o_binary don't seem to work, as the testsuites
are failing. Forcing with setmode in decoder.cc readblock and writeblock
makes it pass.
I have attached a patch that shows my quick and dirty changes.
Possibly there is a text mode file descriptor leaking in. Any ideas?
diff --git a/decoder.cc b/decoder.cc
index fac0908..a7d205f 100644
--- a/decoder.cc
+++ b/decoder.cc
@@ -16,6 +16,7 @@
*/
#define _FILE_OFFSET_BITS 64
+#define __STDC_FORMAT_MACROS // We want printf formats
#include <algorithm>
#include <cerrno>
@@ -24,7 +25,8 @@
#include <cstring>
#include <string>
#include <vector>
-#include <stdint.h>
+#include <fcntl.h>
+#include <inttypes.h>
#include <unistd.h>
#include "lzip.h"
@@ -59,6 +61,7 @@ int readblock( const int fd, uint8_t * const buf, const int
size ) throw()
{
int rest = size;
errno = 0;
+ setmode (fd, O_BINARY);
while( rest > 0 )
{
errno = 0;
@@ -78,6 +81,7 @@ int writeblock( const int fd, const uint8_t * const buf,
const int size ) throw(
{
int rest = size;
errno = 0;
+ setmode (fd, O_BINARY);
while( rest > 0 )
{
errno = 0;
@@ -165,7 +169,7 @@ bool LZ_decoder::verify_trailer( const Pretty_print & pp )
const
if( verbosity >= 0 )
{
pp();
- std::fprintf( stderr, "data size mismatch; trailer says %lld, data size
is %lld (0x%llX).\n",
+ std::fprintf( stderr, "data size mismatch; trailer says %"PRId64", data
size is %"PRId64" (0x%"PRIX64").\n",
trailer.data_size(), data_position(), data_position() );
}
}
@@ -175,7 +179,7 @@ bool LZ_decoder::verify_trailer( const Pretty_print & pp )
const
if( verbosity >= 0 )
{
pp();
- std::fprintf( stderr, "member size mismatch; trailer says %lld, member
size is %lld (0x%llX).\n",
+ std::fprintf( stderr, "member size mismatch; trailer says %"PRId64",
member size is %"PRId64" (0x%"PRIX64").\n",
trailer.member_size(), member_size, member_size );
}
}
@@ -185,7 +189,7 @@ bool LZ_decoder::verify_trailer( const Pretty_print & pp )
const
( 8.0 * member_size ) / data_position(),
100.0 * ( 1.0 - ( (double)member_size / data_position() ) )
);
if( !error && verbosity >= 3 )
- std::fprintf( stderr, "data crc %08X, data size %9lld, member size %8lld.
",
+ std::fprintf( stderr, "data crc %08X, data size %9"PRId64", member size
%8"PRId64". ",
(unsigned int)trailer.data_crc(), trailer.data_size(),
trailer.member_size() );
return !error;
diff --git a/lziprecover.cc b/lziprecover.cc
index c92944b..c9a9dae 100644
--- a/lziprecover.cc
+++ b/lziprecover.cc
@@ -22,6 +22,7 @@
*/
#define _FILE_OFFSET_BITS 64
+#define __STDC_FORMAT_MACROS // We want printf formats
#include <cerrno>
#include <cstdio>
@@ -30,7 +31,7 @@
#include <string>
#include <vector>
#include <fcntl.h>
-#include <stdint.h>
+#include <inttypes.h>
#include <unistd.h>
#include <sys/stat.h>
@@ -38,6 +39,15 @@
#include "lzip.h"
#include "decoder.h"
+#if defined __MSVCRT__
+#define S_ISSOCK(X) 0
+#define fchmod(x,y) 0
+#define fchown(x,y,z) 0
+#define S_IRGRP 0
+#define S_IWGRP 0
+#define S_IROTH 0
+#define S_IWOTH 0
+#endif
namespace {
@@ -387,7 +397,7 @@ int repair_file( const std::string & input_filename )
{
if( verbosity >= 0 )
{
- std::printf( "Trying position %lld \r", pos );
+ std::printf( "Trying position %"PRId64" \r", pos );
std::fflush( stdout );
}
uint8_t byte;
diff --git a/main.cc b/main.cc
index dde983e..2fd645a 100644
--- a/main.cc
+++ b/main.cc
@@ -22,6 +22,7 @@
*/
#define _FILE_OFFSET_BITS 64
+#define __STDC_FORMAT_MACROS // We want printf formats
#include <algorithm>
#include <cerrno>
@@ -33,7 +34,7 @@
#include <string>
#include <vector>
#include <fcntl.h>
-#include <stdint.h>
+#include <inttypes.h>
#include <unistd.h>
#include <utime.h>
#include <sys/stat.h>
@@ -57,6 +58,16 @@
#define ULLONG_MAX 0xFFFFFFFFFFFFFFFFULL
#endif
+#if defined __MSVCRT__
+#define S_ISSOCK(X) 0
+#define fchmod(x,y) 0
+#define fchown(x,y,z) 0
+#define S_IRGRP 0
+#define S_IWGRP 0
+#define S_IROTH 0
+#define S_IWOTH 0
+#endif
+
namespace {
@@ -150,7 +161,7 @@ const char * format_num( long long num, long long limit =
9999,
for( int i = 0; i < 8 && ( llabs( num ) > limit ||
( llabs( num ) >= factor && num % factor == 0 ) ); ++i )
{ num /= factor; p = prefix[i]; }
- snprintf( buf, sizeof buf, "%lld %s", num, p );
+ snprintf( buf, sizeof buf, "%"PRId64" %s", num, p );
return buf;
}
@@ -456,7 +467,7 @@ int compress( const long long member_size, const long long
volume_size,
std::fprintf( stderr, "no data compressed.\n" );
else
std::fprintf( stderr, "%6.3f:1, %6.3f bits/byte, "
- "%5.2f%% saved, %lld in, %lld out.\n",
+ "%5.2f%% saved, %"PRId64" in, %"PRId64" out.\n",
(double)in_size / out_size,
( 8.0 * out_size ) / in_size,
100.0 * ( 1.0 - ( (double)out_size / in_size ) ),
@@ -527,10 +538,10 @@ int decompress( const int infd, const Pretty_print & pp,
const bool testing )
{
pp();
if( result == 2 )
- std::fprintf( stderr, "file ends unexpectedly at pos %lld\n",
+ std::fprintf( stderr, "file ends unexpectedly at pos %"PRId64"\n",
partial_file_pos );
else
- std::fprintf( stderr, "decoder error at pos %lld\n",
+ std::fprintf( stderr, "decoder error at pos %"PRId64"\n",
partial_file_pos );
}
retval = 2; break;
@@ -559,7 +570,9 @@ extern "C" void signal_handler( int ) throw()
void set_signals() throw()
{
+#if !defined __MSVCRT__
std::signal( SIGHUP, signal_handler );
+#endif
std::signal( SIGINT, signal_handler );
std::signal( SIGTERM, signal_handler );
}
diff --git a/testsuite/check.sh b/testsuite/check.sh
index 95f53ca..8f360d0 100755
--- a/testsuite/check.sh
+++ b/testsuite/check.sh
@@ -26,8 +26,8 @@ cd "${objdir}"/tmp
cat "${testdir}"/test.txt > in || framework_failure
fail=0
-"${LZIP}" -t "${testdir}"/test.lz || fail=1
-"${LZIP}" -cd "${testdir}"/test.lz > copy || fail=1
+"${LZIP}" -t `cygpath -wa "${testdir}"/test.lz` || fail=1
+"${LZIP}" -cd `cygpath -wa "${testdir}"/test.lz` > copy || fail=1
cmp in copy || fail=1
for i in s4Ki 0 1 2 3 4 5 6 7 8 9 ; do
_______________________________________________
Lzip-bug mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lzip-bug