On Tue, Jun 04, 2013 at 01:41:07PM +0100, Ross Lagerwall wrote:
> On Tue, Jun 04, 2013 at 02:17:07PM +0200, Patrick Steinhardt wrote:
> > > Can we not just ignore it if it fails since it is non-fatal?
> > 
> > If we ignore it we should at least add a debug/warning message if
> > it fails, I guess.
> 
> Fair enough.

I've attached an updated version of the patch which emits a warning
when the timestamp could not be updated. The debug message has
been updated to state that the extraction is just a timestamp
update, as well.

> 
> > I don't think the checkfile should be unlinked here, should it?
> > It will certainly fail if you first unlink and afterwards try to
> > rename it.
> > 
> 
> Of course.  I think you're reading the diff wrong.  The unlink is
> *replaced* with a rename in the new code.

Never mind, I was screwed because no syntax highlighting existed.


Regards,
Patrick
From e84827ac3050c807aa2f0336ceda2b2172b89c71 Mon Sep 17 00:00:00 2001
From: Patrick Steinhardt <[email protected]>
Date: Tue, 4 Jun 2013 00:14:41 +0200
Subject: [PATCH] Install unchanged backup files to get correct timestamps.

Fixes FS#35515.
---
 lib/libalpm/add.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index c20e7c6..c9a516a 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -309,11 +309,14 @@ static int extract_single_file(alpm_handle_t *handle, 
struct archive *archive,
                _alpm_log(handle, ALPM_LOG_DEBUG, "original: %s\n", hash_orig);
 
                if(hash_local && hash_pkg && strcmp(hash_local, hash_pkg) == 0) 
{
-                       /* local and new files are the same, no sense in 
installing the file
-                        * over itself, regardless of what the original file 
was */
-                       _alpm_log(handle, ALPM_LOG_DEBUG,
-                                       "action: leaving existing file in 
place\n");
-                       unlink(checkfile);
+                       /* local and new files are the same, updating anyway to 
get
+                        * correct timestamps */
+                       _alpm_log(handle, ALPM_LOG_DEBUG, "action: updating 
timestamp: %s\n",
+                                       entryname_orig);
+                       if(try_rename(handle, checkfile, filename)) {
+                               _alpm_log(handle, ALPM_LOG_WARNING, "could not 
update timestamp: %s\n",
+                                       entryname_orig);
+                       }
                } else if(hash_orig && hash_pkg && strcmp(hash_orig, hash_pkg) 
== 0) {
                        /* original and new files are the same, leave the local 
version alone,
                         * including any user changes */
-- 
1.8.3

Attachment: pgp43s_OgRWcZ.pgp
Description: PGP signature



Reply via email to