Hello community,

here is the log from the commit of package dd_rescue for openSUSE:Factory 
checked in at 2013-07-08 21:44:00
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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-06-05 
11:48:16.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.dd_rescue.new/dd_rescue.changes 2013-07-08 
21:44:02.000000000 +0200
@@ -1,0 +2,10 @@
+Sun Jul  7 17:09:32 UTC 2013 - asterios.dra...@gmail.com
+
+- Update to version 1.34:
+  * Better support for various *nix systems (specifically has a few fixes for
+    FreeBSD).
+  * Better compatibility with compilers (clang and g++ and clang++).
+  * It can now also load libfallocate at runtime (libdl).
+  * Detects a few more fatal write errors as such.
+
+-------------------------------------------------------------------

Old:
----
  dd_rescue-1.33.tar.gz

New:
----
  dd_rescue-1.34.tar.gz

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

Other differences:
------------------
++++++ dd_rescue.spec ++++++
--- /var/tmp/diff_new_pack.cqOdWH/_old  2013-07-08 21:44:03.000000000 +0200
+++ /var/tmp/diff_new_pack.cqOdWH/_new  2013-07-08 21:44:03.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           dd_rescue
-Version:        1.33
+Version:        1.34
 Release:        0
 Summary:        Data Copying in the Presence of I/O Errors
 License:        GPL-2.0 or GPL-3.0

++++++ dd_rescue-1.33.tar.gz -> dd_rescue-1.34.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-03-30 20:33:15.000000000 +0100
+++ new/dd_rescue/Makefile      2013-06-21 18:50:49.000000000 +0200
@@ -1,8 +1,8 @@
 # Makefile for dd_rescue
 # (c) garl...@suse.de, 99/10/09, GNU GPL
-# $Id: Makefile,v 1.50 2013/03/30 19:33:15 garloff Exp $
+# $Id: Makefile,v 1.53 2013/06/21 16:50:49 garloff Exp $
 
-VERSION = 1.33
+VERSION = 1.34
 
 DESTDIR = 
 
@@ -39,10 +39,13 @@
        $(CC) $(CFLAGS_OPT) -c $<
 
 libfalloc: dd_rescue.c frandom.o
-       $(CC) $(CFLAGS) -DHAVE_FALLOCATE=1 -DHAVE_LIBFALLOCATE=1 $(DEFINES) $^ 
-o dd_rescue -lfallocate
+       $(CC) $(CFLAGS) -DHAVE_LIBFALLOCATE=1 $(DEFINES) $^ -o dd_rescue 
-lfallocate
 
 libfalloc-static: dd_rescue.c frandom.o
-       $(CC) $(CFLAGS) -DHAVE_FALLOCATE=1 -DHAVE_LIBFALLOCATE=1 $(DEFINES) $^ 
-o dd_rescue $(LIBDIR)/libfallocate.a
+       $(CC) $(CFLAGS) -DHAVE_LIBFALLOCATE=1 $(DEFINES) $^ -o dd_rescue 
$(LIBDIR)/libfallocate.a
+
+libfalloc-dl: dd_rescue.c frandom.o
+       $(CC) $(CFLAGS) -DHAVE_LIBDL=1 -DHAVE_LIBFALLOCATE=1 -DHAVE_FALLOCATE=1 
$(DEFINES) $^ -o dd_rescue -ldl
 
 falloc: dd_rescue.c frandom.o
        $(CC) $(CFLAGS) -DHAVE_FALLOCATE=1 $(DEFINES) $^ -o dd_rescue
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-03-30 20:24:34.000000000 +0100
+++ new/dd_rescue/dd_rescue.c   2013-07-04 23:07:22.000000000 +0200
@@ -37,17 +37,16 @@
  * - Optional colors
  * - Use dlopen to open libfallocate rather than linking to it ...
  * - Display more infos on errors by collecting info from syslog
- * - A man page ...
  */
 
 #ifndef VERSION
 # define VERSION "(unknown)"
 #endif
 #ifndef __COMPILER__
-# define "(unknown compiler)"
+# define __COMPILER__ "(unknown compiler)"
 #endif
 
-#define ID "$Id: dd_rescue.c,v 1.173 2013/03/30 19:24:34 garloff Exp $"
+#define ID "$Id: dd_rescue.c,v 1.185 2013/06/28 19:17:58 garloff Exp $"
 
 #ifndef BUF_SOFTBLOCKSIZE
 # define BUF_SOFTBLOCKSIZE 65536
@@ -66,7 +65,9 @@
 #endif
 
 
-#define _GNU_SOURCE
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE
+#endif
 #define _LARGEFILE_SOURCE
 #define _FILE_OFFSET_BITS 64
 
@@ -83,6 +84,7 @@
 #include <limits.h>
 #include <sys/time.h>
 #include <sys/stat.h>
+#include <libgen.h>
 
 #include "frandom.h"
 #include "list.h"
@@ -99,6 +101,11 @@
 #include <fallocate.h>
 #endif
 
+#ifdef HAVE_LIBDL
+#include <dlfcn.h>
+void* libfalloc;
+#endif
+
 /* splice */
 #ifdef __linux__
 # define __KERNEL__
@@ -447,17 +454,30 @@
                        fplog(stderr, "dd_rescue: (warning): %s is a block 
device; -a not recommended; -A recommended\n", oname);
                return;
        }
-       eff_opos = opos == -INT_MAX? ipos: opos;
+       eff_opos = (opos == (off_t)-INT_MAX? ipos: opos);
        if (sparse && (eff_opos < stbuf.st_size))
                fplog(stderr, "dd_rescue: (warning): write into %s (@%li/%li): 
sparse not recommended\n", 
                                oname, eff_opos, stbuf.st_size);
 }
 
-#ifdef HAVE_FALLOCATE
+#if defined(HAVE_FALLOCATE) || defined(HAVE_LIBFALLOCATE)
+
+#ifdef HAVE_LIBDL
+static void* load_libfallocate()
+{
+       libfalloc = dlopen("libfallocate.so.0", RTLD_NOW);
+       if (!libfalloc) 
+               return 0;
+       else
+               return dlsym(libfalloc, "linux_fallocate64");
+}
+#endif
+
 static void do_fallocate(int fd, char* onm)
 {
        struct stat stbuf;
        off_t to_falloc, alloced;
+       int rc = 0;
        if (!estxfer)
                return;
        if (fstat(fd, &stbuf))
@@ -468,19 +488,30 @@
        to_falloc = estxfer - (alloced < 0 ? 0 : alloced);
        if (to_falloc <= 0)
                return;
-#ifdef HAVE_LIBFALLOCATE
-       if (linux_fallocate64(fd, FALLOC_FL_KEEP_SIZE, 
-                             opos, to_falloc))
-#else
-       if (fallocate64(fd, 1, opos, to_falloc))
+#ifdef HAVE_LIBDL
+       int (*_linux_fallocate64)(int fd, int mode, __off64_t start, __off64_t 
len);
+       _linux_fallocate64 = load_libfallocate();
+       if (_linux_fallocate64)
+               rc = _linux_fallocate64(fd, FALLOC_FL_KEEP_SIZE,
+                               opos, to_falloc);
+#ifdef HAVE_FALLOCATE
+       else
+               rc = fallocate64(fd, 1, opos, to_falloc);
+#endif
+#elif defined(HAVE_LIBFALLOCATE)
+       rc = linux_fallocate64(fd, FALLOC_FL_KEEP_SIZE, 
+                             opos, to_falloc);
+#else /* HAVE_FALLOCATE */
+       rc = fallocate64(fd, 1, opos, to_falloc);
 #endif
+       if (rc)
               fplog(stderr, "dd_rescue: (warning): fallocate %s (%Li, %Li) 
failed: %s\n",
                               onm, opos, to_falloc, strerror(errno));
 }
 #endif
 
 
-void doprint(FILE* const file, const int bs, const clock_t cl, 
+void doprint(FILE* const file, const unsigned int bs, const clock_t cl, 
             const float t1, const float t2, const int sync)
 {
        float avgrate = (float)xfer/(t1*1024);
@@ -656,10 +687,14 @@
                if (sparse) {
                        rc = mayexpandfile(nm);
                        if (rc)
-                               fplog(stderr, "dd_rescue: (warning): seek %s 
(%1.fk): %s!\n",
+                               fplog(stderr, "dd_rescue: (warning): seek %s 
(%.1fk): %s!\n",
                                      nm, (float)opos/1024, strerror(errno));
-               } else if (trunclast && !reverse)
-                       truncate(nm, opos);
+               } else if (trunclast && !reverse) {
+                       rc = truncate(nm, opos);
+                       if (rc)
+                               fplog(stderr, "dd_rescue: (warning): could not 
truncate %s to %.1fk: %s!\n",
+                                       nm, (float)opos/1024, strerror(errno));
+               }
 
        }
        return err;
@@ -714,12 +749,16 @@
                LISTDATA(onl) = 0;
        }
        LISTTREEDEL(freenames, charp);
+#if HAVE_LIBDL
+       if (libfalloc)
+               dlclose(libfalloc);
+#endif
        return errs;
 }
 
 ssize_t fill_rand(void *bf, size_t ln)
 {
-       int i;
+       unsigned int i;
        int* buf = (int*)bf;
        for (i = 0; i < ln/sizeof(int); ++i)
                buf[i] = rand();
@@ -740,7 +779,7 @@
        return ln;
 }
 
-inline ssize_t mypread(int fd, void* bf, size_t sz, off_t off)
+static inline ssize_t mypread(int fd, void* bf, size_t sz, off_t off)
 {
        if (i_repeat) {
                if (i_rep_init)
@@ -752,9 +791,9 @@
                return fill_rand(bf, sz);
        if (prng_frnd) {
                if (!bsim715_2ndpass)
-                       return frandom_bytes(prng_state, bf, sz);
+                       return frandom_bytes(prng_state, (unsigned char*) bf, 
sz);
                else
-                       return frandom_bytes_inv(prng_state, bf, sz);
+                       return frandom_bytes_inv(prng_state, (unsigned char*) 
bf, sz);
        }
        if (i_chr) 
                return read(fd, bf, sz);
@@ -762,14 +801,14 @@
                return pread(fd, bf, sz, off);
 }
 
-inline ssize_t mypwrite(int fd, void* bf, size_t sz, off_t off)
+static inline ssize_t mypwrite(int fd, void* bf, size_t sz, off_t off)
 {
        if (o_chr)
                return write(fd, bf, sz);
        else {
                if (avoidwrite) {
                        ssize_t ln = pread(fd, buf2, sz, off);
-                       if (ln < sz)
+                       if (ln < (ssize_t)sz)
                                return pwrite(fd, bf, sz, off);
                        if (memcmp(bf, buf2, ln))
                                return pwrite(fd, bf, sz, off);
@@ -886,7 +925,10 @@
        if (!sparse || blockiszero(buf, rd) < rd)
                errs += ((wr = writeblock(rd)) < rd ? 1: 0);
        advancepos(rd, wr);
-       if (wr <= 0 && (errno == ENOSPC 
+       if (wr <= 0 && (errno == ENOSPC || errno == EROFS
+#ifdef EDQUOT
+                  || errno == EDQUOT
+#endif
                   || (errno == EFBIG && !reverse)))
                ++fatal;
        if (rd != wr && !sparse) {
@@ -1025,8 +1067,12 @@
 #endif
        /* expand file to AT LEAST the right length 
         * FIXME: 0 byte writes do NOT expand file */
-       if (!o_chr && !avoidwrite)
+       if (!o_chr && !avoidwrite) {
                rc = pwrite(odes, buf, 0, opos);
+               if (rc)
+                       fplog(stderr, "dd_rescue: (warning): extending file %s 
to %.1fk failed\n",
+                             oname, (float)opos/1024);
+       }
        while ((toread = blockxfer(max, softbs)) > 0) {
                int err;
                ssize_t rd = readblock(toread);
@@ -1314,9 +1360,12 @@
 #ifdef O_DIRECT
        fprintf(stderr, "O_DIRECT ");
 #endif
-#ifdef HAVE_LIBFALLOCATE
+#ifdef HAVE_LIBDL
+       fprintf(stderr, "dl/libfallocate ");
+#elif defined(HAVE_LIBFALLOCATE)
        fprintf(stderr, "libfallocate ");
-#elif defined(HAVE_FALLOCATE)
+#endif 
+#if defined(HAVE_FALLOCATE)
        fprintf(stderr, "fallocate ");
 #endif
 #ifdef HAVE_SPLICE
@@ -1386,7 +1435,7 @@
 #ifdef HAVE_SPLICE
        fprintf(stderr, "         -k         use efficient in-kernel zerocopy 
splice\n");
 #endif         
-#ifdef HAVE_FALLOCATE
+#if defined(HAVE_FALLOCATE) || defined(HAVE_LIBFALLOCATE)
        fprintf(stderr, "         -P         use fallocate to preallocate 
target space\n");
 #endif
        fprintf(stderr, "         -w         abort on Write errors 
(def=no),\n");
@@ -1451,19 +1500,29 @@
 {
        unsigned char *ptr;
 #ifdef O_DIRECT
-       void *mp;
-       if (posix_memalign(&mp, pagesize, bs)) {
-               fplog(stderr, "dd_rescue: (fatal): allocation of aligned buffer 
failed!\n");
-               cleanup(); exit(18);
-       }
-       ptr = mp;
+       if (o_dir_in || o_dir_out) {
+#if defined (__DragonFly__) || defined(__NetBSD__)
+               ptr = (unsigned char*)valloc(bs);
 #else
-       ptr = malloc(bs);
+               void *mp;
+               if (posix_memalign(&mp, pagesize, bs))
+                       ptr = 0;
+               else
+                       ptr = (unsigned char*)mp;
+#endif /* NetBSD */
+               if (!ptr) {
+                       fplog(stderr, "dd_rescue: (fatal): allocation of 
aligned buffer failed but needed with O_DIRECT!\n");
+                       cleanup(); exit(18);
+               }
+               memset(ptr, 0, bs);
+               return ptr;
+       }
+#endif /* O_DIRECT */
+       ptr = (unsigned char*)malloc(bs);
        if (!ptr) {
                fplog(stderr, "dd_rescue: (fatal): allocation of buffer 
failed!\n");
                cleanup(); exit(18);
        }
-#endif
        memset(ptr, 0, bs);
        return ptr;
 }
@@ -1480,11 +1539,11 @@
        return 1;
 }
 
-char* retstrdupcat3(const char* dir, char dirsep, const char* inm)
+char* retstrdupcat3(const char* dir, char dirsep, char* inm)
 {
-       const char* ibase = basename(inm);
+       char* ibase = basename(inm);
        const int dlen = strlen(dir) + (dirsep>0? 1: dirsep);
-       char* ret = malloc(dlen + strlen(inm) + 1);
+       char* ret = (char*)malloc(dlen + strlen(inm) + 1);
        strcpy(ret, dir);
        if (dirsep > 0) {
                ret[dlen-1] = dirsep;
@@ -1701,6 +1760,8 @@
                if (!i_repeat && verbose)
                        fplog(stderr, "dd_rescue: (info): turning on repeat 
(-R) for /dev/zero\n");
                i_repeat = 1;
+               if (reverse && !ipos && maxxfer)
+                       ipos = maxxfer > opos? opos: maxxfer;
        }
 
        /* Properly append input basename if output name is dir */
@@ -1860,7 +1921,7 @@
        }
 
 
-#ifdef HAVE_FALLOCATE
+#if defined(HAVE_FALLOCATE) || defined(HAVE_LIBFALLOCATE)
        if (falloc && !o_chr)
                do_fallocate(odes, oname);
 #endif
@@ -1879,7 +1940,9 @@
                fplog(stderr, "dd_rescue: (warning): triple overwrite with 
non-seekable output!\n");
        }
        if (reverse && trunclast)
-               ftruncate(odes, opos);
+               if (ftruncate(odes, opos))
+                       fplog(stderr, "dd_rescue: (warning): Could not truncate 
%s to %.1fk: %s!\n",
+                               oname, (float)opos/1024, strerror(errno));
 
        LISTTYPE(ofile_t) *of;
        LISTFOREACH(ofiles, of) {
@@ -1893,12 +1956,14 @@
                check_seekable(oft->fd, &(oft->cdev), NULL);
                if (preserve)
                        copyperm(ides, oft->fd);
-#ifdef HAVE_FALLOCATE
+#if defined(HAVE_FALLOCATE) || defined(HAVE_LIBFALLOCATE)
                if (falloc && !oft->cdev)
                        do_fallocate(oft->fd, oft->name);
 #endif
                if (reverse && trunclast)
-                       ftruncate(oft->fd, opos);
+                       if (ftruncate(oft->fd, opos))
+                               fplog(stderr, "dd_rescue: (warning): Could not 
truncate %s to %.1fk: %s!\n",
+                                       oft->name, (float)opos/1024, 
strerror(errno));
        }
 
        /* Install signal handler */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dd_rescue/frandom.c new/dd_rescue/frandom.c
--- old/dd_rescue/frandom.c     2013-02-10 09:06:41.000000000 +0100
+++ new/dd_rescue/frandom.c     2013-07-04 23:07:22.000000000 +0200
@@ -92,7 +92,7 @@
 {
        struct frandom_state *state;
 
-       state = malloc(sizeof(struct frandom_state));
+       state = (struct frandom_state *)malloc(sizeof(struct frandom_state));
        if (!state)
                return NULL;
 
@@ -105,7 +105,7 @@
 
 void* frandom_stdup(const void* fst)
 {
-       struct frandom_state *newst = malloc(sizeof(struct frandom_state));
+       struct frandom_state *newst = (struct frandom_state 
*)malloc(sizeof(struct frandom_state));
        if (!newst)
                return 0;
        memcpy(newst, fst, sizeof(struct frandom_state));
@@ -121,7 +121,7 @@
 static void get_libc_rand_bytes(u8 *buf, size_t len)
 {
        int *lbuf = (int*)buf;
-       int i;
+       unsigned int i;
        for (i = 0; i < len/sizeof(int); ++i)
                lbuf[i] = rand();
 }
@@ -147,9 +147,9 @@
 
 int frandom_release(void* rstate)
 {
-       struct frandom_state *state = rstate;
+       struct frandom_state *state = (struct frandom_state *)rstate;
        if (!state)
-               state = int_random_state;       
+               state = int_random_state;
        if (!state)
                return -ENOMEM;
 
@@ -161,7 +161,7 @@
 
 ssize_t frandom_bytes(void *rstate, u8 *buf, size_t count)
 {
-       struct frandom_state *state = rstate;
+       struct frandom_state *state = (struct frandom_state *)rstate;
        u8 *S;
 #ifdef INT_IS_FASTER
        unsigned int i, j;
@@ -173,7 +173,7 @@
        if (!state)
                state = int_random_state;
        if (!state)
-               state = frandom_init_lrand(0);
+               state = (struct frandom_state *)frandom_init_lrand(0);
   
        i = state->i;
        j = state->j;
@@ -202,7 +202,7 @@
 
 ssize_t frandom_bytes_inv(void *rstate, u8 *buf, size_t count)
 {
-       struct frandom_state *state = rstate;
+       struct frandom_state *state = (struct frandom_state *)rstate;
        u8 *S;
 #ifdef INT_IS_FASTER
        unsigned int i, j;
@@ -214,7 +214,7 @@
        if (!state)
                state = int_random_state;
        if (!state)
-               state = frandom_init_lrand(0);
+               state = (struct frandom_state *)frandom_init_lrand(0);
   
        i = state->i;
        j = state->j;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dd_rescue/list.h new/dd_rescue/list.h
--- old/dd_rescue/list.h        2013-02-06 11:37:25.000000000 +0100
+++ new/dd_rescue/list.h        2013-06-21 15:09:23.000000000 +0200
@@ -3,7 +3,7 @@
  * (ab)uing macros ...
  */
 
-#ifndef _LIST_H_
+#ifndef _LIST_H
 #define _LIST_H
 
 #include <stdlib.h>
@@ -20,7 +20,7 @@
 #define LISTDATA(x) x->data
 
 #define LISTINSAFTER(l, x, type) do {                  \
-       struct _list_##type *newel = malloc(sizeof(struct _list_##type));       
\
+       struct _list_##type *newel = (struct _list_##type 
*)malloc(sizeof(struct _list_##type));        \
        newel->data = x;                                \
        if (l) {                                        \
                newel->next = l->next;                  \
@@ -32,14 +32,14 @@
        } while(0)
 
 #define LISTINSBEFORE(lh, x, type) do {                        \
-       struct _list_##type *newel = malloc(sizeof(struct _list_##type));       
\
+       struct _list_##type *newel = (struct _list_##type 
*)malloc(sizeof(struct _list_##type));        \
        newel->data = x;                                \
        newel->next = lh;                               \
        lh = newel;                                     \
        } while (0)
 
 #define LISTAPPEND(lh, x, type) do {           \
-       struct _list_##type *newel = malloc(sizeof(struct _list_##type));       
\
+       struct _list_##type *newel = (struct _list_##type 
*)malloc(sizeof(struct _list_##type));        \
        newel->data = x; newel->next = 0;       \
        if (!lh)                                \
                lh = newel;                     \

-- 
To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org
For additional commands, e-mail: opensuse-commit+h...@opensuse.org

Reply via email to