The following commit has been merged in the master branch:
commit dcfb989852466575299e6f6ac505cab8c6476699
Author: Guillem Jover <[email protected]>
Date: Thu Jul 8 07:29:16 2010 +0200
dpkg-divert: Disable renaming of the source file does not exist
This makes it consistent with the general dpkg behaviour of honouring
file removals by the administrator.
Closes: #550252
As a side effect, this avoids useless errors when the destination
directory is not existent or writable.
Closes: #581544
diff --git a/debian/changelog b/debian/changelog
index dae1d12..844b2f7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -74,6 +74,10 @@ dpkg (1.15.8) UNRELEASED; urgency=low
* Add new dpkg --force-confask option that forces a conffile prompt when
the conffile from the new package does not differ from the previous one.
Thanks to Henning Makholm <[email protected]>. Closes: #102609
+ * On dpkg-divert --rename, check if the source file exists, and disable
+ renaming if it does not. Closes: #550252
+ As a side effect, this avoids useless errors when the destination
+ directory is not existent or writable. Closes: #581544
[ Updated programs translations ]
* Catalan (Guillem Jover).
diff --git a/src/divertcmd.c b/src/divertcmd.c
index 383ea3e..3991181 100644
--- a/src/divertcmd.c
+++ b/src/divertcmd.c
@@ -162,6 +162,12 @@ check_rename(struct file *src, struct file *dst)
int tmpfd;
file_stat(src);
+
+ /* If the source file is not present and we are not going to do
+ * the rename anyway there's no point in checking any further. */
+ if (src->stat_state == file_stat_nofile)
+ return false;
+
file_stat(dst);
/*
@@ -179,13 +185,6 @@ check_rename(struct file *src, struct file *dst)
if (tmpfd >= 0) {
close(tmpfd);
unlink(tmpname.buf);
- } else if (errno == ENOENT) {
- varbuf_destroy(&tmpname);
-
- /* If the source file is not present and we are not going
- * to do the rename anyway there's no point in checking the
- * target. */
- return false;
} else
ohshite(_("error checking '%s'"), src->name);
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]