tags 533483 + patch thanks Dear maintainer,
I've prepared an NMU for ddrescue (versioned as 1.14-0.1) and plan to upload it. Please let me know if you have any objections. regards, -mika-
diff -Nru ddrescue-1.13/dd_rescue.c ddrescue-1.14/dd_rescue.c --- ddrescue-1.13/dd_rescue.c 2007-03-18 15:29:10.000000000 +0100 +++ ddrescue-1.14/dd_rescue.c 2007-08-26 15:42:44.000000000 +0200 @@ -1,13 +1,13 @@ /* dd_rescue.c */ /* - * dd_rescue copies your data from one file to another - * files might as well be block devices, such as hd partitions - * unlike dd, it does not necessarily abort on errors, but + * dd_rescue copies your data from one file to another. + * Files might as well be block devices, such as hd partitions. + * Unlike dd, it does not necessarily abort on errors but * continues to copy the disk, possibly leaving holes behind. * Also, it does NOT truncate the output file, so you can copy * more and more pieces of your data, as time goes by. - * So, this tool is suitable for rescueing data of crashed disk, - * and that's the reason, it has been written by me. + * This tool is thus suitable for rescueing data of crashed disk, + * and that's the reason it has been written by me. * * (c) Kurt Garloff <garl...@suse.de>, 11/97, 10/99 * Copyright: GNU GPL @@ -26,7 +26,7 @@ # define VERSION "(unknown)" #endif -#define ID "$Id: dd_rescue.c,v 1.55 2007/03/18 14:29:10 garloff Exp $" +#define ID "$Id: dd_rescue.c,v 1.59 2007/08/26 13:42:44 garloff Exp $" #ifndef SOFTBLOCKSIZE # define SOFTBLOCKSIZE 65536 @@ -60,7 +60,7 @@ int verbose, quiet, interact, force; void* buf; char *lname, *iname, *oname, *bbname = NULL; -off_t ipos, opos, xfer, lxfer, sxfer, fxfer, maxxfer; +off_t ipos, opos, xfer, lxfer, sxfer, fxfer, maxxfer, init_opos; int ides, odes, identical, pres; int o_dir_in, o_dir_out; @@ -71,9 +71,17 @@ struct timezone tz; clock_t startclock; -const char* up = "\x1b[A"; //] -const char* down = "\n"; -const char* right = "\x1b[C"; //] +#ifndef UP +# define UP "\x1b[A" +# define DOWN "\n" +# define RIGHT "\x1b[C" +#endif + +const char* up = UP; +const char* down = DOWN; +const char* right = RIGHT; + +int lastsparse = 0; inline float difftimetv(const struct timeval* const t2, const struct timeval* const t1) @@ -232,11 +240,27 @@ printstatus(report, logfd, 0, 1); } +int mayexpandfile() +{ + struct stat st; + off_t maxopos = opos; + if (init_opos > opos) + maxopos = init_opos; + stat(oname, &st); + if (!S_ISREG(st.st_mode)) + return 0; + if (st.st_size < maxopos) + return truncate(oname, maxopos); + else + return 0; +} + int cleanup() { int rc, errs = 0; if (odes != -1) { - /* Make sure, the output file is expanded to the last (first) position */ + /* Make sure, the output file is expanded to the last (first) position + * FIXME: 0 byte writes do NOT expand file */ pwrite(odes, buf, 0, opos); rc = fsync(odes); if (rc) { @@ -250,6 +274,11 @@ oname, (float)opos/1024, strerror(errno)); ++errs; } + if (sparse) + rc = mayexpandfile(); + if (rc) + fplog(stderr, "dd_rescue: (warning): %s (%1.fk): %s!\n", + oname, (float)opos/1024, strerror(errno)); } if (ides != -1) { rc = close(ides); @@ -272,8 +301,8 @@ unsigned long* ptr = (unsigned long*)blk; while ((ptr-(unsigned long*)blk) < ln/sizeof(unsigned long)) if (*(ptr++)) - return 0; - return 1; + return (sizeof(unsigned long)*(ptr-(unsigned long*)blk)); + return ln; } inline ssize_t mypread(int fd, void* bf, size_t sz, off_t off) @@ -340,8 +369,9 @@ (float)ipos/1024, (float)xfer/1024, (float)max/1024, bs, down, down, down); #endif - /* expand file to the right length */ - if (!o_chr) + /* expand file to AT LEAST the right length + * FIXME: 0 byte writes do NOT expand file */ + if (!o_chr) pwrite(odes, buf, 0, opos); while ( (!max || (max-xfer > 0)) && ((!reverse) || (ipos > 0 && opos > 0)) ) { @@ -396,6 +426,7 @@ if (nosparse) { ssize_t wr = 0; errs += ((wr = writeblock(toread)) < toread ? 1: 0); + lastsparse = 0; if (wr < 0 && (errno == ENOSPC || (errno == EFBIG && !reverse))) return errs; @@ -425,8 +456,12 @@ /* But first: write available data and advance (optimization) */ if (rd > 0) { ssize_t wr = 0; errno = 0; - if (!sparse || !blockiszero(buf, bs)) + if (!sparse || blockiszero(buf, bs) < rd) { errs += ((wr = writeblock(rd)) < rd ? 1: 0); + lastsparse = 0; + } else + lastsparse = 1; + if (!reverse) { ipos += rd; opos += rd; sxfer += wr; xfer += rd; @@ -451,7 +486,7 @@ old_xfer = xfer; errs += (err = copyfile(new_max, hardbs)); /* EOF */ - if (!err && old_xfer == xfer) + if (!err && old_xfer == xfer) return errs; /* if (reverse && rd) { @@ -470,7 +505,7 @@ } errno = 0; /* EOF ? */ - if (!err && xfer == old_xfer) + if (!err && xfer == old_xfer) return errs; if (verbose) fprintf(stderr, "dd_rescue: (info): ipos %.1fk promote to large bs again! \n%s%s%s", @@ -480,8 +515,11 @@ /* errno == 0: We can write to disk */ if (rd > 0) { ssize_t wr = 0; - if (!sparse || !blockiszero(buf, bs)) + if (!sparse || blockiszero(buf, bs) < rd) { errs += ((wr = writeblock(rd)) < rd ? 1: 0); + lastsparse = 0; + } else + lastsparse = 1; sxfer += wr; xfer += rd; if (reverse) { ipos -= rd; opos -= rd; @@ -685,6 +723,7 @@ } } + init_opos = opos; if (optind < argc) iname = argv[optind++]; if (optind < argc) @@ -892,7 +931,6 @@ } c = copyfile(maxxfer, softbs); - gettimeofday(¤ttime, NULL); printreport(); cleanup(); diff -Nru ddrescue-1.13/debian/changelog ddrescue-1.14/debian/changelog --- ddrescue-1.13/debian/changelog 2009-08-13 12:59:49.000000000 +0200 +++ ddrescue-1.14/debian/changelog 2009-08-13 12:59:50.000000000 +0200 @@ -1,3 +1,18 @@ +ddrescue (1.14-0.1) unstable; urgency=low + + * Non-maintainer upload. + * New upstream release. (Closes: #533483) + * Make package lintian clean: + - Bump Standard-Version to 3.8.2 (no further changes). + - Move DH_COMPAT from debian/rules to debian/compat and set to level 5. + - Drop unnecessary configure target from debian/rules. + - Do not ignore errors from 'make clean' in debian/rules. + - Update copyright file. + - Build-Depends on debhelper >= 5. + - Update watch format to version 3. + + -- Michael Prokop <m...@debian.org> Thu, 13 Aug 2009 12:28:47 +0200 + ddrescue (1.13-3) unstable; urgency=low * Revert to old packaging. diff -Nru ddrescue-1.13/debian/compat ddrescue-1.14/debian/compat --- ddrescue-1.13/debian/compat 1970-01-01 01:00:00.000000000 +0100 +++ ddrescue-1.14/debian/compat 2009-08-13 12:59:50.000000000 +0200 @@ -0,0 +1 @@ +5 diff -Nru ddrescue-1.13/debian/control ddrescue-1.14/debian/control --- ddrescue-1.13/debian/control 2009-08-13 12:59:49.000000000 +0200 +++ ddrescue-1.14/debian/control 2009-08-13 12:59:50.000000000 +0200 @@ -2,8 +2,8 @@ Section: utils Priority: optional Maintainer: Ayman Negm <n...@debian.org> -Build-Depends: debhelper (>> 4.0.0) -Standards-Version: 3.7.2 +Build-Depends: debhelper (>= 5) +Standards-Version: 3.8.2 Package: ddrescue Architecture: any diff -Nru ddrescue-1.13/debian/copyright ddrescue-1.14/debian/copyright --- ddrescue-1.13/debian/copyright 2009-08-13 12:59:49.000000000 +0200 +++ ddrescue-1.14/debian/copyright 2009-08-13 12:59:50.000000000 +0200 @@ -6,6 +6,24 @@ Upstream Author: Kurt Garloff <k...@garloff.de> Copyright: - ddrescue is Copyright (C) by Kurt Garloff<k...@garloff.de>. - and is covered under the terms of the GPL. See the file - /usr/share/common-licenses/GPL for more information. + + Copyright © 1999 by Kurt Garloff <k...@garloff.de> + +License: + + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 dated June, 1991. + + This package 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 + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + 02110-1301, USA. + +On Debian GNU/Linux systems, the complete text of the GNU General +Public License can be found in `/usr/share/common-licenses/GPL-2'. diff -Nru ddrescue-1.13/debian/rules ddrescue-1.14/debian/rules --- ddrescue-1.13/debian/rules 2009-08-13 12:59:49.000000000 +0200 +++ ddrescue-1.14/debian/rules 2009-08-13 12:59:50.000000000 +0200 @@ -5,10 +5,6 @@ # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 -export DH_COMPAT=4 - - - CFLAGS = -Wall -g ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) @@ -17,17 +13,9 @@ CFLAGS += -O2 endif -configure: configure-stamp -configure-stamp: - dh_testdir - # Add here commands to configure the package. - - touch configure-stamp - - build: build-stamp -build-stamp: configure-stamp +build-stamp: dh_testdir # Add here commands to compile the package. @@ -37,10 +25,10 @@ clean: dh_testdir dh_testroot - rm -f build-stamp configure-stamp + rm -f build-stamp # Add here commands to clean up after the build process. - -$(MAKE) clean + $(MAKE) clean dh_clean @@ -53,7 +41,6 @@ # Add here commands to install the package into debian/ddrescue. $(MAKE) install DESTDIR=$(CURDIR)/debian/ddrescue - # Build architecture-independent files here. binary-indep: build install # We have nothing to do by default. @@ -75,4 +62,4 @@ dh_builddeb binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install configure +.PHONY: build clean binary-indep binary-arch binary install diff -Nru ddrescue-1.13/debian/watch ddrescue-1.14/debian/watch --- ddrescue-1.13/debian/watch 2009-08-13 12:59:49.000000000 +0200 +++ ddrescue-1.14/debian/watch 2009-08-13 12:59:50.000000000 +0200 @@ -1,4 +1,2 @@ -# to check for upstream updates and more. -# Site Directory Pattern Version Script -#version=2 -http://www.garloff.de/ kurt/linux/ddrescue/ dd_rescue-(.*)\.tar\.gz debian uupdate +version=3 +http://www.garloff.de/kurt/linux/ddrescue/dd_rescue-(.*)\.tar\.gz diff -Nru ddrescue-1.13/Makefile ddrescue-1.14/Makefile --- ddrescue-1.13/Makefile 2007-03-18 15:26:18.000000000 +0100 +++ ddrescue-1.14/Makefile 2007-08-26 15:36:56.000000000 +0200 @@ -1,8 +1,8 @@ # Makefile for dd_rescue # (c) garl...@suse.de, 99/10/09, GNU GPL -# $Id: Makefile,v 1.19 2007/03/18 14:23:51 garloff Exp $ +# $Id: Makefile,v 1.20 2007/08/26 13:36:56 garloff Exp $ -VERSION = 1.13 +VERSION = 1.14 DESTDIR =