Source: xdelta3
Version: 3.0.11-dfsg-1
Tags: patch buster sid

I'm attaching a patch to modernize and clean up the packaging.

Thanks,
Jeremy Bicha
From 45e669e8f7d0fac8acc0a6b3d1c1268c596488aa Mon Sep 17 00:00:00 2001
From: Jeremy Bicha <jbi...@ubuntu.com>
Date: Tue, 17 Apr 2018 17:32:27 -0400
Subject: [PATCH] Clean up packaging

Switch from cdbs to dh
Build with all hardening flags
Run build tests
Drop unused packaging files
Bump debhelper compat to 11
Bump Standards-Version to 4.1.4
---
 debian/compat                      |   2 +-
 debian/control                     |   5 +-
 debian/control_px3                 |  14 -
 debian/patches/CVE-2014-9765.patch | 165 ---------
 debian/patches/Q_not_u             | 561 -----------------------------
 debian/patches/fix_lzma_test.patch |  25 --
 debian/patches/printf_uint64       |  40 --
 debian/patches/regtest_size_t      |  11 -
 debian/python-xdelta3.examples     |   1 -
 debian/python-xdelta3.substvars    |   1 -
 debian/rules                       |  11 +-
 11 files changed, 12 insertions(+), 824 deletions(-)
 delete mode 100644 debian/control_px3
 delete mode 100644 debian/patches/CVE-2014-9765.patch
 delete mode 100644 debian/patches/Q_not_u
 delete mode 100644 debian/patches/fix_lzma_test.patch
 delete mode 100644 debian/patches/printf_uint64
 delete mode 100644 debian/patches/regtest_size_t
 delete mode 100644 debian/python-xdelta3.examples
 delete mode 100644 debian/python-xdelta3.substvars

diff --git a/debian/compat b/debian/compat
index 7ed6ff8..b4de394 100644
--- a/debian/compat
+++ b/debian/compat
@@ -1 +1 @@
-5
+11
diff --git a/debian/control b/debian/control
index 5068a84..9214cce 100644
--- a/debian/control
+++ b/debian/control
@@ -1,10 +1,9 @@
 Source: xdelta3
 Section: utils
 Priority: optional
-XS-Python-Version: all
 Maintainer: A Mennucc1 <mennu...@debian.org>
-Build-Depends: cdbs, debhelper, liblzma-dev
-Standards-Version: 3.9.6.0
+Build-Depends: debhelper (>= 11), liblzma-dev
+Standards-Version: 4.1.4
 
 Package: xdelta3
 Architecture: any
diff --git a/debian/control_px3 b/debian/control_px3
deleted file mode 100644
index 3e23336..0000000
--- a/debian/control_px3
+++ /dev/null
@@ -1,14 +0,0 @@
-Package: python-xdelta3
-Architecture: any
-Section: python
-Depends:  ${python:Depends}, ${shlibs:Depends}, ${misc:Depends}
-Provides: ${python:Provides}
-Description: Xdelta3 python module
- Xdelta3 is a set of tools designed to compute changes between
- binary files.  These changes (delta files) are similar to the output of the
- "diff" program, in that they may be used to store and transmit only the
- changes between files.  The "delta files" that Xdelta3 manages are
- stored in RFC3284 (VCDIFF) format. 
- .
- This is the python module.
-
diff --git a/debian/patches/CVE-2014-9765.patch b/debian/patches/CVE-2014-9765.patch
deleted file mode 100644
index 0a2df2c..0000000
--- a/debian/patches/CVE-2014-9765.patch
+++ /dev/null
@@ -1,165 +0,0 @@
-Description: CVE-2014-9765: buffer overflow in main_get_appheader
-Origin: upstream, https://github.com/jmacd/xdelta/commit/969e65d3a5d70442f5bafd726bcef47a0b48edd8
-Bug-Debian: https://bugs.debian.org/814067
-Forwarded: not-needed
-Author: Josh MacDonald <josh.macdon...@gmail.com>
-Reviewed-by: Salvatore Bonaccorso <car...@debian.org>
-Last-Update: 2016-02-10
-Applied-Upstream: 3.0.9
-
----
- xdelta3-main.h |  5 ++--
- xdelta3-test.h | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---
- 2 files changed, 83 insertions(+), 5 deletions(-)
-
-diff --git a/xdelta3-main.h b/xdelta3-main.h
-index 090b7d9..5146b38 100644
---- a/xdelta3-main.h
-+++ b/xdelta3-main.h
-@@ -2810,14 +2810,15 @@ main_get_appheader (xd3_stream *stream, main_file *ifile,
- 
-   if (appheadsz > 0)
-     {
-+      const int kMaxArgs = 4;
-       char *start = (char*)apphead;
-       char *slash;
-       int   place = 0;
--      char *parsed[4];
-+      char *parsed[kMaxArgs];
- 
-       memset (parsed, 0, sizeof (parsed));
- 
--      while ((slash = strchr (start, '/')) != NULL)
-+      while ((slash = strchr (start, '/')) != NULL && place < (kMaxArgs-1))
- 	{
- 	  *slash = 0;
- 	  parsed[place++] = start;
-diff --git a/xdelta3-test.h b/xdelta3-test.h
-index e9848b6..dd45528 100644
---- a/xdelta3-test.h
-+++ b/xdelta3-test.h
-@@ -166,7 +166,7 @@ static int do_cmd (xd3_stream *stream, const char *buf)
- 	{
- 	  stream->msg = "abnormal command termination";
- 	}
--      return XD3_INTERNAL;
-+      return ret;
-     }
-   return 0;
- }
-@@ -429,12 +429,12 @@ test_compare_files (const char* tgt, const char *rec)
- }
- 
- static int
--test_save_copy (const char *origname)
-+test_copy_to (const char *from, const char *to)
- {
-   char buf[TESTBUFSIZE];
-   int ret;
- 
--  snprintf_func (buf, TESTBUFSIZE, "cp -f %s %s", origname, TEST_COPY_FILE);
-+  snprintf_func (buf, TESTBUFSIZE, "cp -f %s %s", from, to);
- 
-   if ((ret = system (buf)) != 0)
-     {
-@@ -445,6 +445,12 @@ test_save_copy (const char *origname)
- }
- 
- static int
-+test_save_copy (const char *origname)
-+{
-+  return test_copy_to(origname, TEST_COPY_FILE);
-+}
-+
-+static int
- test_file_size (const char* file, xoff_t *size)
- {
-   struct stat sbuf;
-@@ -2361,6 +2367,76 @@ test_no_output (xd3_stream *stream, int ignore)
-   return 0;
- }
- 
-+/* This tests that the default appheader works */
-+static int
-+test_appheader (xd3_stream *stream, int ignore)
-+{
-+  int i;
-+  int ret;
-+  char buf[TESTBUFSIZE];
-+  char bogus[TESTBUFSIZE];
-+  xoff_t ssize, tsize;
-+  test_setup ();
-+
-+  if ((ret = test_make_inputs (stream, &ssize, &tsize))) { return ret; }
-+
-+  snprintf_func (buf, TESTBUFSIZE, "%s -q -f -e -s %s %s %s", program_name,
-+		 TEST_SOURCE_FILE, TEST_TARGET_FILE, TEST_DELTA_FILE);
-+  if ((ret = do_cmd (stream, buf))) { return ret; }
-+
-+  if ((ret = test_copy_to (program_name, TEST_RECON2_FILE))) { return ret; }
-+
-+  snprintf_func (buf, TESTBUFSIZE, "chmod 0700 %s", TEST_RECON2_FILE);
-+  if ((ret = do_cmd (stream, buf))) { return ret; }
-+
-+  if ((ret = test_save_copy (TEST_TARGET_FILE))) { return ret; }
-+  if ((ret = test_copy_to (TEST_SOURCE_FILE, TEST_TARGET_FILE))) { return ret; }
-+
-+  if ((ret = test_compare_files (TEST_TARGET_FILE, TEST_COPY_FILE)) == 0)
-+    {
-+      return XD3_INVALID;  // I.e., files are different!
-+    }
-+
-+  // Test that the target file is restored.
-+  snprintf_func (buf, TESTBUFSIZE, "(cd /tmp && %s -q -f -d %s)",
-+		 TEST_RECON2_FILE,
-+		 TEST_DELTA_FILE);
-+  if ((ret = do_cmd (stream, buf))) { return ret; }
-+
-+  if ((ret = test_compare_files (TEST_TARGET_FILE, TEST_COPY_FILE)) != 0)
-+    {
-+      return ret;
-+    }
-+
-+  // Test a malicious string w/ entries > 4 in the appheader by having
-+  // the encoder write it:
-+  for (i = 0; i < TESTBUFSIZE / 4; ++i)
-+    {
-+      bogus[2*i] = 'G';
-+      bogus[2*i+1] = '/';
-+    }
-+  bogus[TESTBUFSIZE/2-1] = 0;
-+
-+  snprintf_func (buf, TESTBUFSIZE, 
-+		 "%s -q -f -A=%s -e -s %s %s %s", program_name, bogus,
-+		 TEST_SOURCE_FILE, TEST_TARGET_FILE, TEST_DELTA_FILE);
-+  if ((ret = do_cmd (stream, buf))) { return ret; }
-+  // Then read it:
-+  snprintf_func (buf, TESTBUFSIZE, "(cd /tmp && %s -q -f -d %s)",
-+		 TEST_RECON2_FILE,
-+		 TEST_DELTA_FILE);
-+  if ((ret = do_cmd (stream, buf)) == 0) 
-+    { 
-+      return XD3_INVALID;  // Impossible
-+    }
-+  if (!WIFEXITED(ret))
-+    {
-+      return XD3_INVALID;  // Must have crashed!
-+    }
-+
-+  return 0;
-+}
-+
- /***********************************************************************
-  Source identical optimization
-  ***********************************************************************/
-@@ -2848,6 +2924,7 @@ xd3_selftest (void)
-   DO_TEST (force_behavior, 0, 0);
-   DO_TEST (stdout_behavior, 0, 0);
-   DO_TEST (no_output, 0, 0);
-+  DO_TEST (appheader, 0, 0);
-   DO_TEST (command_line_arguments, 0, 0);
- 
- #if EXTERNAL_COMPRESSION
--- 
-2.7.0
-
diff --git a/debian/patches/Q_not_u b/debian/patches/Q_not_u
deleted file mode 100644
index 4aedd02..0000000
--- a/debian/patches/Q_not_u
+++ /dev/null
@@ -1,561 +0,0 @@
---- a/testing/delta.h
-+++ b/testing/delta.h
-@@ -53,13 +53,13 @@ public:
-       xd3_winst &winst = stream_.whole_target.inst[i];
-       switch (winst.type) {
-       case XD3_RUN: 
--	DP(RINT "%"Q"u run %u\n", winst.position, winst.size);
-+	DP(RINT "%"Q" run %u\n", winst.position, winst.size);
- 	break;
-       case XD3_ADD: 
--	DP(RINT "%"Q"u add %u\n", winst.position, winst.size);
-+	DP(RINT "%"Q" add %u\n", winst.position, winst.size);
- 	break;
-       default:
--	DP(RINT "%"Q"u copy %u @ %"Q"u (mode %u)\n", 
-+	DP(RINT "%"Q" copy %u @ %"Q" (mode %u)\n", 
- 	   winst.position, winst.size, winst.addr, winst.mode);
- 	break;
-       }
---- a/testing/regtest.cc
-+++ b/testing/regtest.cc
-@@ -92,7 +92,7 @@ public:
-     bool done = false;
-     bool done_after_input = false;
- 
--    IF_DEBUG1 (XPR(NTR "source %"Q"u[%"Q"u] target %"Q"u[%lu] winsize %lu\n",
-+    IF_DEBUG1 (XPR(NTR "source %"Q"[%"Q"] target %"Q"[%lu] winsize %lu\n",
- 		  source_file.Size(), options.block_size,
- 		  target_file.Size(), Constants::READ_SIZE,
- 		  Constants::WINDOW_SIZE));
-@@ -102,7 +102,7 @@ public:
- 
-       xoff_t blks = target_iterator.Blocks();
- 
--      IF_DEBUG2(XPR(NTR "target in %s: %llu..%llu %"Q"u(%"Q"u) verified %"Q"u\n",
-+      IF_DEBUG2(XPR(NTR "target in %s: %llu..%llu %"Q"(%"Q") verified %"Q"\n",
- 		   encoding ? "encoding" : "decoding",
- 		   target_iterator.Offset(),
- 		   target_iterator.Offset() + target_block.Size(),
-@@ -152,8 +152,8 @@ public:
- 	xd3_source *src = (encoding ? &encode_source : &decode_source);
- 	Block *block = (encoding ? &encode_source_block : &decode_source_block);
- 	if (encoding) {
--	  IF_DEBUG1(XPR(NTR "[srcblock] %"Q"u last srcpos %"Q"u "
--		       "encodepos %"Q"u\n",
-+	  IF_DEBUG1(XPR(NTR "[srcblock] %"Q" last srcpos %"Q" "
-+		       "encodepos %"Q"\n",
- 		       encode_source.getblkno,
- 		       encode_stream.match_last_srcpos,
- 		       encode_stream.input_position + encode_stream.total_in));
-@@ -230,7 +230,7 @@ public:
- 			const Options &options) {
-     vector<const char*> ecmd;
-     char buf[16];
--    snprintf(buf, sizeof(buf), "-B%"Q"u", options.encode_srcwin_maxsz);
-+    snprintf(buf, sizeof(buf), "-B%"Q"", options.encode_srcwin_maxsz);
-     ecmd.push_back("xdelta3");
-     ecmd.push_back(buf);
-     ecmd.push_back("-s");
-@@ -975,7 +975,7 @@ void UnitTest() {
- // These are Xdelta tests.
- template <class T>
- void MainTest() {
--  XPR(NT "Blocksize %"Q"u readsize %"Q"u windowsize %"Q"u\n", 
-+  XPR(NT "Blocksize %"Q" readsize %"Q" windowsize %"Q"\n", 
-       T::BLOCK_SIZE, T::READ_SIZE, T::WINDOW_SIZE);
-   Regtest<T> regtest;
-   TEST(TestEmptyInMemory);
---- a/xdelta3-test.h
-+++ b/xdelta3-test.h
-@@ -409,7 +409,7 @@ test_compare_files (const char* tgt, con
- 	{
- 	  if (obuf[i] != rbuf[i])
-  	    {
--	      XPR(NT "byte %u (read %u @ %"Q"u) %d != %d\n", 
-+	      XPR(NT "byte %u (read %u @ %"Q") %d != %d\n", 
- 		  (int)i, (int)oc, offset, obuf[i], rbuf[i]);
- 	      diffs++;
- 	      return XD3_INTERNAL;
-@@ -1787,7 +1787,7 @@ test_command_line_arguments (xd3_stream
-       if (ratio >= TEST_ADD_RATIO + TEST_EPSILON)
- 	{
- 	  XPR(NT "test encode with size ratio %.4f, "
--	     "expected < %.4f (%"Q"u, %"Q"u)\n",
-+	     "expected < %.4f (%"Q", %"Q")\n",
- 	    ratio, TEST_ADD_RATIO + TEST_EPSILON, dsize, tsize);
- 	  stream->msg = "strange encoding";
- 	  return XD3_INTERNAL;
-@@ -2610,7 +2610,7 @@ test_string_matching (xd3_stream *stream
- 	  if (inst->type == XD3_CPY)
- 	    {
- 	      *rptr++ = '@';
--	      snprintf_func (rptr, rbuf+TESTBUFSIZE-rptr, "%"Q"d", inst->addr);
-+	      snprintf_func (rptr, rbuf+TESTBUFSIZE-rptr, "%"Qd, inst->addr);
- 	      rptr += strlen (rptr);
- 	    }
- 
---- a/xdelta3.c
-+++ b/xdelta3.c
-@@ -2590,7 +2590,7 @@ xd3_getblk (xd3_stream *stream, xoff_t b
-       ret = stream->getblk (stream, source, blkno);
-       if (ret != 0)
- 	{
--	  IF_DEBUG1 (DP(RINT "[getblk] app error blkno %"Q"u: %s\n",
-+	  IF_DEBUG1 (DP(RINT "[getblk] app error blkno %"Q": %s\n",
- 			blkno, xd3_strerror (ret)));
- 	  return ret;
- 	}
-@@ -2608,8 +2608,8 @@ xd3_getblk (xd3_stream *stream, xoff_t b
- 	{
- 	  source->frontier_blkno = blkno + 1;
- 
--	  IF_DEBUG2 (DP(RINT "[getblk] full source blkno %"Q"u: "
--			"source length unknown %"Q"u\n",
-+	  IF_DEBUG2 (DP(RINT "[getblk] full source blkno %"Q": "
-+			"source length unknown %"Q"\n",
- 			blkno,
- 			xd3_source_eof (source)));
- 	}
-@@ -2618,7 +2618,7 @@ xd3_getblk (xd3_stream *stream, xoff_t b
- 	  if (!source->eof_known)
- 	    {
- 	      IF_DEBUG2 (DP(RINT "[getblk] eof block has %d bytes; "
--			    "source length known %"Q"u\n",
-+			    "source length known %"Q"\n",
- 			    xd3_bytes_on_srcblk (source, blkno),
- 			    xd3_source_eof (source)));
- 	      source->eof_known = 1;
-@@ -2629,7 +2629,7 @@ xd3_getblk (xd3_stream *stream, xoff_t b
-     }
- 
-   XD3_ASSERT (source->curblk != NULL);
--  IF_DEBUG2 (DP(RINT "[getblk] read source block %"Q"u onblk %u blksize %u\n",
-+  IF_DEBUG2 (DP(RINT "[getblk] read source block %"Q" onblk %u blksize %u\n",
- 		blkno, source->onblk, source->blksize));
- 
-   if (blkno == source->max_blkno)
-@@ -2690,7 +2690,7 @@ xd3_set_source_and_size (xd3_stream *str
-   if (ret == 0)
-     {
-       stream->src->eof_known = 1;
--      IF_DEBUG2 (DP(RINT "[set source] size known %"Q"u\n",
-+      IF_DEBUG2 (DP(RINT "[set source] size known %"Q"\n",
- 		    source_size));
- 
-       xd3_blksize_div(source_size,
-@@ -2900,7 +2900,7 @@ xd3_iopt_finish_encoding (xd3_stream *st
- 
- 	IF_DEBUG2 ({
- 	  static int cnt;
--	  DP(RINT "[iopt copy:%d] pos %"Q"u-%"Q"u addr %"Q"u-%"Q"u size %u\n",
-+	  DP(RINT "[iopt copy:%d] pos %"Q"-%"Q" addr %"Q"-%"Q" size %u\n",
- 		   cnt++,
- 		   stream->total_in + inst->pos,
- 		   stream->total_in + inst->pos + inst->size,
-@@ -2919,7 +2919,7 @@ xd3_iopt_finish_encoding (xd3_stream *st
- 
- 	IF_DEBUG2 ({
- 	  static int cnt;
--	  DP(RINT "[iopt run:%d] pos %"Q"u size %u\n", cnt++, stream->total_in + inst->pos, inst->size);
-+	  DP(RINT "[iopt run:%d] pos %"Q" size %u\n", cnt++, stream->total_in + inst->pos, inst->size);
- 	});
- 	break;
-       }
-@@ -2933,7 +2933,7 @@ xd3_iopt_finish_encoding (xd3_stream *st
- 
- 	IF_DEBUG2 ({
- 	  static int cnt;
--	  DP(RINT "[iopt add:%d] pos %"Q"u size %u\n", cnt++, stream->total_in + inst->pos, inst->size);
-+	  DP(RINT "[iopt add:%d] pos %"Q" size %u\n", cnt++, stream->total_in + inst->pos, inst->size);
- 	});
- 
- 	break;
-@@ -3863,7 +3863,7 @@ xd3_encode_input (xd3_stream *stream)
- 
-       stream->enc_state = ENC_SEARCH;
- 
--      IF_DEBUG2 (DP(RINT "[WINSTART:%"Q"u] input bytes %u offset %"Q"u\n",
-+      IF_DEBUG2 (DP(RINT "[WINSTART:%"Q"] input bytes %u offset %"Q"\n",
- 		    stream->current_window, stream->avail_in,
- 		    stream->total_in));
-       return XD3_WINSTART;
-@@ -4004,7 +4004,7 @@ xd3_encode_input (xd3_stream *stream)
-       stream->total_in += (xoff_t) stream->avail_in;
-       stream->enc_state = ENC_POSTWIN;
- 
--      IF_DEBUG2 (DP(RINT "[WINFINISH:%"Q"u] in=%"Q"u\n",
-+      IF_DEBUG2 (DP(RINT "[WINFINISH:%"Q"] in=%"Q"\n",
- 		    stream->current_window,
- 		    stream->total_in));
-       return XD3_WINFINISH;
-@@ -4442,13 +4442,13 @@ xd3_source_match_setup (xd3_stream *stre
-    * back further than the LRU cache maintaining FIFO discipline, (to
-    * avoid seeking). */
-   frontier_pos = stream->src->frontier_blkno * stream->src->blksize;
--  IF_DEBUG2(DP(RINT "[match_setup] frontier_pos %"Q"u, srcpos %"Q"u, "
--	       "src->max_winsize %"Q"u\n",
-+  IF_DEBUG2(DP(RINT "[match_setup] frontier_pos %"Q", srcpos %"Q", "
-+	       "src->max_winsize %"Q"\n",
- 	       frontier_pos, srcpos, stream->src->max_winsize));
-   if (srcpos < frontier_pos &&
-       frontier_pos - srcpos > stream->src->max_winsize) {
-     IF_DEBUG1(DP(RINT "[match_setup] rejected due to src->max_winsize "
--		 "distance eof=%"Q"u srcpos=%"Q"u maxsz=%"Q"u\n",
-+		 "distance eof=%"Q" srcpos=%"Q" maxsz=%"Q"\n",
- 		 xd3_source_eof (stream->src),
- 		 srcpos, stream->src->max_winsize));
-     goto bad;
-@@ -4505,7 +4505,7 @@ xd3_source_match_setup (xd3_stream *stre
- 	}
- 
-       IF_DEBUG2(DP(RINT
--		   "[match_setup] srcpos %"Q"u (tgtpos %"Q"u) "
-+		   "[match_setup] srcpos %"Q" (tgtpos %"Q") "
- 		   "unrestricted maxback %u maxfwd %u\n",
- 		   srcpos,
- 		   stream->total_in + stream->input_position,
-@@ -4541,7 +4541,7 @@ xd3_source_match_setup (xd3_stream *stre
- 	}
- 
-       IF_DEBUG1(DP(RINT
--		   "[match_setup] srcpos %"Q"u (tgtpos %"Q"u) "
-+		   "[match_setup] srcpos %"Q" (tgtpos %"Q") "
- 		   "restricted maxback %u maxfwd %u\n",
- 		   srcpos,
- 		   stream->total_in + stream->input_position,
-@@ -4620,7 +4620,7 @@ xd3_source_extend_match (xd3_stream *str
-   usize_t tryrem;    /* tryrem is the number of matchable bytes */
-   usize_t matched;
- 
--  IF_DEBUG2(DP(RINT "[extend match] srcpos %"Q"u\n",
-+  IF_DEBUG2(DP(RINT "[extend match] srcpos %"Q"\n",
- 	       stream->match_srcpos));
- 
-   XD3_ASSERT (src != NULL);
-@@ -4658,7 +4658,7 @@ xd3_source_extend_match (xd3_stream *str
- 
- 	  tryrem = min (tryoff, stream->match_maxback - stream->match_back);
- 
--	  IF_DEBUG2(DP(RINT "[maxback] maxback %u trysrc %"Q"u/%u tgt %u tryrem %u\n",
-+	  IF_DEBUG2(DP(RINT "[maxback] maxback %u trysrc %"Q"/%u tgt %u tryrem %u\n",
- 		       stream->match_maxback, tryblk, tryoff, streamoff, tryrem));
- 
- 	  /* TODO: This code can be optimized similar to xd3_match_forward() */
-@@ -4783,7 +4783,7 @@ xd3_source_extend_match (xd3_stream *str
- 
-       IF_DEBUG2 ({
- 	static int x = 0;
--	DP(RINT "[source match:%d] <inp %"Q"u %"Q"u>  <src %"Q"u %"Q"u> (%s) [ %u bytes ]\n",
-+	DP(RINT "[source match:%d] <inp %"Q" %"Q">  <src %"Q" %"Q"> (%s) [ %u bytes ]\n",
- 	   x++,
- 	   stream->total_in + target_position,
- 	   stream->total_in + target_position + match_length,
-@@ -5110,13 +5110,13 @@ xd3_srcwin_move_point (xd3_stream *strea
-  	      ret = XD3_INTERNAL;
- 	    }
- 	  IF_DEBUG1 (DP(RINT
--			"[srcwin_move_point] async getblk return for %"Q"u\n",
-+			"[srcwin_move_point] async getblk return for %"Q"\n",
- 			blkno));
- 	  return ret;
- 	}
- 
-       IF_DEBUG1 (DP(RINT
--		    "[srcwin_move_point] T=%"Q"u{%"Q"u} S=%"Q"u EOF=%"Q"u %s\n",
-+		    "[srcwin_move_point] T=%"Q"{%"Q"} S=%"Q" EOF=%"Q" %s\n",
- 		    stream->total_in + stream->input_position,
- 		    logical_input_cksum_pos,
- 		    stream->srcwin_cksum_pos,
-@@ -5164,8 +5164,8 @@ xd3_srcwin_move_point (xd3_stream *strea
-     }
- 
-   IF_DEBUG1 (DP(RINT
--		"[srcwin_move_point] exited loop T=%"Q"u{%"Q"u} "
--		"S=%"Q"u EOF=%"Q"u %s\n",
-+		"[srcwin_move_point] exited loop T=%"Q"{%"Q"} "
-+		"S=%"Q" EOF=%"Q" %s\n",
- 		stream->total_in + stream->input_position,
- 		logical_input_cksum_pos,
- 		stream->srcwin_cksum_pos,
---- a/xdelta3-blkcache.h
-+++ b/xdelta3-blkcache.h
-@@ -246,7 +246,7 @@ main_set_source (xd3_stream *stream, xd3
- 
-       if (sfile->size_known)
- 	{
--	  short_sprintf (srcszbuf, "source size %s [%"Q"u]",
-+	  short_sprintf (srcszbuf, "source size %s [%"Q"]",
- 			 main_format_bcnt (source_size, &srccntbuf),
- 			 source_size);
- 	}
-@@ -366,7 +366,7 @@ main_read_seek_source (xd3_stream *strea
- 	  if (!option_quiet)
- 	    {
- 	      XPR(NT "source can't seek backwards; requested block offset "
--		  "%"Q"u source position is %"Q"u\n",
-+		  "%"Q" source position is %"Q"\n",
- 		  pos, sfile->source_position);
- 	    }
- 
-@@ -386,7 +386,7 @@ main_read_seek_source (xd3_stream *strea
- 
- 	  if (option_verbose > 1)
- 	    {
--	      XPR(NT "seek error at offset %"Q"u: %s\n",
-+	      XPR(NT "seek error at offset %"Q": %s\n",
- 		  pos, xd3_mainerror (ret));
- 	    }
- 	}
-@@ -395,7 +395,7 @@ main_read_seek_source (xd3_stream *strea
- 
-       if (option_verbose > 1 && pos != sfile->source_position)
- 	{
--	  XPR(NT "non-seekable source skipping %"Q"u bytes @ %"Q"u\n",
-+	  XPR(NT "non-seekable source skipping %"Q" bytes @ %"Q"\n",
- 	      pos - sfile->source_position,
- 	      sfile->source_position);
- 	}
-@@ -440,7 +440,7 @@ main_read_seek_source (xd3_stream *strea
- 	  sfile->source_position += nread;
- 	  blru->size = nread;
- 
--	  IF_DEBUG1 (DP(RINT "[getblk] skip blkno %"Q"u size %u\n",
-+	  IF_DEBUG1 (DP(RINT "[getblk] skip blkno %"Q" size %u\n",
- 			skip_blkno, blru->size));
- 
- 	  XD3_ASSERT (sfile->source_position <= pos);
-@@ -536,20 +536,20 @@ main_getblk_func (xd3_stream *stream,
- 	{
- 	  if (blru->blkno != blkno)
- 	    {
--	      XPR(NT "source block %"Q"u read %zu ejects %"Q"u (lru_hits=%u, "
-+	      XPR(NT "source block %"Q" read %zu ejects %"Q" (lru_hits=%u, "
- 		  "lru_misses=%u, lru_filled=%u)\n",
- 		  blkno, nread, blru->blkno, lru_hits, lru_misses, lru_filled);
- 	    }
- 	  else
- 	    {
--	      XPR(NT "source block %"Q"u read %zu (lru_hits=%u, "
-+	      XPR(NT "source block %"Q" read %zu (lru_hits=%u, "
- 		  "lru_misses=%u, lru_filled=%u)\n",
- 		  blkno, nread, lru_hits, lru_misses, lru_filled);
- 	    }
- 	}
-       else
- 	{
--	  XPR(NT "source block %"Q"u read %zu (lru_hits=%u, lru_misses=%u, "
-+	  XPR(NT "source block %"Q" read %zu (lru_hits=%u, lru_misses=%u, "
- 	      "lru_filled=%u)\n", blkno, nread, 
- 	      lru_hits, lru_misses, lru_filled);
- 	}
-@@ -561,8 +561,8 @@ main_getblk_func (xd3_stream *stream,
-   blru->size       = nread;
-   blru->blkno      = blkno;
- 
--  IF_DEBUG1 (DP(RINT "[main_getblk] blkno %"Q"u onblk %zu pos %"Q"u "
--		"srcpos %"Q"u\n",
-+  IF_DEBUG1 (DP(RINT "[main_getblk] blkno %"Q" onblk %zu pos %"Q" "
-+		"srcpos %"Q"\n",
- 		blkno, nread, pos, sfile->source_position));
- 
-   return 0;
---- a/xdelta3-decode.h
-+++ b/xdelta3-decode.h
-@@ -224,7 +224,7 @@ xd3_decode_parse_halfinst (xd3_stream *s
-     {
-       IF_DEBUG2 ({
- 	static int cnt = 0;
--	XPR(NT "DECODE:%u: COPY at %"Q"u (winoffset %u) size %u winaddr %u\n",
-+	XPR(NT "DECODE:%u: COPY at %"Q" (winoffset %u) size %u winaddr %u\n",
- 		 cnt++,
- 		 stream->total_out + (stream->dec_position -
- 				      stream->dec_cpylen),
-@@ -265,7 +265,7 @@ xd3_decode_parse_halfinst (xd3_stream *s
- 	if (inst->type == XD3_ADD)
- 	  {
- 	    static int cnt;
--	    XPR(NT "DECODE:%d: ADD at %"Q"u (winoffset %u) size %u\n",
-+	    XPR(NT "DECODE:%d: ADD at %"Q" (winoffset %u) size %u\n",
- 	       cnt++,
- 	       (stream->total_out + stream->dec_position - stream->dec_cpylen),
- 	       stream->dec_position - stream->dec_cpylen,
-@@ -275,7 +275,7 @@ xd3_decode_parse_halfinst (xd3_stream *s
- 	  {
- 	    static int cnt;
- 	    XD3_ASSERT (inst->type == XD3_RUN);
--	    XPR(NT "DECODE:%d: RUN at %"Q"u (winoffset %u) size %u\n",
-+	    XPR(NT "DECODE:%d: RUN at %"Q" (winoffset %u) size %u\n",
- 	       cnt++,
- 	       stream->total_out + stream->dec_position - stream->dec_cpylen,
- 	       stream->dec_position - stream->dec_cpylen,
-@@ -453,7 +453,7 @@ xd3_decode_output_halfinst (xd3_stream *
- 		if ((source->onblk != blksize) &&
- 		    (blkoff + take > source->onblk))
- 		  {
--		    IF_DEBUG1 (XPR(NT "[srcfile] short at blkno %"Q"u onblk "
-+		    IF_DEBUG1 (XPR(NT "[srcfile] short at blkno %"Q" onblk "
- 				   "%u blksize %u blkoff %u take %u\n",
- 				   block,
- 				   source->onblk,
-@@ -936,7 +936,7 @@ xd3_decode_input (xd3_stream *stream)
- 
- 	stream->dec_state = DEC_CPYLEN;
- 
--	IF_DEBUG2 (DP(RINT "--------- TARGET WINDOW %"Q"u -----------\n",
-+	IF_DEBUG2 (DP(RINT "--------- TARGET WINDOW %"Q" -----------\n",
- 		      stream->current_window));
-       }
- 
-@@ -1093,8 +1093,8 @@ xd3_decode_input (xd3_stream *stream)
- 			  &src->cpyoff_blkoff);
- 	  
- 	  IF_DEBUG1(DP(RINT
--		       "decode cpyoff %"Q"u "
--		       "cpyblkno %"Q"u "
-+		       "decode cpyoff %"Q" "
-+		       "cpyblkno %"Q" "
- 		       "cpyblkoff %u "
- 		       "blksize %u\n",
- 		       stream->dec_cpyoff,
---- a/xdelta3-main.h
-+++ b/xdelta3-main.h
-@@ -616,7 +616,7 @@ main_format_bcnt (xoff_t r, shortbuf *bu
- 
-       if (r >= 100 && r < 1000)
- 	{
--	  short_sprintf (*buf, "%"Q"u %s", r, fmts[i]);
-+	  short_sprintf (*buf, "%"Q" %s", r, fmts[i]);
- 	  return buf->buf;
- 	}
- 
-@@ -716,12 +716,12 @@ main_atoux (const char* arg, xoff_t *xo,
- 
-   if (x < low)
-     {
--      XPR(NT "-%c: minimum value: %"Q"u\n", which, low);
-+      XPR(NT "-%c: minimum value: %"Q"\n", which, low);
-       return EXIT_FAILURE;
-     }
-   if (high != 0 && x > high)
-     {
--      XPR(NT "-%c: maximum value: %"Q"u\n", which, high);
-+      XPR(NT "-%c: maximum value: %"Q"\n", which, high);
-       return EXIT_FAILURE;
-     }
-   (*xo) = x;
-@@ -1296,7 +1296,7 @@ main_print_window (xd3_stream* stream, m
- 
-       if ((ret = xd3_decode_instruction (stream)))
- 	{
--	  XPR(NT "instruction decode error at %"Q"u: %s\n",
-+	  XPR(NT "instruction decode error at %"Q": %s\n",
- 	      stream->dec_winstart + size, stream->msg);
- 	  return ret;
- 	}
-@@ -1487,7 +1487,7 @@ main_print_func (xd3_stream* stream, mai
-       VC(UT "\n")VE;
-     }
- 
--  VC(UT "VCDIFF window number:         %"Q"u\n", stream->current_window)VE;
-+  VC(UT "VCDIFF window number:         %"Q"\n", stream->current_window)VE;
-   VC(UT "VCDIFF window indicator:      ")VE;
-   if ((stream->dec_win_ind & VCD_SOURCE) != 0) VC(UT "VCD_SOURCE ")VE;
-   if ((stream->dec_win_ind & VCD_TARGET) != 0) VC(UT "VCD_TARGET ")VE;
-@@ -1513,14 +1513,14 @@ main_print_func (xd3_stream* stream, mai
- 
-   if (stream->dec_winstart != 0)
-     {
--      VC(UT "VCDIFF window at offset:      %"Q"u\n", stream->dec_winstart)VE;
-+      VC(UT "VCDIFF window at offset:      %"Q"\n", stream->dec_winstart)VE;
-     }
- 
-   if (SRCORTGT (stream->dec_win_ind))
-     {
-       VC(UT "VCDIFF copy window length:    %u\n",
- 	 (usize_t)stream->dec_cpylen)VE;
--      VC(UT "VCDIFF copy window offset:    %"Q"u\n",
-+      VC(UT "VCDIFF copy window offset:    %"Q"\n",
- 	 stream->dec_cpyoff)VE;
-     }
- 
-@@ -1973,7 +1973,7 @@ main_merge_output (xd3_stream *stream, m
- 		  XD3_ASSERT (inst->addr >= window_start);
- 		  addr = inst->addr - window_start;
- 		}
--	      IF_DEBUG2 (XPR(NTR "[merge copy] winpos %u take %u addr %"Q"u mode %u\n",
-+	      IF_DEBUG2 (XPR(NTR "[merge copy] winpos %u take %u addr %"Q" mode %u\n",
- 			    window_pos, take, addr, inst->mode));
- 	      if ((ret = xd3_found_match (recode_stream, window_pos, take,
- 					  addr, inst->mode != 0)))
-@@ -2249,7 +2249,7 @@ main_pipe_copier (uint8_t     *pipe_buf,
- 
-   if (option_verbose && skipped != 0)
-     {
--      XPR(NT "skipping %"Q"u bytes in %s\n",
-+      XPR(NT "skipping %"Q" bytes in %s\n",
- 	  skipped, ifile->filename);
-     }
-   return 0;
-@@ -3290,7 +3290,7 @@ main_input (xd3_cmd     cmd,
- 		    /* Warn when no source copies are found */
- 		    if (option_verbose && ! xd3_encoder_used_source (& stream))
- 		      {
--			XPR(NT "warning: input window %"Q"u..%"Q"u has "
-+			XPR(NT "warning: input window %"Q"..%"Q" has "
- 			    "no source copies\n",
- 			    stream.current_window * winsize,
- 			    (stream.current_window+1) * winsize);
-@@ -3303,7 +3303,7 @@ main_input (xd3_cmd     cmd,
- 			stream.srcwin_decided_early &&
- 			stream.i_slots_used > stream.iopt_size)
- 		      {
--			XPR(NT "warning: input position %"Q"u overflowed "
-+			XPR(NT "warning: input position %"Q" overflowed "
- 			    "instruction buffer, needed %u (vs. %u), "
- 			    "consider changing -I\n",
- 			    stream.current_window * winsize,
-@@ -3327,7 +3327,7 @@ main_input (xd3_cmd     cmd,
- 
- 		    if (option_verbose > 1)
- 		      {
--			XPR(NT "%"Q"u: in %s (%s): out %s (%s): "
-+			XPR(NT "%"Q": in %s (%s): out %s (%s): "
- 			    "total in %s: out %s: %s: srcpos %s\n",
- 			    stream.current_window,
- 			    main_format_bcnt (this_read, &rdb),
-@@ -3341,7 +3341,7 @@ main_input (xd3_cmd     cmd,
- 		      }
- 		    else
- 		      {
--			XPR(NT "%"Q"u: in %s: out %s: total in %s: "
-+			XPR(NT "%"Q": in %s: out %s: total in %s: "
- 			    "out %s: %s\n",
-  			    stream.current_window,
- 			    main_format_bcnt (this_read, &rdb),
-@@ -3437,12 +3437,12 @@ done:
- 
-   if (option_verbose > 2 && cmd == CMD_ENCODE)
-     {
--      XPR(NT "source copies: %"Q"u (%"Q"u bytes)\n",
-+      XPR(NT "source copies: %"Q" (%"Q" bytes)\n",
- 	  stream.n_scpy, stream.l_scpy);
--      XPR(NT "target copies: %"Q"u (%"Q"u bytes)\n",
-+      XPR(NT "target copies: %"Q" (%"Q" bytes)\n",
- 	  stream.n_tcpy, stream.l_tcpy);
--      XPR(NT "adds: %"Q"u (%"Q"u bytes)\n", stream.n_add, stream.l_add);
--      XPR(NT "runs: %"Q"u (%"Q"u bytes)\n", stream.n_run, stream.l_run);
-+      XPR(NT "adds: %"Q" (%"Q" bytes)\n", stream.n_add, stream.l_add);
-+      XPR(NT "runs: %"Q" (%"Q" bytes)\n", stream.n_run, stream.l_run);
-     }
- #endif
- 
-@@ -3454,7 +3454,7 @@ done:
-       long end_time = get_millisecs_now ();
-       xoff_t nwrite = ofile != NULL ? ofile->nwrite : 0;
- 
--      XPR(NT "finished in %s; input %"Q"u output %"Q"u bytes (%0.2f%%)\n",
-+      XPR(NT "finished in %s; input %"Q" output %"Q" bytes (%0.2f%%)\n",
- 	  main_format_millis (end_time - start_time, &tm),
- 	  ifile->nread, nwrite, 100.0 * nwrite / ifile->nread);
-     }
diff --git a/debian/patches/fix_lzma_test.patch b/debian/patches/fix_lzma_test.patch
deleted file mode 100644
index 281368c..0000000
--- a/debian/patches/fix_lzma_test.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-Description: Fix LZMA tests
-Origin: upstream, https://github.com/jmacd/xdelta-devel/commit/806836136cec2eeb763b4b539d4d41bc2c5bbf5c
-Bug: https://github.com/jmacd/xdelta/issues/159
-Bug-Debian: https://bugs.debian.org/740284
-Forwarded: not-needed
-Author: Josh MacDonald <josh.macdon...@gmail.com>
-Reviewed-by: Salvatore Bonaccorso <car...@debian.org>
-Last-Update: 2016-02-19
-
----
-
---- a/xdelta3-test.h
-+++ b/xdelta3-test.h
-@@ -1059,9 +1059,9 @@ test_decompress_single_bit_error (xd3_st
-     }
- 
-   /* Check expected non-failures */
--  if (non_failures != expected_non_failures)
-+  if (non_failures > expected_non_failures)
-     {
--      XPR(NT "non-failures %u; expected %u",
-+      XPR(NT "non-failures %u > expected %u",
- 	 non_failures, expected_non_failures);
-       stream->msg = "incorrect";
-       return XD3_INTERNAL;
diff --git a/debian/patches/printf_uint64 b/debian/patches/printf_uint64
deleted file mode 100644
index 9373ea6..0000000
--- a/debian/patches/printf_uint64
+++ /dev/null
@@ -1,40 +0,0 @@
---- a/xdelta3.h
-+++ b/xdelta3.h
-@@ -152,25 +152,25 @@ typedef uint32_t usize_t;
- #ifndef _FILE_OFFSET_BITS
- #define _FILE_OFFSET_BITS 64
- #endif
--
- typedef uint64_t xoff_t;
- #define SIZEOF_XOFF_T 8
- #define SIZEOF_USIZE_T 4
- #ifndef WIN32
--#if SIZEOF_SIZE_T == 8
--#define Q "z"
--#else
--#define Q "ll"
--#endif
--#else
--#define Q "I64"
--#endif
--#else
-+#define __STDC_FORMAT_MACROS
-+#include <inttypes.h>
-+#define Q  PRIu64 /* to print uint64_t that is xoff_t */
-+#define Qd PRId64 /* to print  int64_t  */
-+#else      /*WIN32*/
-+#define Q  "I64u"
-+#define Qd "I64d"
-+#endif     /*WIN32*/
-+#else /* XD3_USE_LARGEFILE64 */
- typedef uint32_t xoff_t;
- #define SIZEOF_XOFF_T 4
- #define SIZEOF_USIZE_T 4
--#define Q
--#endif
-+#define Q  "u"
-+#define Qd "d"
-+#endif /* XD3_USE_LARGEFILE64 */
- 
- #define USE_UINT32 (SIZEOF_USIZE_T == 4 || \
- 		    SIZEOF_XOFF_T == 4 || REGRESSION_TEST)
diff --git a/debian/patches/regtest_size_t b/debian/patches/regtest_size_t
deleted file mode 100644
index 98be9aa..0000000
--- a/debian/patches/regtest_size_t
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/testing/regtest.cc
-+++ b/testing/regtest.cc
-@@ -12,7 +12,7 @@ public:
-     Options() : encode_srcwin_maxsz(1<<20), 
- 		block_size(Constants::BLOCK_SIZE),
- 		size_known(false) { }
--    size_t encode_srcwin_maxsz;
-+    uint64_t encode_srcwin_maxsz;
-     size_t block_size;
-     bool size_known;
-   };
diff --git a/debian/python-xdelta3.examples b/debian/python-xdelta3.examples
deleted file mode 100644
index 11e1313..0000000
--- a/debian/python-xdelta3.examples
+++ /dev/null
@@ -1 +0,0 @@
-testing/xdelta3-test.py
diff --git a/debian/python-xdelta3.substvars b/debian/python-xdelta3.substvars
deleted file mode 100644
index abd3ebe..0000000
--- a/debian/python-xdelta3.substvars
+++ /dev/null
@@ -1 +0,0 @@
-misc:Depends=
diff --git a/debian/rules b/debian/rules
index d09dc07..0c88c39 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,5 +1,12 @@
 #!/usr/bin/make -f
 
-include /usr/share/cdbs/1/rules/debhelper.mk
-include /usr/share/cdbs/1/class/autotools.mk
+export DEB_BUILD_MAINT_OPTIONS = hardening=+all
+export DEB_LDFLAGS_MAINT_APPEND = -Wl,-z,defs -Wl,--as-needed
 
+%:
+	dh $@
+
+override_dh_auto_test:
+ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
+	./xdelta3regtest
+endif
-- 
2.17.0

Reply via email to