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

Patrick Steinhardt steinhardt.ptk at gmail.com
Tue Jun 4 08:17:07 EDT 2013


Hi,

On Tue, Jun 04, 2013 at 12:10:17PM +0100, Ross Lagerwall wrote:
> 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.

Probably true, I'll change it later.

> 
> > +					entryname_orig);
> > +			if(try_rename(handle, checkfile, filename)) {
> > +				errors++;
> > +			}
> 
> 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.

[snip]

>  		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);

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.

Regards, Patrick
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://mailman.archlinux.org/pipermail/pacman-dev/attachments/20130604/c45b74a9/attachment.asc>


More information about the pacman-dev mailing list