rpm overwriting config files again

Elan Ruusamäe glen at pld-linux.org
Tue Jun 9 23:50:29 CEST 2015


ping jbj?

On 30.05.2015 10:30, Elan Ruusamäe wrote:
> On 29.05.2015 17:43, Jeffrey Johnson wrote:
>> 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 don't know what i'm doing wrong, but the fate is not decided for 
> commands.cfg file:
>
> 10:26:18 root[load: 0.13]@new-server ~# rpm -Uvv 
> nagios-nrpe-2.15-4.1.i686.rpm  2> inst.log
> Preparing packages for installation...
> Repackaging erased files...
> nagios-nrpe-2.15-1.i686
> Upgrading packages...
> nagios-nrpe-2.15-4.1.i686
>
> 10:29:10 root[load: 0.01]@new-server ~# rpm -qf 
> /etc/nagios/nrpe.d/commands.cfg
> nagios-nrpe-2.15-4.1.i686
>
> 10:26:22 root[load: 0.12]@new-server ~# grep -i fate inst.log
> D: /etc/nagios/nrpe.cfg rpmfiDecideFate
>
>
> besides your patch, 
> https://github.com/pld-linux/rpm/compare/config-noreplace-newfile
>
>
> i added log when the method is invoked:
> --- rpm-5.4.15/lib/rpmfi.c~     2015-05-30 10:15:12.000000000 +0300
> +++ rpm-5.4.15/lib/rpmfi.c      2015-05-30 10:21:23.644364230 +0300
> @@ -677,6 +677,8 @@
>      struct stat sb;
>      int save = (newFlags & RPMFILE_NOREPLACE) ? FA_ALTNAME : FA_SAVE;
>
> +       rpmlog(RPMLOG_DEBUG, D_("%s rpmfiDecideFate\n"), fn);
> +
>      if (Lstat(fn, &sb)) {
>         /*
>          * The file doesn't exist on the disk. Create it unless the new
>
>
>


-- 
glen



More information about the pld-devel-en mailing list