severity 606756 serious
tags 606756 + patch
quit

-- 8< --
Subject: debian/preinst: Do not error out if files are missing

Even if /bin/sh or its manpage is missing, "dpkg -i dash.deb" needs to
succeed.  Currently it errors out because cp exits with nonzero status
when the file to be copied is missing.

This fixes a regression introduced in dash 0.5.5.1-2.2 (2009-07-22).
It unfortunately went unnoticed until Brian tried installing dash on a
thin client with manpages removed.

Reported-by: Brian Potkin <claremont...@gmail.com>
---
Brian Potkin wrote:

> I have Lenny on a thin client with a limited amount of disk space. All
> documentation has been removed. The upgrade to Squeeze stops with
>
>   cp: cannot stat '/usr/share/man/man1/sh.1.gz': No such file or directory
>   dpkg: error processing /var/cache/apt/archives/dash_0.5.5.1-7.3_i386.deb 
> (--unpack):

Thanks for reporting.  This is a bad one.

 debian/changelog    |    8 ++++++++
 debian/dash.preinst |    4 +++-
 2 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 2ba356f..437f0de 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+dash (0.5.5.1-7.4) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * dash.preinst: Do not error out if /bin/sh or its manpage is
+    not already present (thx Brian Potkin; closes: #606756).
+
+ -- Jonathan Nieder <jrnie...@gmail.com>  Sat, 11 Dec 2010 22:15:46 -0600
+
 dash (0.5.5.1-7.3) unstable; urgency=medium
 
   * Non-maintainer upload.
diff --git a/debian/dash.preinst b/debian/dash.preinst
index 324ec85..5529af7 100644
--- a/debian/dash.preinst
+++ b/debian/dash.preinst
@@ -15,7 +15,9 @@ divert() {
                # intermediate temporary file as ln -sf is not atomic.
                # dpkg-divert's --rename direct equivalent would be:
                # mv $dfile $distrib -- but we could end up without a symlink
-               cp -dp $dfile $distrib
+               if [ -e $dfile ]; then
+                       cp -dp $dfile $distrib
+               fi
                ln -sf $ltarget $temp
                mv -f $temp $dfile
                dpkg-divert --package dash --divert $distrib --add $dfile
-- 
1.7.2.4




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

Reply via email to