--- /dev/null
+RELEASE=3.1
+
+# Note: compile as root fail, so you need to do that as unpriv. user
+
+TARVER=1.27.1
+DEBREL=1
+PVETARVER=${TARVER}+pve.1
+
+# also update changelog
+
+TARSRC=tar_${TARVER}.orig.tar.xz
+TARDEBSRC=tar_${TARVER}-${DEBREL}.debian.tar.xz
+TARDIR=tar-${TARVER}
+
+ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
+GITVERSION:=$(shell cat .git/refs/heads/master)
+SOURCETXT="git clone git://git.proxmox.com/git/tar.git\\ngit checkout ${GITVERSION}"
+
+DEB=tar_${PVETARVER}_${ARCH}.deb
+
+all: deb
+
+.PHONY: dinstall
+dinstall: deb
+ dpkg -i ${DEB}
+
+.PHONY: deb
+deb ${DEB}: ${TARSRC}
+ rm -rf ${TARDIR}
+ tar xf ${TARSRC}
+ cd ${TARDIR}; tar xf ../${TARDEBSRC}
+ echo "${SOURCETXT}" > ${TARDIR}/debian/SOURCE
+ echo "debian/SOURCE" >>${TARDIR}/debian/docs
+ mv ${TARDIR}/debian/changelog ${TARDIR}/debian/changelog.org
+ cat changelog ${TARDIR}/debian/changelog.org >${TARDIR}/debian/changelog
+ cd ${TARDIR}; patch -p1 <../fix-sparse-archives.patch
+ cd ${TARDIR}; dpkg-buildpackage -b -uc -us
+
+.PHONY: upload
+upload:
+ umount /pve/${RELEASE}; mount /pve/${RELEASE} -o rw
+ mkdir -p /pve/${RELEASE}/extra
+ rm -rf /pve/${RELEASE}/extra/apt-transport-https_*.deb
+ rm -rf /pve/${RELEASE}/extra/Packages*
+ cp ${DEB} /pve/${RELEASE}/extra
+ cd /pve/${RELEASE}/extra; dpkg-scanpackages . /dev/null > Packages; gzip -9c Packages > Packages.gz
+ umount /pve/${RELEASE}; mount /pve/${RELEASE} -o ro
+
+.PHONY: clean
+clean:
+ rm -rf *~ *_${ARCH}.deb *_all.deb *_${ARCH}.udeb *.changes *.dsc ${TARDIR}
--- /dev/null
+tar (1.27.1+pve.1) unstable; urgency=low
+
+ * fix Debian bug #737226: tar --sparse silently corrupts files on
+ filesystems where non-empty files may have zero blocks
+
+ -- Proxmox Support Team <support@proxmox.com> Tue, 18 Feb 2014 06:57:44 +0100
+
--- /dev/null
+See https://bugzilla.redhat.com/show_bug.cgi?id=1024268
+
+--- old/src/sparse.c 2013-03-14 16:18:10.000000000 -0400
++++ new/src/sparse.c 2013-10-28 16:50:20.966528811 -0400
+@@ -221,9 +221,13 @@ sparse_scan_file (struct tar_sparse_file
+
+ st->archive_file_size = 0;
+
++#if 0
++ /* this shortcut is not safe because some filesystems such as Netapp
++ can hold small files without allocating any blocks. */
+ if (ST_NBLOCKS (st->stat) == 0)
+ offset = st->stat.st_size;
+ else
++#endif
+ {
+ if (!tar_sparse_scan (file, scan_begin, NULL))
+ return false;