[packages/rpm/config-noreplace-newfile] disable overwriting config files when the config is newly added to package

glen glen at pld-linux.org
Sat May 30 09:10:16 CEST 2015


commit ef51dd3f53bcf46ac1171764c3acf94355e7abba
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Fri May 29 22:56:42 2015 +0300

    disable overwriting config files when the config is newly added to package

 config-noreplace-newfile.patch | 40 ++++++++++++++++++++++++++++++++++++++++
 rpm.spec                       |  4 +++-
 2 files changed, 43 insertions(+), 1 deletion(-)
---
diff --git a/rpm.spec b/rpm.spec
index c78f190..26be62c 100644
--- a/rpm.spec
+++ b/rpm.spec
@@ -51,7 +51,7 @@ Summary(ru.UTF-8):	Менеджер пакетов от RPM
 Summary(uk.UTF-8):	Менеджер пакетів від RPM
 Name:		rpm
 Version:	5.4.15
-Release:	21
+Release:	21.1
 License:	LGPL v2.1
 Group:		Base
 # http://rpm5.org/files/rpm/rpm-5.4/rpm-5.4.15-0.20140824.src.rpm
@@ -177,6 +177,7 @@ Patch87:	%{name}-file-output-for-ELF.patch
 Patch88:	%{name}-rpmtdnext.patch
 Patch89:	disable-header-verification.patch
 Patch90:	%{name}-cppcompat.patch
+Patch91:	config-noreplace-newfile.patch
 
 # Patches imported from Mandriva
 
@@ -962,6 +963,7 @@ cd -
 %patch88 -p1
 %patch89 -p1
 %patch90 -p1
+%patch91 -p1
 
 %patch1000 -p1
 %patch1001 -p1
diff --git a/config-noreplace-newfile.patch b/config-noreplace-newfile.patch
new file mode 100644
index 0000000..ea76b53
--- /dev/null
+++ b/config-noreplace-newfile.patch
@@ -0,0 +1,40 @@
+patch from mailinglist
+http://lists.pld-linux.org/mailman/pipermail/pld-devel-en/2015-May/024380.html
+
+So the problem comes down to user expectations of behavior when the new
+package has a file marked %config(noreplace).
+
+The observed behavior is exactly what I personally expect of RPM (and
+is what has been implemented all this century AFAIK).
+
+If you wish to change the behavior to, say, create foo.rpmnew instead of foo
+when the new package file is marked %config(noreplace), then patch
+lib/rpmfi.c to return FA_ALTNAME instead of FA_CREATE when marked
+%config(noreplace) in lib/rpmfi.c rpmfiDecideFate()
+
+The patch will likely be as simple as
+
+-	return FA_CREATE;
++	return save;
+
+I won't make the change in RPM upstream because I believe it's
+more important to have consistent %config handling than it is to
+preserve unpackaged configuration files on upgrade when the
+new (but not the old) package has file content (which almost never happens).
+
+I can be convinced otherwise if there is a demonstrable consensus that a different
+behavior is needed and necessary.
+
+73 de Jeff
+
+--- rpm-5.4.15/lib/rpmfi.c~	2014-05-05 22:36:07.000000000 +0300
++++ rpm-5.4.15/lib/rpmfi.c	2015-05-29 22:46:43.168874713 +0300
+@@ -687,7 +687,7 @@
+ 			fn);
+ 	    return FA_SKIP;
+ 	} else {
+-	    return FA_CREATE;
++	    return save;
+ 	}
+     }
+ 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/rpm.git/commitdiff/ef51dd3f53bcf46ac1171764c3acf94355e7abba



More information about the pld-cvs-commit mailing list