Hello community,
here is the log from the commit of package zsync for openSUSE:Factory
checked in at Thu Oct 28 14:29:00 CEST 2010.
--------
--- zsync/zsync.changes 2010-09-03 23:35:46.000000000 +0200
+++ zsync/zsync.changes 2010-10-20 12:22:47.000000000 +0200
@@ -1,0 +2,11 @@
+Wed Oct 20 12:20:01 CEST 2010 - ro@suse.de
+
+- update to 0.6.2
+ - fix for using zsync client on files >2GB on 32bit systems.
+ - fix redirect handling.
+ - improve some edge cases dealing with unusual seed data patterns.
+ - optimise by stopping reading seed files if target file is complete.
+ - fix infinite loop in zsyncmake when given a truncated (invalid) .gz
+ - fix --disable-profile to configure.
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
Old:
----
zsync-0.6.1.tar.bz2
New:
----
zsync-0.6.2.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ zsync.spec ++++++
--- /var/tmp/diff_new_pack.P6dcU2/_old 2010-10-28 14:27:57.000000000 +0200
+++ /var/tmp/diff_new_pack.P6dcU2/_new 2010-10-28 14:27:57.000000000 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package zsync (Version 0.6.1)
+# spec file for package zsync (Version 0.6.2)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@@ -18,8 +18,8 @@
Name: zsync
-Version: 0.6.1
-Release: 6
+Version: 0.6.2
+Release: 1
Source: http://zsync.moria.org.uk/download/zsync-%{version}.tar.bz2
Url: http://zsync.moria.org.uk/
Group: Productivity/Networking/Other
@@ -28,6 +28,7 @@
BuildRequires: gcc glibc-devel make
BuildRequires: gcc-c++
Summary: Client-side Implementation of the Rsync Algorithm over HTTP
+# PATCH-FIX-OPENSUSE avoid build time in generated files for build compare
Patch: zsync-no-build-date.patch
%description
++++++ zsync-0.6.1.tar.bz2 -> zsync-0.6.2.tar.bz2 ++++++
++++ 15802 lines of diff (skipped)
++++ retrying with extended exclude list
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/zsync-0.6.1/Makefile.am new/zsync-0.6.2/Makefile.am
--- old/zsync-0.6.1/Makefile.am 2009-01-22 22:05:56.000000000 +0100
+++ new/zsync-0.6.2/Makefile.am 2010-09-20 14:35:08.000000000 +0200
@@ -1,5 +1,6 @@
AUTOMAKE_OPTIONS = check-news
+ACLOCAL_AMFLAGS = -I autotools
SUBDIRS = librcksum zlib libzsync doc
@@ -27,7 +28,7 @@
docdir=$(prefix)/share/doc/@PACKAGE@
doc_DATA = COPYING README
-EXTRA_DIST = bootstrap INSTALL README COPYING $(AUX_DIST_GEN) check-zsyncmake
+EXTRA_DIST = INSTALL README COPYING $(AUX_DIST_GEN) check-zsyncmake
TESTS_ENVIRONMENT = top_builddir=$(top_builddir)
TESTS = check-zsyncmake
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/zsync-0.6.1/NEWS new/zsync-0.6.2/NEWS
--- old/zsync-0.6.1/NEWS 2009-04-17 21:57:06.000000000 +0200
+++ new/zsync-0.6.2/NEWS 2010-09-19 22:51:53.000000000 +0200
@@ -1,3 +1,11 @@
+Changes in 0.6.2
+- fix for using zsync client on files >2GB on 32bit systems.
+- fix redirect handling.
+- improve some edge cases dealing with unusual seed data patterns.
+- optimise by stopping reading seed files if target file is complete.
+- fix infinite loop in zsyncmake when given a truncated (invalid) .gz
+- fix --disable-profile to configure.
+
Changes in 0.6.1
- recompression support for gzip files made with zlib:gzio.c or gzip -n
- fix compilation on MacOS X
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/zsync-0.6.1/README new/zsync-0.6.2/README
--- old/zsync-0.6.1/README 2009-04-13 16:47:00.000000000 +0200
+++ new/zsync-0.6.2/README 2010-09-19 22:51:53.000000000 +0200
@@ -1,4 +1,4 @@
-zsync 0.6.1
+zsync 0.6.2
===========
zsync is a file transfer program. It allows you to download a file from a
@@ -104,7 +104,8 @@
zsync uses a large part of zlib - this code, in the zlib subdirectory, is
copyright 1995-2003 Jean-loup Gailly and Mark Adler, see zlib/README for
-details.
+details. This code contains local changes by me that are not compatible with
+and not available in standard zlib; see zlib/README.zsync for an explanation.
zsync includes an implementation of getaddrinfo by Motoyuki Kasahara. See
getaddrinfo.c for the license, it's a BSD-style license; but normally zsync
@@ -134,8 +135,9 @@
providing the hosting facilities for the downloads and mailing list, and the
compile farm for testing portability.
-Also, thanks to �rsek L�szl�, James Montgomerie, James Antill,
-saul@alien-science.org, Kent Mein, Marc Lehmann, Robert Lemmen, Ricardo
-Correia, Karl Kalleberg, Michael Stone, Richard Lucassen, Duncan Mac-Vicar and
-Jari Aalto for useful feedback and bug reports for previous versions.
+Also, thanks to Érsek László, James Montgomerie, James Antill,
+saul@alien-science.org, Kent Mein, Marc Lehmann, Robert Lemmen, Mark Adler,
+Ricardo Correia, Karl Kalleberg, Michael Stone, Richard Lucassen, Duncan
+Mac-Vicar, Jari Aalto, Marcin Mirosław, Jan Varho and Loïc Minier for useful
+feedback and bug reports for previous versions.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/zsync-0.6.1/autotools/missing new/zsync-0.6.2/autotools/missing
--- old/zsync-0.6.1/autotools/missing 2009-04-14 10:15:56.000000000 +0200
+++ new/zsync-0.6.2/autotools/missing 2010-09-20 14:35:40.000000000 +0200
@@ -1,10 +1,10 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
-scriptversion=2006-05-10.23
+scriptversion=2009-04-28.21; # UTC
-# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006
-# Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
+# 2008, 2009 Free Software Foundation, Inc.
# Originally by Fran,cois Pinard , 1996.
# This program is free software; you can redistribute it and/or modify
@@ -18,9 +18,7 @@
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program. If not, see http://www.gnu.org/licenses/.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
@@ -89,6 +87,9 @@
tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
+Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
+\`g' are ignored when checking the name.
+
Send bug reports to ."
exit $?
;;
@@ -106,15 +107,22 @@
esac
+# normalize program name to check for.
+program=`echo "$1" | sed '
+ s/^gnu-//; t
+ s/^gnu//; t
+ s/^g//; t'`
+
# Now exit if we have it, but it failed. Also exit now if we
# don't have it and --version was passed (most likely to detect
-# the program).
+# the program). This is about non-GNU programs, so use $1 not
+# $program.
case $1 in
- lex|yacc)
+ lex*|yacc*)
# Not GNU programs, they don't have --version.
;;
- tar)
+ tar*)
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
@@ -138,7 +146,7 @@
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
-case $1 in
+case $program in
aclocal*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
@@ -148,7 +156,7 @@
touch aclocal.m4
;;
- autoconf)
+ autoconf*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`${configure_ac}'. You might want to install the
@@ -157,7 +165,7 @@
touch configure
;;
- autoheader)
+ autoheader*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
@@ -187,7 +195,7 @@
while read f; do touch "$f"; done
;;
- autom4te)
+ autom4te*)
echo 1>&2 "\
WARNING: \`$1' is needed, but is $msg.
You might have modified some files without having the
@@ -210,7 +218,7 @@
fi
;;
- bison|yacc)
+ bison*|yacc*)
echo 1>&2 "\
WARNING: \`$1' $msg. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
@@ -240,7 +248,7 @@
fi
;;
- lex|flex)
+ lex*|flex*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
@@ -263,7 +271,7 @@
fi
;;
- help2man)
+ help2man*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a dependency of a manual page. You may need the
@@ -277,11 +285,11 @@
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
- exit 1
+ exit $?
fi
;;
- makeinfo)
+ makeinfo*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
@@ -310,7 +318,7 @@
touch $file
;;
- tar)
+ tar*)
shift
# We have already tried tar in the generic part.
@@ -363,5 +371,6 @@
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
# End:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/zsync-0.6.1/bootstrap new/zsync-0.6.2/bootstrap
--- old/zsync-0.6.1/bootstrap 2006-08-05 17:04:37.000000000 +0200
+++ new/zsync-0.6.2/bootstrap 1970-01-01 01:00:00.000000000 +0100
@@ -1,9 +0,0 @@
-#!/bin/sh -e
-#
-# cphipps - short script to start building from a maintainer-clean'ed tree
-#
-mkdir -p autotools
-aclocal -I autotools
-autoheader
-automake --add-missing
-autoconf
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/zsync-0.6.1/check-zsyncmake new/zsync-0.6.2/check-zsyncmake
--- old/zsync-0.6.1/check-zsyncmake 2009-04-13 16:53:20.000000000 +0200
+++ new/zsync-0.6.2/check-zsyncmake 2010-09-20 14:35:08.000000000 +0200
@@ -3,7 +3,7 @@
${top_builddir-.}/zsyncmake -u foo -f foo ${srcdir-.}/INSTALL
# Note TAB required for Solaris cksum
-x=`sed -e '1s/0\.6\.1/XXX/' foo.zsync | cksum | sed -e 's/[ ][0-9].*//'`
-[ $x = 1368366867 ]
+x=`perl -pe 's/^(zsync:).*$/$1 XXX/; s/^(MTime:)(.*)$/my ($x, $y) = ($1, $2); $y =~ s![a-zA-Z0-9]!_!g; "$x$y"/e;' foo.zsync | tee foo.tr.zsync | cksum | sed -e 's/[ ][0-9].*//'`
+[ $x = 4103379992 ]
rm foo.zsync
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/zsync-0.6.1/client.c new/zsync-0.6.2/client.c
--- old/zsync-0.6.1/client.c 2009-01-22 22:03:18.000000000 +0100
+++ new/zsync-0.6.2/client.c 2010-09-19 22:51:53.000000000 +0200
@@ -543,14 +543,10 @@
*target file */
int i;
- /* Try any seed files supplied by the command line */
- for (i = 0; i < nseedfiles; i++) {
- read_seed_file(zs, seedfiles[i]);
- }
/* If the target file already exists, we're probably updating that file
* - so it's a seed file */
if (!access(filename, R_OK)) {
- read_seed_file(zs, filename);
+ seedfiles = append_ptrlist(&nseedfiles, seedfiles, filename);
}
/* If the .part file exists, it's probably an interrupted earlier
* effort; a normal HTTP client would 'resume' from where it got to,
@@ -558,9 +554,26 @@
* current version on the remote) and doesn't need to, because we can
* treat it like any other local source of data. Use it now. */
if (!access(temp_file, R_OK)) {
- read_seed_file(zs, temp_file);
+ seedfiles = append_ptrlist(&nseedfiles, seedfiles, temp_file);
}
+ /* Try any seed files supplied by the command line */
+ for (i = 0; i < nseedfiles; i++) {
+ int dup = 0, j;
+
+ /* And stop reading seed files once the target is complete. */
+ if (zsync_status(zs) >= 2) break;
+
+ /* Skip dups automatically, to save the person running the program
+ * having to worry about this stuff. */
+ for (j = 0; j < i; j++) {
+ if (!strcmp(seedfiles[i],seedfiles[j])) dup = 1;
+ }
+
+ /* And now, if not a duplicate, read it */
+ if (!dup)
+ read_seed_file(zs, seedfiles[i]);
+ }
/* Show how far that got us */
zsync_progress(zs, &local_used, NULL);
@@ -632,10 +645,19 @@
strcat(oldfile_backup, ".zs-old");
if (!access(filename, F_OK)) {
- /* backup of old file */
- unlink(oldfile_backup); /* Don't care if this fails - the link below will catch any failure */
- if (link(filename, oldfile_backup) != 0) {
- perror("link");
+ /* Backup the old file. */
+ /* First, remove any previous backup. We don't care if this fails -
+ * the link below will catch any failure */
+ unlink(oldfile_backup);
+
+ /* Try linking the filename to the backup file name, so we will
+ atomically replace the target file in the next step.
+ If that fails due to EPERM, it is probably a filesystem that
+ doesn't support hard-links - so try just renaming it to the
+ backup filename. */
+ if (link(filename, oldfile_backup) != 0
+ && (errno != EPERM || rename(filename, oldfile_backup) != 0)) {
+ perror("linkname");
fprintf(stderr,
"Unable to back up old file %s - completed download left in %s\n",
filename, temp_file);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/zsync-0.6.1/config.h.in new/zsync-0.6.2/config.h.in
--- old/zsync-0.6.1/config.h.in 2009-01-18 01:04:35.000000000 +0100
+++ new/zsync-0.6.2/config.h.in 2010-09-20 14:35:39.000000000 +0200
@@ -66,6 +66,9 @@
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
/* Define to the version of this package. */
#undef PACKAGE_VERSION
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/zsync-0.6.1/configure.ac new/zsync-0.6.2/configure.ac
--- old/zsync-0.6.1/configure.ac 2009-04-13 16:45:26.000000000 +0200
+++ new/zsync-0.6.2/configure.ac 2010-09-19 22:51:53.000000000 +0200
@@ -1,6 +1,6 @@
# Process this file with autoconf to produce a configure script.
-AC_INIT([zsync],[0.6.1],[http://zsync.moria.org.uk/])
+AC_INIT([zsync],[0.6.2],[http://zsync.moria.org.uk/])
AC_CONFIG_SRCDIR([client.c])
AC_CONFIG_AUX_DIR([autotools])
@@ -17,8 +17,10 @@
AC_PROG_RANLIB
AC_ARG_ENABLE([profile],
- AS_HELP_STRING([--enable-profile],[Turns on profiling]),
- [ ZS_CFLAGS="${ZS_CFLAGS} -pg" ])
+ AS_HELP_STRING([--enable-profile],[Turns on profiling]))
+
+AS_IF([test "x$enable_profile" = "xyes"], [
+ ZS_CFLAGS="${ZS_CFLAGS} -pg" ])
dnl --- Header files, typedefs, structures, libraries
AC_C_CONST
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/zsync-0.6.1/doc/zsync.1 new/zsync-0.6.2/doc/zsync.1
--- old/zsync-0.6.1/doc/zsync.1 2009-04-14 23:50:38.000000000 +0200
+++ new/zsync-0.6.2/doc/zsync.1 2010-09-16 19:17:49.000000000 +0200
@@ -1,4 +1,4 @@
-.TH "zsync" "1" "0.6.1" "Colin Phipps" "File Transfer"
+.TH "zsync" "1" "0.6.2" "Colin Phipps" "File Transfer"
.SH "NAME"
.LP
zsync \- Partial/differential file download client over HTTP
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/zsync-0.6.1/doc/zsyncmake.1 new/zsync-0.6.2/doc/zsyncmake.1
--- old/zsync-0.6.1/doc/zsyncmake.1 2009-04-13 16:45:40.000000000 +0200
+++ new/zsync-0.6.2/doc/zsyncmake.1 2010-09-16 19:17:49.000000000 +0200
@@ -1,4 +1,4 @@
-.TH "zsyncmake" "1" "0.6.1" "Colin Phipps" "File Transfer"
+.TH "zsyncmake" "1" "0.6.2" "Colin Phipps" "File Transfer"
.SH "NAME"
.LP
zsyncmake \- Build control file for zsync(1)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/zsync-0.6.1/http.c new/zsync-0.6.2/http.c
--- old/zsync-0.6.1/http.c 2009-04-23 22:36:57.000000000 +0200
+++ new/zsync-0.6.2/http.c 2010-09-19 22:51:53.000000000 +0200
@@ -688,7 +688,6 @@
rf->block_left = 0;
rf->bytes_down = 0;
rf->boundary = NULL;
- rf->buf_start = rf->buf_end = 0; /* Buffer initially empty */
rf->sd = -1; /* Socket not open */
rf->ranges_todo = NULL; /* And no ranges given yet */
rf->nranges = rf->rangesdone = 0;
@@ -729,6 +728,7 @@
rf->sd = connect_to(rf->chost, rf->cport);
rf->server_close = 0;
rf->rangessent = rf->rangesdone;
+ rf->buf_start = rf->buf_end = 0; /* Buffer initially empty */
}
/* range_fetch_getmore
@@ -833,6 +833,7 @@
if (buf[0] == 0)
return 0; /* EOF, caller decides if that's an error */
if (memcmp(buf, "HTTP/1", 6) != 0 || (p = strchr(buf, ' ')) == NULL) {
+ fprintf(stderr, "got non-HTTP response '%s'\n", buf);
return -1;
}
status = atoi(p + 1);
@@ -950,6 +951,8 @@
* It's not practical given the number of requests we are making to
* follow the RFC here, and at least we're only remembering it for
* the duration of this transfer. */
+ if (!no_progress)
+ fprintf(stderr, "followed redirect to %s\n", p);
range_fetch_set_url(rf, p);
/* Flag caller to reconnect; the new URL might be a new target. */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/zsync-0.6.1/librcksum/Makefile.am new/zsync-0.6.2/librcksum/Makefile.am
--- old/zsync-0.6.1/librcksum/Makefile.am 2005-03-06 17:25:39.000000000 +0100
+++ new/zsync-0.6.2/librcksum/Makefile.am 2010-09-16 19:17:49.000000000 +0200
@@ -2,4 +2,8 @@
noinst_LIBRARIES = librcksum.a
+TESTS = md4test
+noinst_PROGRAMS = md4test
+
+md4test_SOURCES = md4test.c md4.h md4.c
librcksum_a_SOURCES = internal.h rcksum.h md4.h rsum.c hash.c state.c range.c md4.c
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/zsync-0.6.1/librcksum/hash.c new/zsync-0.6.2/librcksum/hash.c
--- old/zsync-0.6.1/librcksum/hash.c 2009-01-19 00:08:03.000000000 +0100
+++ new/zsync-0.6.2/librcksum/hash.c 2010-09-16 19:17:49.000000000 +0200
@@ -83,9 +83,15 @@
return 0;
}
- /* Now fill in the hash tables */
- for (id = 0; id < z->blocks; id++) {
- struct hash_entry *e = z->blockhashes + id;
+ /* Now fill in the hash tables.
+ * Minor point: We do this in reverse order, because we're adding entries
+ * to the hash chains by prepending, so if we iterate over the data in
+ * reverse then the resulting hash chains have the blocks in normal order.
+ * That's improves our pattern of I/O when writing out identical blocks
+ * once we are processing data; we will write them in order. */
+ for (id = z->blocks; id > 0;) {
+ /* Decrement the loop variable here, and get the hash entry. */
+ struct hash_entry *e = z->blockhashes + (--id);
/* Prepend to linked list for this hash entry */
unsigned h = calc_rhash(z, e);
@@ -97,3 +103,27 @@
}
return 1;
}
+
+/* remove_block_from_hash(self, block_id)
+ * Remove the given data block from the rsum hash table, so it won't be
+ * returned in a hash lookup again (e.g. because we now have the data)
+ */
+void remove_block_from_hash(struct rcksum_state *z, zs_blockid id) {
+ struct hash_entry *t = &(z->blockhashes[id]);
+
+ struct hash_entry **p = &(z->rsum_hash[calc_rhash(z, t) & z->hashmask]);
+
+ while (*p != NULL) {
+ if (*p == t) {
+ if (t == z->rover) {
+ z->rover = t->next;
+ }
+ *p = (*p)->next;
+ return;
+ }
+ else {
+ p = &((*p)->next);
+ }
+ }
+}
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/zsync-0.6.1/librcksum/internal.h new/zsync-0.6.2/librcksum/internal.h
--- old/zsync-0.6.1/librcksum/internal.h 2009-04-13 13:31:47.000000000 +0200
+++ new/zsync-0.6.2/librcksum/internal.h 2010-09-16 19:17:49.000000000 +0200
@@ -48,9 +48,15 @@
/* These are used by the library. Note, not thread safe. */
const struct hash_entry *rover;
- const struct hash_entry *next_match;
int skip; /* skip forward on next submit_source_data */
+ /* Internal; hint to rcksum_submit_source_data that it should try matching
+ * the following block of input data against the block ->next_match.
+ * next_known is a cached lookup of the id of the next block after that
+ * that we already have data for. */
+ const struct hash_entry *next_match;
+ zs_blockid next_known;
+
/* Hash table for rsync algorithm */
unsigned int hashmask;
struct hash_entry *blockhashes;
@@ -86,6 +92,7 @@
void add_to_ranges(struct rcksum_state *z, zs_blockid n);
int already_got_block(struct rcksum_state *z, zs_blockid n);
+zs_blockid next_known_block(struct rcksum_state *rs, zs_blockid x);
struct hash_entry *calc_hash_entry(void *data, size_t len);
@@ -101,3 +108,4 @@
}
int build_hash(struct rcksum_state *z);
+void remove_block_from_hash(struct rcksum_state *z, zs_blockid id);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/zsync-0.6.1/librcksum/md4test.c new/zsync-0.6.2/librcksum/md4test.c
--- old/zsync-0.6.1/librcksum/md4test.c 1970-01-01 01:00:00.000000000 +0100
+++ new/zsync-0.6.2/librcksum/md4test.c 2010-09-16 19:17:49.000000000 +0200
@@ -0,0 +1,41 @@
+/*
+ * zsync - client side rsync over http
+ * Copyright (C) 2005 Colin Phipps
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the Artistic License v2 (see the accompanying
+ * file COPYING for the full license terms), or, at your option, any later
+ * version of the same license.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * COPYING file for details.
+ */
+
+#include "zsglobal.h"
+
+#include
+#include
+#include
+#include "md4.h"
+
+// From RFC1320
+const char correct_checksum[MD4_DIGEST_LENGTH] = {0xd7, 0x9e, 0x1c, 0x30, 0x8a, 0xa5, 0xbb, 0xcd, 0xee, 0xa8, 0xed, 0x63, 0xdf, 0x41, 0x2d, 0xa9 };
+
+int main(void)
+{
+ MD4_CTX ctx;
+
+ MD4Init(&ctx);
+
+ MD4Update(&ctx,(uint8_t*)"a",1);
+ MD4Update(&ctx,(uint8_t*)"bcdefghijklmnopqrstuvwxyz",25);
+ {
+ uint8_t digest[MD4_DIGEST_LENGTH];
+ MD4Final(digest,&ctx);
+ exit(memcmp(digest,correct_checksum,MD4_DIGEST_LENGTH));
+ }
+
+ return 0;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/zsync-0.6.1/librcksum/range.c new/zsync-0.6.2/librcksum/range.c
--- old/zsync-0.6.1/librcksum/range.c 2009-01-20 00:19:03.000000000 +0100
+++ new/zsync-0.6.2/librcksum/range.c 2010-09-16 19:17:49.000000000 +0200
@@ -123,6 +123,24 @@
return (range_before_block(rs, x) == -1);
}
+/* next_blockid = next_known_block(rs, blockid)
+ * Returns the blockid of the next block which we already have data for.
+ * If we know the requested block, it returns the blockid given; otherwise it
+ * will return a later blockid.
+ * If no later blocks are known, it returns rs->numblocks (i.e. the block after
+ * the end of the file).
+ */
+zs_blockid next_known_block(struct rcksum_state *rs, zs_blockid x) {
+ int r = range_before_block(rs, x);
+ if (r == -1)
+ return x;
+ if (r == rs->numranges) {
+ return rs->blocks;
+ }
+ /* Else return first block of next known range. */
+ return rs->ranges[2*r];
+}
+
/* rcksum_needed_block_ranges
* Return the block ranges needed to complete the target file */
zs_blockid *rcksum_needed_block_ranges(const struct rcksum_state * rs, int *num,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/zsync-0.6.1/librcksum/rsum.c new/zsync-0.6.2/librcksum/rsum.c
--- old/zsync-0.6.1/librcksum/rsum.c 2009-04-13 13:31:48.000000000 +0200
+++ new/zsync-0.6.2/librcksum/rsum.c 2010-09-16 19:17:49.000000000 +0200
@@ -64,29 +64,6 @@
MD4Final(c, &ctx);
}
-/* unlink_block(self, block_id)
- * Remove the given data block from the rsum hash table, so it won't be
- * returned in a hash lookup again (e.g. because we now have the data)
- */
-static void unlink_block(struct rcksum_state *z, zs_blockid id) {
- struct hash_entry *t = &(z->blockhashes[id]);
-
- struct hash_entry **p = &(z->rsum_hash[calc_rhash(z, t) & z->hashmask]);
-
- while (*p != NULL) {
- if (*p == t) {
- if (t == z->rover) {
- z->rover = t->next;
- }
- *p = (*p)->next;
- return;
- }
- else {
- p = &((*p)->next);
- }
- }
-}
-
#ifndef HAVE_PWRITE
/* Fallback pwrite(2) implementation if needed (but not strictly complete, as
* it moves the file pointer - we don't care). */
@@ -136,7 +113,7 @@
* have received and stored the data for */
int id;
for (id = bfrom; id <= bto; id++) {
- unlink_block(z, id);
+ remove_block_from_hash(z, id);
add_to_ranges(z, id);
}
}
@@ -206,11 +183,16 @@
int got_blocks = 0;
register struct rsum r = z->r[0];
- z->rover = e;
+ /* This is a hint to the caller that they should try matching the next
+ * block against a particular hash entry (because at least z->seq_matches
+ * prior blocks to it matched in sequence). Clear it here and set it below
+ * if and when we get such a set of matches. */
+ z->next_match = NULL;
/* This is essentially a for (;e;e=e->next), but we want to remove links from
* the list as we find matches, without keeping too many temp variables.
*/
+ z->rover = e;
while (z->rover) {
zs_blockid id;
@@ -236,6 +218,7 @@
{
int ok = 1;
signed int check_md4 = 0;
+ zs_blockid next_known = -1;
/* This block at least must match; we must match at least
* z->seq_matches-1 others, which could either be trailing stuff,
@@ -257,14 +240,38 @@
z->checksum_bytes))
ok = 0;
+ else if (next_known == -1)
+
check_md4++;
} while (ok && !onlyone && check_md4 < z->seq_matches);
if (ok) {
- write_blocks(z, data, id, id + check_md4 - 1);
- got_blocks += check_md4;
+ int num_write_blocks;
+
+ /* Find the next block that we already have data for. If this
+ * is part of a run of matches then we have this stored already
+ * as ->next_known. */
+ zs_blockid next_known = onlyone ? z->next_known : next_known_block(z, id);
+
z->stats.stronghit += check_md4;
- z->next_match = z->blockhashes + id + check_md4;
+
+ if (next_known > id + check_md4) {
+ num_write_blocks = check_md4;
+
+ /* Save state for this run of matches */
+ z->next_match = &(z->blockhashes[id + check_md4]);
+ if (!onlyone) z->next_known = next_known;
+ }
+ else {
+ /* We've reached the EOF, or data we already know. Just
+ * write out the blocks we don't know, and that's the end
+ * of this run of matches. */
+ num_write_blocks = next_known - id;
+ }
+
+ /* Write out the matched blocks that we don't yet know */
+ write_blocks(z, data, id, id + num_write_blocks - 1);
+ got_blocks += num_write_blocks;
}
}
}
@@ -332,8 +339,12 @@
#endif
{
+ /* # of blocks of the output file we got from this data */
int thismatch = 0;
- int blocks_matched = 0;
+ /* # of blocks to advance if thismatch > 0. Can be less than
+ * thismatch as thismatch could be N*blocks_matched, if a block was
+ * duplicated to multiple locations in the output file. */
+ int blocks_matched = 0;
/* If the previous block was a match, but we're looking for
* sequential matches, then test this block against the block in
@@ -342,10 +353,8 @@
if (0 != (thismatch = check_checksums_on_hash_chain(z, z->next_match, data + x, 1))) {
blocks_matched = 1;
}
- else
- z->next_match = NULL;
}
- if (!blocks_matched) {
+ if (!thismatch) {
const struct hash_entry *e;
/* Do a hash table lookup - first in the bithash (fast negative
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/zsync-0.6.1/libzsync/zsync.c new/zsync-0.6.2/libzsync/zsync.c
--- old/zsync-0.6.1/libzsync/zsync.c 2009-01-25 19:13:48.000000000 +0100
+++ new/zsync-0.6.2/libzsync/zsync.c 2010-09-19 22:51:53.000000000 +0200
@@ -87,7 +87,7 @@
* holding the in-progress local version of the target */
off_t filelen; /* Length of the target file */
int blocks; /* Number of blocks in the target */
- long blocksize; /* Blocksize */
+ size_t blocksize; /* Blocksize */
/* Checksum of the entire file, and checksum alg */
char *checksum;
@@ -194,7 +194,7 @@
}
}
else if (!strcmp(buf, "Length")) {
- zs->filelen = atol(p);
+ zs->filelen = atoll(p);
}
else if (!strcmp(buf, "Filename")) {
zs->filename = strdup(p);
@@ -472,10 +472,13 @@
return NULL;
}
- /* Now convert blocks to bytes */
+ /* Now convert blocks to bytes.
+ * Note: Must cast one operand to off_t as both blocksize and blrange[x]
+ * are int's whereas the product must be a file offfset. Needed so we don't
+ * truncate file offsets to 32bits on 32bit platforms. */
for (i = 0; i < nrange; i++) {
- byterange[2 * i] = blrange[2 * i] * zs->blocksize;
- byterange[2 * i + 1] = blrange[2 * i + 1] * zs->blocksize - 1;
+ byterange[2 * i] = blrange[2 * i] * (off_t)zs->blocksize;
+ byterange[2 * i + 1] = blrange[2 * i + 1] * (off_t)zs->blocksize - 1;
}
free(blrange); /* And release the blocks, we're done with them */
@@ -598,7 +601,7 @@
SHA1_CTX shactx;
{ /* Do SHA1 of file contents */
- char buf[4096];
+ unsigned char buf[4096];
int rc;
SHA1Init(&shactx);
@@ -652,7 +655,7 @@
{ /* Add input filename, shell-escaped, to the command line */
int i = 0;
- int j = strlen(cmd);
+ size_t j = strlen(cmd);
char c;
while ((c = zs->cur_filename[i++]) != 0 && j < sizeof(cmd) - 2) {
@@ -687,7 +690,7 @@
while (!feof(g)) {
char buf[1024];
int r;
- char *p = buf;
+ const char *p = buf;
if ((r = fread(buf, 1, sizeof(buf), g)) < 0) {
perror("fread");
@@ -773,7 +776,7 @@
/* Read in 32k of leading uncompressed context - needed because the deflate
* compression method includes back-references to previously-seen strings. */
- char wbuf[32768];
+ unsigned char wbuf[32768];
rcksum_read_known_data(zs->rs, wbuf, pos - lookback, lookback);
/* Fake an output buffer of 32k filled with data to zlib */
@@ -812,7 +815,7 @@
struct zsync_state *zs; /* The zsync_state that we are downloading for */
struct z_stream_s strm; /* Decompression object */
int url_type; /* Compressed or not */
- char *outbuf; /* Working buffer to keep incomplete blocks of data */
+ unsigned char *outbuf; /* Working buffer to keep incomplete blocks of data */
off_t outoffset; /* and the position in that buffer */
};
@@ -851,7 +854,7 @@
const unsigned char *buf,
off_t offset, size_t len) {
int ret = 0;
- int blocksize = zr->zs->blocksize;
+ size_t blocksize = zr->zs->blocksize;
if (0 != (offset % blocksize)) {
size_t x = len;
@@ -913,7 +916,7 @@
size_t len) {
int ret = 0;
int eoz = 0;
- int blocksize = zr->zs->blocksize;
+ size_t blocksize = zr->zs->blocksize;
if (!len)
return 0;
@@ -965,9 +968,8 @@
zr->outoffset += blocksize;
}
else {
- /* We were reading a block fragment; update outoffset, and we are nwo block-aligned. */
- zr->outoffset +=
- (((char *)(zr->strm.next_out)) - (zr->outbuf));
+ /* We were reading a block fragment; update outoffset, and we are now block-aligned. */
+ zr->outoffset += (zr->strm.next_out - zr->outbuf);
}
zr->strm.avail_out = blocksize;
zr->strm.next_out = zr->outbuf;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/zsync-0.6.1/make.c new/zsync-0.6.2/make.c
--- old/zsync-0.6.1/make.c 2009-04-13 12:54:38.000000000 +0200
+++ new/zsync-0.6.2/make.c 2010-09-16 19:17:49.000000000 +0200
@@ -1,4 +1,3 @@
-
/*
* zsync - client side rsync over http
* Copyright (C) 2004,2005,2009 Colin Phipps
@@ -243,11 +242,18 @@
/* refill input buffer if empty */
if (zs.avail_in == 0) {
int rc = fread(inbuf, 1, inbufsz, fin);
- zs.next_in = inbuf;
if (rc < 0) {
perror("read");
exit(2);
}
+
+ /* Still expecting data (!eoz and avail_in == 0) but none there. */
+ if (rc == 0) {
+ fprintf(stderr, "Premature end of compressed data.\n");
+ exit(1);
+ }
+
+ zs.next_in = inbuf;
zs.avail_in = rc;
}
{
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org