[pacman-dev] [PATCH] Install unchanged backup files to get correct timestamps.

Ross Lagerwall rosslagerwall at gmail.com
Tue Jun 4 07:10:17 EDT 2013


On Tue, Jun 04, 2013 at 11:20:14AM +0200, Patrick Steinhardt wrote:
>  		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: installing new file: %s\n",

Perhaps this should be changed to something like:
"action: updating existing file's timestamps\n"
to differentiate it from when the file is actually new.

> +					entryname_orig);
> +			if(try_rename(handle, checkfile, filename)) {
> +				errors++;
> +			}

Can we not just ignore it if it fails since it is non-fatal?

>  		} 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
> 

FWIW, I actually tried to send a similar patch through on Sunday
(attached) but it clearly didn't make it to the list (I guess you need
to be subscribed).

-- 
Ross Lagerwall
-------------- next part --------------
>From b8927439aba6f7408f75883dfed9616c70df989a Mon Sep 17 00:00:00 2001
From: Ross Lagerwall <rosslagerwall at gmail.com>
Date: Sun, 2 Jun 2013 13:31:54 +0100
Subject: [PATCH] add.c: update identical config files to preserve mtime

If two config files are identical, overwrite the existing one so that
"pacman -Qkk" does not report "Modification time mismatch" after a
package upgrade even though no files have been touched.
---
 lib/libalpm/add.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index 9cbf767..d7d2382 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -331,11 +331,11 @@ 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 */
+			/* local and new files are the same, overwrite so that timestamps
+			 * are maintained correctly for pacman -Qkk */
 			_alpm_log(handle, ALPM_LOG_DEBUG,
-					"action: leaving existing file in place\n");
-			unlink(checkfile);
+					"action: updating existing file's timestamps\n");
+			try_rename(handle, checkfile, filename);
 		} 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



More information about the pacman-dev mailing list