Re: rpm overwriting config files again
On Jun 9, 2015, at 5:50 PM, Elan Ruusamäe wrote: ping jbj? Yes? I don't think your change to %config handling is worth the effort and disruption to the existing %config algorithm. Grep the code for FA_ALTNAME (for .rpmnew) and FA_BACKUP (for .rpmorig/.rpmsave) handling, patch as you wish. The change will likely be 1-3 lines of logic to set FA_BACKUP rather than FA_CREATE under some set of conditions. 73 de Jeff ___ pld-devel-en mailing list pld-devel-en@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-devel-en
Re: rpm overwriting config files again
On 29.05.2015 00:13, Jeffrey Johnson wrote: My guess (similar to your previous claim of overwritten) is that package order ended up as erase-before-install as part of a multiple package upgrade. yes, pld rpm 4.5 got some (your) patch there eventually. Was this behavior seen in a multiple package upgrade that you have snipped out? nop. this was 1 package upgrade: # rpm -q nagios-nrpe nagios-nrpe-2.15-1.i686 # /etc/nagios/nrpe.d/commands.cfg # rpm -qf /etc/nagios/nrpe.d/commands.cfg file /etc/nagios/nrpe.d/commands.cfg is not owned by any package # rpm -Uvv nagios-nrpe-2.15-4.1.i686.rpm D: pool fd: created size 212 limit -1 flags 0 D: pool iob:created size 24 limit -1 flags 0 D: pool mire: created size 88 limit -1 flags 0 D: pool lua:created size 36 limit -1 flags 0 D: pool ts: created size 724 limit -1 flags 0 D: pool gi: created size 96 limit -1 flags 0 D: pool dig:created size 248 limit -1 flags 0 D: pool h: created size 220 limit -1 flags 0 D: Expected size:42149 = lead(96)+sigs(920)+pad(0)+data(41133) D: Actual size:42149 D: pool ds: created size 128 limit -1 flags 0 D: pool tsi:created size 28 limit -1 flags 0 D: pool te: created size 224 limit -1 flags 0 D: pool fi: created size 320 limit -1 flags 0 D: pool al: created size 44 limit -1 flags 0 D: pool bf: created size 28 limit -1 flags 0 D: pool db: created size 188 limit -1 flags 0 D: pool dbi:created size 312 limit -1 flags 0 D: rpmdb: cpus 1 physmem 531Mb D: opening db environment /var/lib/rpm/Packages thread:lock:log:mpool:txn D: opening db index /var/lib/rpm/Packages thread:rdonly:auto_commit mode=0x0 D: opening db index /var/lib/rpm/Name thread:rdonly:auto_commit mode=0x0 D: pool mi: created size 92 limit -1 flags 0 D:upgrade erases nagios-nrpe-2.15-1.i686 D: opening db index /var/lib/rpm/Providename thread:rdonly:auto_commit mode=0x0 D: == +++ nagios-nrpe-2.15-4.1.i686 i686/linux 0x1 D: pool ps: created size 24 limit -1 flags 0 D: opening db index /var/lib/rpm/Filepaths thread:rdonly:auto_commit mode=0x0 D: Requires: /bin/sh YES (db files) D: Requires: /bin/sh YES (db files) D: Requires: /bin/sh YES (db files) D: Requires: /bin/sh YES (db files) D: Requires: /sbin/chkconfig YES (db files) D: Requires: libc.so.6 YES (db provides) D: Requires: libc.so.6(GLIBC_2.0) YES (db provides) D: Requires: libc.so.6(GLIBC_2.1) YES (db provides) D: Requires: libc.so.6(GLIBC_2.15) YES (db provides) D: Requires: libc.so.6(GLIBC_2.3) YES (db provides) D: Requires: libc.so.6(GLIBC_2.3.4)YES (db provides) D: Requires: libc.so.6(GLIBC_2.4) YES (db provides) D: Requires: libcrypto.so.1.0.0YES (db provides) D: Requires: libssl.so.1.0.0 YES (db provides) D: Requires: libwrap.so.0 YES (db provides) D: Requires: nagios-common YES (db provides) D: Requires: rc-scriptsYES (db provides) D: Requires: rtld(GNU_HASH)YES (db provides) D: Dirs: /etc/nagios YES (db files) D: Dirs: /etc/nagios/nrpe.dYES (added files) D: Dirs: /etc/rc.d/init.d YES (db files) D: Dirs: /usr/lib/tmpfiles.d YES (db files) D: Dirs: /usr/sbin YES (db files) D: Dirs: /usr/share/docYES (db files) D: Dirs: /usr/share/doc/nagios-nrpe-2.15 YES (added files) D: Dirs: /var/run YES (db files) D: opening db index /var/lib/rpm/Conflictname thread:rdonly:auto_commit mode=0x0 D: == --- nagios-nrpe-2.15-1.i686 i686/linux 0x1 D: opening db index /var/lib/rpm/Requirename thread:rdonly:auto_commit mode=0x0 D: == recording tsort relations D: Provides: nagios-nrpe = 0:2.15-4.1 YES (added provide) D: ignore package name relation(s) [0] QtGui - Qt3Support D: ignore package name relation(s) [1] QtGui - QtSvg D: ignore package name relation(s) [2] ZendFramework-Zend_Cache - ZendFramework-Zend_Json D: ignore package name relation(s) [3] ZendFramework-Zend_Cache - ZendFramework-Zend_Log D: ignore package name relation(s) [4] ZendFramework-Zend_Controller - ZendFramework-Zend_Dojo D: ignore package name relation(s) [5] ZendFramework-Zend_Controller -
Re: rpm overwriting config files again
On May 29, 2015, at 4:28 AM, Elan Ruusamäe wrote: On 29.05.2015 00:13, Jeffrey Johnson wrote: ... Was this behavior seen in a multiple package upgrade that you have snipped out? nop. this was 1 package upgrade: OK thanks for -vv output. # rpm -q nagios-nrpe nagios-nrpe-2.15-1.i686 # /etc/nagios/nrpe.d/commands.cfg # rpm -qf /etc/nagios/nrpe.d/commands.cfg file /etc/nagios/nrpe.d/commands.cfg is not owned by any package So an empty commands.cfg is generated. # rpm -Uvv nagios-nrpe-2.15-4.1.i686.rpm (aside) Nice! PLD appears to be trying to eliminate LOOPS. D: ignore package name relation(s) [0] QtGui - Qt3Support D: ignore package name relation(s) [1] QtGui - QtSvg ... D: == tsorting packages (order, #predecessors, #succesors, tree, Ldepth, Rbreadth) D: 001100 +nagios-nrpe-2.15-4.1.i686 D: == successors only (41485 bytes) D: 110110 -nagios-nrpe-2.15-1.i686 ... D: fini 100640 1 ( 0, 72)6132 /etc/nagios/nrpe.cfg;55682259 altname warning: /etc/nagios/nrpe.cfg created as /etc/nagios/nrpe.cfg.rpmnew D: fini 040750 2 ( 0, 72) 0 /etc/nagios/nrpe.d D: fini 100640 1 ( 0, 72)1828 /etc/nagios/nrpe.d/commands.cfg;55682259 ... D: fini 100640 1 ( 0, 0)7215 /etc/nagios/nrpe.cfg skip # ls -l /etc/nagios/nrpe.d/commands.cfg -rw-r- 1 root nagios 1828 May 25 16:03 /etc/nagios/nrpe.d/commands.cfg # rpm -q rpm rpm-5.4.15-20.i686 # rpm --version rpm (RPM) 5.4.15 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 ___ pld-devel-en mailing list pld-devel-en@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-devel-en
Re: rpm overwriting config files again
On 29.05.2015 17:43, Jeffrey Johnson wrote: 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. the scenario is quite simple: some software loads config from conf.d dir (using *.conf glob), at some point sysadmins put their configs there. now rpm starts to put their files there too, it happens to be the same filename, now if the file already exists, it will ovewrite sysadmin changes. if it created .rpmnew, then the previous file (created by sysadmin) would be used, and new config (from rpm), would be stored as .rpmnew overall config stays running, nothing is overwritten. -- glen ___ pld-devel-en mailing list pld-devel-en@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-devel-en
Re: rpm overwriting config files again
On May 25, 2015, at 9:01 AM, Elan Ruusamäe wrote: again rpm is ovewriting existing files, not creating them as .rpmnew when the file is new in the package itself. Claiming overwriting is premature (see below). imho this got solved at least in 4.5... Comparisons to rpm-4.x behaviors aren't useful because 1) rpm.org has different (and changed at rpm.org) semantics for %config handling 2) rpm-4.5 went end-of-life back in 2007 and has no upgrade path. And in this case, I believe your claim is incorrect. The code in rpmfiDecideFile() is unchanged (except in some API cosmetic ways afaict) since 09-Jul-2003 when first checked in. Even the API cosmetic changes date back to 2008. So if this worked in rpm-4.5, PLD likely patched a different behavior. Not my problem, mon. My belief is as valid as yours until someone (not me) actually provides evidence to the contrary. scenario: 1. foo.conf is present in filesystem, but not in package v1.0 2. package v1.1 contains foo.conf as %config(noreplace) %verify(not md5 mtime size) 3. upgrade package v1.0 - v1.1 ovewrites foo.conf, not creating foo.conf.rpmnew The confusion here starts with noreplace, which does *NOT* mean Never replace this file. There are several circumstances under which a file marked %config(noreplace) *WILL* be overwritten rather then installed with .rpmnew, including UNMODIFIED: the ondisk digest is identical to the file digest in the installed package. FILETYPE changes: the file in the installed package has a different type than in the new package rpm-5.4.15-6.x86_64 log from such system: # md5sum /etc/nagios/nrpe.d/commands.cfg a57588d1e0fb022e0e0bd5945d4ddeb1 /etc/nagios/nrpe.d/commands.cfg # rpm -qf /etc/nagios/nrpe.d/commands.cfg file /etc/nagios/nrpe.d/commands.cfg is not owned by any package Executing rpm --upgrade -vh --root / --define _check_dirname_deps 1... Preparing... ### [100%] 1:nagios-nrpewarning: /etc/nagios/nrpe.cfg created as /etc/nagios/nrpe.cfg.rpmnew ### [100%] # rpm -qfc /etc/nagios/nrpe.d/commands.cfg /etc/nagios/nrpe.cfg /etc/nagios/nrpe.d/commands.cfg # md5sum /etc/nagios/nrpe.d/commands.cfg 2e4e27f09f7e1efa04c121c6658536a1 /etc/nagios/nrpe.d/commands.cfg # ls -l /etc/nagios/nrpe.d/commands.cfg* -rw-r- 1 root nagios 1.8K May 25 15:43 /etc/nagios/nrpe.d/commands.cfg If you run with -Uvv (instead of -Uvh), you will see what RPM does with EVERY file in the output. My guess (similar to your previous claim of overwritten) is that package order ended up as erase-before-install as part of a multiple package upgrade. Was this behavior seen in a multiple package upgrade that you have snipped out? 73 de Jeff ___ pld-devel-en mailing list pld-devel-en@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-devel-en