Hello community,

here is the log from the commit of package dd_rescue for openSUSE:Factory 
checked in at 2013-08-20 11:35:50
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/dd_rescue (Old)
 and      /work/SRC/openSUSE:Factory/.dd_rescue.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "dd_rescue"

Changes:
--------
--- /work/SRC/openSUSE:Factory/dd_rescue/dd_rescue.changes      2013-08-10 
11:18:13.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.dd_rescue.new/dd_rescue.changes 2013-08-20 
11:35:52.000000000 +0200
@@ -1,0 +2,11 @@
+Thu Aug 18 23:52:41 CEST 2013 - [email protected]
+
+- Update to dd_rescue-1.40:
+  * Copy xattrs on -p/--preserve
+  * For odd file offsets, do odd-sized write first, so subsequent
+    writes are aligned.
+  * Support half-empty block sparse detection and double softbs
+    default for buffered IO.
+  * Add a lot more test cases to make check.
+
+-------------------------------------------------------------------

Old:
----
  dd_rescue-1.39.tar.gz

New:
----
  dd_rescue-1.40.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ dd_rescue.spec ++++++
--- /var/tmp/diff_new_pack.plBomw/_old  2013-08-20 11:35:53.000000000 +0200
+++ /var/tmp/diff_new_pack.plBomw/_new  2013-08-20 11:35:53.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           dd_rescue
-Version:        1.39
+Version:        1.40
 Release:        0
 Summary:        Data Copying in the Presence of I/O Errors
 License:        GPL-2.0 or GPL-3.0
@@ -25,6 +25,7 @@
 Url:            http://www.garloff.de/kurt/linux/ddrescue/
 Source0:        http://garloff.de/kurt/linux/ddrescue/%{name}-%{version}.tar.gz
 BuildRequires:  autoconf
+BuildRequires:  libattr-devel
 BuildRequires:  libfallocate-devel
 Requires:       bc
 Recommends:     dd_rhelp libfallocate0

++++++ dd_rescue-1.39.tar.gz -> dd_rescue-1.40.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dd_rescue/Makefile new/dd_rescue/Makefile
--- old/dd_rescue/Makefile      2013-08-08 12:05:00.000000000 +0200
+++ new/dd_rescue/Makefile      2013-08-12 23:29:50.000000000 +0200
@@ -1,8 +1,8 @@
 # Makefile for dd_rescue
 # (c) [email protected], 99/10/09, GNU GPL
-# $Id: Makefile,v 1.73 2013/08/08 10:05:00 garloff Exp $
+# $Id: Makefile,v 1.76 2013/08/12 21:29:50 garloff Exp $
 
-VERSION = 1.39
+VERSION = 1.40
 
 DESTDIR = 
 
@@ -123,8 +123,32 @@
        gzip -9 $(MANDIR)/man1/dd_rescue.1
 
 check: $(TARGETS) find_nonzero
+       ./find_nonzero 2
+       rm -f dd_rescue.copy dd_rescue.copy2
        ./dd_rescue -apP dd_rescue dd_rescue.copy
        cmp dd_rescue dd_rescue.copy 
-       ./find_nonzero 2
        rm dd_rescue.copy
+       ./dd_rescue -b16k -B16k -a dd_rescue dd_rescue.copy
+       cmp dd_rescue dd_rescue.copy
+       rm dd_rescue.copy
+       ./dd_rescue -r dd_rescue dd_rescue.copy
+       cmp dd_rescue dd_rescue.copy
+       ./dd_rescue -x dd_rescue dd_rescue.copy
+       cat dd_rescue dd_rescue > dd_rescue.copy2
+       cmp dd_rescue.copy dd_rescue.copy2
+       rm dd_rescue.copy dd_rescue.copy2
+       rm -f zero zero2
+       ./dd_rescue -a -m 261k /dev/zero zero
+       du zero
+       ./dd_rescue -S 12k -m 4k -b 4k -Z 0 zero
+       ./dd_rescue -S 20k -m 4k -b 4k -Z 0 zero
+       ./dd_rescue -a -b 8k zero zero2
+       du zero zero2
+       cmp zero zero2
+       rm zero2
+       ./dd_rescue -a -b 16k zero zero2
+       du zero zero2
+       cmp zero zero2
+       rm zero zero2
+       
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dd_rescue/configure.in new/dd_rescue/configure.in
--- old/dd_rescue/configure.in  2013-08-08 13:14:42.000000000 +0200
+++ new/dd_rescue/configure.in  2013-08-12 22:45:22.000000000 +0200
@@ -1,4 +1,4 @@
-AC_INIT(dd_rescue, 1.38.1, [email protected])
+AC_INIT(dd_rescue, 1.40, [email protected])
 AC_CONFIG_HEADER(config.h)
 AC_PROG_CC
 AC_C_CONST
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dd_rescue/dd_rescue.1 new/dd_rescue/dd_rescue.1
--- old/dd_rescue/dd_rescue.1   2013-08-07 09:27:24.000000000 +0200
+++ new/dd_rescue/dd_rescue.1   2013-08-18 23:28:35.000000000 +0200
@@ -1,4 +1,4 @@
-.\" $Id: dd_rescue.1,v 1.14 2013/08/07 07:27:24 garloff Exp $
+.\" $Id: dd_rescue.1,v 1.15 2013/08/18 21:15:10 garloff Exp $
 .
 .TH dd_rescue 1 "2013-02-24" "Kurt Garloff" "Rescue copy tool"
 .
@@ -333,7 +333,7 @@
 .TP 8
 .BR \-p ", " \-\-preserve
 When copying files, this option does result in file metadata (timestamps,
-ownership, access rights) to be copied, similar to the option with the
+ownership, access rights, xattrs) to be copied, similar to the option with the
 same name in the cp program.
 .br
 Note that 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dd_rescue/dd_rescue.c new/dd_rescue/dd_rescue.c
--- old/dd_rescue/dd_rescue.c   2013-08-08 14:18:59.000000000 +0200
+++ new/dd_rescue/dd_rescue.c   2013-08-18 23:48:51.000000000 +0200
@@ -31,7 +31,6 @@
 
 /**
  * TODO:
- * - Provide options to copy ACLs/xattrs as well
  * - Use termcap to fetch cursor up/down and color codes
  * - Display more infos on errors by collecting info from syslog
  * - Option to send TRIM on zeroed file blocks
@@ -49,10 +48,10 @@
 # define __COMPILER__ "(unknown compiler)"
 #endif
 
-#define ID "$Id: dd_rescue.c,v 1.224 2013/08/08 12:18:59 garloff Exp $"
+#define ID "$Id: dd_rescue.c,v 1.238 2013/08/18 21:48:51 garloff Exp $"
 
 #ifndef BUF_SOFTBLOCKSIZE
-# define BUF_SOFTBLOCKSIZE 65536
+# define BUF_SOFTBLOCKSIZE 131072
 #endif
 
 #ifndef BUF_HARDBLOCKSIZE
@@ -152,6 +151,13 @@
 # undef __KERNEL__
 #endif
 
+/* xattrs */
+#ifdef HAVE_ATTR_XATTR_H
+# include <attr/xattr.h>
+#else
+/* TODO: Could provide the prototypes for the syscalls ourselves ... */
+#endif
+
 /* fwd decls */
 int cleanup();
 
@@ -743,6 +749,61 @@
        return err;
 }
 
+
+/** Copy xattrs */
+int copyxattr(const char* inm, const char* onm)
+#ifdef HAVE_ATTR_XATTR_H
+{
+       char *attrs = NULL;
+       ssize_t aln = listxattr(inm, NULL, 0);
+       int copied = 0;
+       if (aln <= 0)
+               return 0;
+       attrs = (char*)malloc(aln);
+       if (!attrs) {
+               fplog(stderr, WARN, "Can't allocate buffer of len %z for attr 
names\n", aln);
+               return -1;
+       }
+       aln = listxattr(inm, attrs, aln);
+       if (aln <= 0) {
+               fplog(stderr, WARN, "Could not read attr list: %s\n", 
strerror(errno));
+               free(attrs);
+               return -1;
+       }
+       int offs;
+       unsigned char* extrabuf = buf;
+       int ebufall = 0;
+       for (offs = 0; offs < aln; offs += 1+strlen(attrs+offs)) {
+               ssize_t itln = getxattr(inm, attrs+offs, NULL, 0);
+               if (ebufall && itln > ebufall) {
+                       extrabuf = (unsigned char*)realloc(extrabuf, itln);
+                       ebufall = itln;
+               } else if (itln > (ssize_t)softbs) {
+                       extrabuf = (unsigned char*)malloc(itln);
+                       ebufall = itln;
+               }
+               itln = getxattr(inm, attrs+offs, extrabuf, itln);
+               if (itln <= 0) {
+                       fplog(stderr, WARN, "Could not read attr %s: %s\n", 
attrs+offs, strerror(errno));
+                       continue;
+               }
+               if (setxattr(onm, attrs+offs, extrabuf, itln, 0))
+                       fplog(stderr, WARN, "Could not write attr %s: %s\n", 
attrs+offs, strerror(errno));
+               if (verbose)
+                       fplog(stderr, INFO, "Copied attr %s (%i bytes)\n", 
attrs+offs, itln);
+               ++copied;
+       }
+       if (ebufall)
+               free(extrabuf);
+       free(attrs);
+       return copied;
+}
+#else
+{
+       return 0;
+}
+#endif
+
 /** File time copy */
 int copytimes(const char* inm, const char* onm)
 {
@@ -838,13 +899,17 @@
                rc = sync_close(oft->fd, oft->name, oft->cdev);
        }
        ZFREE(origbuf2);
-       ZFREE(origbuf);
        ZFREE(graph);
-       if (preserve)
+       if (preserve) {
+               copyxattr(iname, oname);
                copytimes(iname, oname);
+       }
        LISTFOREACH(ofiles, of)
-               if (preserve)
+               if (preserve) {
+                       copyxattr(iname, LISTDATA(of).name);
                        copytimes(iname, LISTDATA(of).name);
+               }
+       ZFREE(origbuf);
        if (prng_state2) {
                frandom_release(prng_state2);
                prng_state2 = 0;
@@ -881,7 +946,10 @@
 {
        if (i_repeat && i_rep_zero)
                return i_rep_zero;
-       i_rep_zero = find_nonzero_opt(blk, ln);
+       if (!ln || *blk) 
+               i_rep_zero = 0;
+       else
+               i_rep_zero = find_nonzero_opt(blk, ln);
        return i_rep_zero;
 }
 
@@ -1001,6 +1069,17 @@
                if (block > opos)
                        block = opos;
        }
+       /* If we write the first block and it's a full block, do alignment ... 
*/
+       if (block == bs && !xfer && ((opos % bs && !o_chr) || (ipos % bs && 
!i_chr))) {
+               /* Write alignment is more important except if o_chr == 1 */
+               int off = opos % bs;
+               if (o_chr)
+                       off = ipos % bs;
+               if (reverse)
+                       block = off;
+               else
+                       block = bs - off;
+       }
        return block;
 }
 
@@ -1045,10 +1124,9 @@
        ssize_t wr = 0;
        weno = 0;
        errno = 0;
-       if (!sparse || blockiszero(buf, rd) < rd) {
-               err = ((wr = writeblock(rd)) < rd ? 1: 0);
-               weno = errno;
-       }
+       err = ((wr = writeblock(rd)) < rd ? 1: 0);
+       weno = errno;
+
        if (err && is_writeerr_fatal(weno))
                ++fatal;
        if (err) {
@@ -1067,12 +1145,56 @@
        return wr;
 }
 
+/* Write rd-sized block at buf; if sparse is set, check if at least half of the
+ * block is empty and if so, move over the sparse pieces ... */
+ssize_t dowrite_sparse(const ssize_t rd)
+{
+       /* Simple case: sparse not set => just write */
+       if (!sparse)
+               return dowrite(rd);
+       ssize_t zln = blockiszero(buf, rd);
+       /* Also simple: Whole block is empty, so just move on */
+       if (zln >= rd) {
+               advancepos(rd, 0);
+               weno = 0;
+               return 0;
+       }
+       /* Block is smaller than 2*hardbs and not completely zero, so don't 
bother optimizing ... */
+       if (rd < 2*(ssize_t)hardbs)
+               return dowrite(rd);
+       /* Check both halves -- aligned to hardbs boundaries */
+       int mid = rd/2;
+       mid -= mid%hardbs;
+       zln -= zln%hardbs;
+       /* First half is empty */
+       if (zln >= mid) {
+               unsigned char* oldbuf = buf;
+               advancepos(zln, zln);
+               buf += zln;
+               ssize_t wr = dowrite(rd-zln);
+               buf = oldbuf;
+               return wr;
+       }
+       /* Check second half */
+       ssize_t zln2 = blockiszero(buf+mid, rd-mid);
+       if (zln2 < rd-mid)
+               return dowrite(rd);
+       else {
+               ssize_t wr = dowrite(mid);
+               //advancepos(mid, wr);
+               if (wr != mid) 
+                       return wr;
+               advancepos(rd-mid, 0);
+               return wr;
+       }
+}
+
 /* Do write with retry if rd > hardbs, update positions ... 
  * Returns 0 on success, -1 on fatal error, 1 on normal error. */
 int dowrite_retry(const ssize_t rd)
 {
        int errs = 0;
-       ssize_t wr = dowrite(rd);
+       ssize_t wr = dowrite_sparse(rd);
        if (wr == rd || weno == 0)
                return 0;
        if ((rd <= (ssize_t)hardbs) || (weno != ENOSPC && weno != EFBIG)) {
@@ -1257,7 +1379,7 @@
                        /* Non fatal error */
                        new_max = xfer + toread;
                        /* Error with large blocks: Try small ones ... */
-                       if (verbose) {
+                       if (verbose & eno) {
                                /*
                                fprintf(stderr, DDR_INFO "problems at ipos 
%.1fk: %s \n                 fall back to smaller blocksize \n%s%s%s%s",
                                        (double)ipos/1024, strerror(eno), down, 
down, down, down);
@@ -1551,6 +1673,9 @@
 #ifdef HAVE_SPLICE
        fprintf(stderr, "splice ");
 #endif
+#ifdef HAVE_ATTR_XATTR_H
+       fprintf(stderr, "xattr ");
+#endif
        fprintf(stderr, ")\n");
        fprintf(stderr, "dd_rescue is free software. It's protected by the 
terms of GNU GPL v2 or v3\n");
        fprintf(stderr, " (at your option).\n");
@@ -1626,7 +1751,7 @@
        fprintf(stderr, "         -A         Always write blocks, zeroed if err 
(def=no),\n");
        fprintf(stderr, "         -i         interactive: ask before 
overwriting data (def=no),\n");
        fprintf(stderr, "         -f         force: skip some sanity checks 
(def=no),\n");
-       fprintf(stderr, "         -p         preserve: preserve ownership / 
perms (def=no),\n");
+       fprintf(stderr, "         -p         preserve: preserve ownership, 
perms, times, attrs (def=no),\n");
        fprintf(stderr, "         -Y oname   Secondary output file (multiple 
possible),\n");
        fprintf(stderr, "         -q         quiet operation,\n");
        fprintf(stderr, "         -v         verbose operation,\n");
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dd_rescue/find_nonzero.c new/dd_rescue/find_nonzero.c
--- old/dd_rescue/find_nonzero.c        2013-08-07 01:45:47.000000000 +0200
+++ new/dd_rescue/find_nonzero.c        2013-08-11 23:08:02.000000000 +0200
@@ -70,16 +70,25 @@
 /** SSE2 version for measuring the initial zero bytes of 16b aligned blk */
 size_t find_nonzero_sse2(const unsigned char* blk, const size_t ln)
 {
+       /*
+       if (!ln || *blk)
+               return 0;
+        */
        register __m128i xmm0, xmm1;
        register const __m128i zero = _mm_setzero_si128();
        register unsigned int eax, ebx;
        size_t i = 0;
        //asm(".p2align 5");
        for (; i < ln; i+= 32) {
-               //xmm0 = _mm_load_si128((__m128i*)(blk+i));
-               //xmm1 = _mm_load_si128((__m128i*)(blk+i+16));
-               xmm0 = _mm_cmpeq_epi8(*(__m128i*)(blk+i), zero);
-               xmm1 = _mm_cmpeq_epi8(*(__m128i*)(blk+i+16), zero);
+#if 1
+               xmm0 = _mm_load_si128((__m128i*)(blk+i));
+               xmm1 = _mm_load_si128((__m128i*)(blk+i+16));
+               xmm0 = _mm_cmpeq_epi8(xmm0, zero);
+               xmm1 = _mm_cmpeq_epi8(xmm1, zero);
+#else
+               //xmm0 = _mm_cmpeq_epi8(*(__m128i*)(blk+i), zero);
+               //xmm1 = _mm_cmpeq_epi8(*(__m128i*)(blk+i+16), zero);
+#endif
                eax = _mm_movemask_epi8(xmm0);
                ebx = _mm_movemask_epi8(xmm1);
                eax = ~(eax | (ebx << 16));
@@ -108,6 +117,10 @@
  * we don't even need NEON here, ldmia does the 3x speedup on Cortexes */
 size_t find_nonzero_arm6(const unsigned char *blk, const size_t ln)
 {
+       /*
+       if (!ln || *blk)
+               return 0;
+        */
        register unsigned char* res;
        const register unsigned char* end = blk+ln;
        asm volatile(
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dd_rescue/find_nonzero.h new/dd_rescue/find_nonzero.h
--- old/dd_rescue/find_nonzero.h        2013-08-08 11:38:53.000000000 +0200
+++ new/dd_rescue/find_nonzero.h        2013-08-18 21:59:06.000000000 +0200
@@ -166,7 +166,9 @@
   * Generic version, does not require an aligned buffer blk or even ln ... */
 inline static size_t find_nonzero(const unsigned char* blk, const size_t ln)
 {
-       const int off = (-(unsigned char)(unsigned long)blk) & 0x1f;
+       if (!ln || *blk)
+               return 0;
+       const unsigned off = (-(unsigned char)(unsigned long)blk) & 0x1f;
        size_t remain = ln - off;
        size_t i;
        for (i = 0; i < off; ++i)

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to