The following commit has been merged in the master branch:
commit 5f40ae0644cf266f533d63cdc8643164f4d6b3c3
Author: Guillem Jover <guil...@debian.org>
Date:   Thu Aug 25 20:40:42 2011 +0200

    dpkg: Print a message instead of asserting on readlink/stat size discrepancy
    
    This will help the user diagnose which file was affected and in
    correcting the situation, which in most cases is due to file system
    breakage, or non POSIX compliance.
    
    Closes: #639229

diff --git a/debian/changelog b/debian/changelog
index 977d27d..4967e00 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -202,6 +202,8 @@ dpkg (1.16.1) UNRELEASED; urgency=low
   * Change Dpkg::Compression default values depending on the compressor
     used, and as such dpkg-source inherits this functionality.
     Prompted by Timo Juhani Lindfors <timo.lindf...@iki.fi>.
+  * Print an actual error or warning message instead of assert()ing on
+    readlink()/stat() size discrepancies. Closes: #639229
 
   [ Updated dpkg translations ]
   * German (Sven Joachim). Closes: #620312
diff --git a/src/archives.c b/src/archives.c
index 6e36409..a275b55 100644
--- a/src/archives.c
+++ b/src/archives.c
@@ -830,7 +830,9 @@ tarobject(void *ctx, struct tar_entry *ti)
       r = readlink(fnamevb.buf, symlinkfn.buf, symlinkfn.size);
       if (r < 0)
         ohshite(_("unable to read link `%.255s'"), ti->name);
-      assert(r == stab.st_size);
+      else if (r != stab.st_size)
+        ohshit(_("symbolic link '%.250s' size has changed from %jd to %zd"),
+               fnamevb.buf, stab.st_size, r);
       varbuf_trunc(&symlinkfn, r);
       varbuf_end_str(&symlinkfn);
       if (symlink(symlinkfn.buf,fnametmpvb.buf))
diff --git a/src/configure.c b/src/configure.c
index 4a38db0..c75e8c3 100644
--- a/src/configure.c
+++ b/src/configure.c
@@ -418,8 +418,12 @@ conffderef(struct pkginfo *pkg, struct varbuf *result, 
const char *in)
                                          " (= '%s'): %s"),
                                        pkg->name, in, result->buf, 
strerror(errno));
                                return -1;
+                       } else if (r != stab.st_size) {
+                               warning(_("symbolic link '%.250s' size has "
+                                         "changed from %jd to %zd"),
+                                       result->buf, stab.st_size, r);
+                               return -1;
                        }
-                       assert(r == stab.st_size); /* XXX: debug */
                        varbuf_trunc(&target, r);
                        varbuf_end_str(&target);
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to