Bug 72188 - RPM 4.0.4 does not handle %config(noreplace) files properly
Summary: RPM 4.0.4 does not handle %config(noreplace) files properly
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: rpm   
(Show other bugs)
Version: 7.3
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Jeff Johnson
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2002-08-21 20:29 UTC by Chris Jaeger
Modified: 2008-05-01 15:38 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2002-08-21 20:29:16 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

Description Chris Jaeger 2002-08-21 20:29:08 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9) Gecko/20020513

Description of problem:
There is a while loop in the rpm source file lib/misc.c domd5()
function that is supposed to calculate the md5sum for a file. 
However, the while loop doesn't actually do anything; that is, it 
reads the file, but does not update the digest. This results in 
config files always appearing to be modified, which causes RPM to 
perform the wrong actions when determining the fate of a config file.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1.Create a spec file that builds an RPM with one %config(noreplace) 
  file. The file's contents should be the version and release of the
2.Build and install this RPM.
3.Change the release in the spec file, and then build and upgrade the
  resulting RPM.

Actual Results:  The new RPM ended up depositing its config file with the .rpmnew 

Expected Results:  Since the config file hadn't actually changed from the first 
installation, it should have been overwritten with the contents of
the config file from the new release.

Additional info:

fdUpdateDigests() should probably be called in the code below.

[admin@apphost-61 rpm-4.0.4]$ grep -A 30 -B 1 domd5

int domd5(const char * fn, /*@out@*/ unsigned char * digest, int asAscii)
        /*@modifies digest, fileSystem @*/
    int rc;
    FD_t fd = Fopen(fn, "r.ufdio");
    unsigned char buf[BUFSIZ];
    unsigned char * md5sum = NULL;
    size_t md5len;

    if (fd == NULL || Ferror(fd)) {
        if (fd)
            (void) Fclose(fd);
        return 1;

    fdInitDigest(fd, PGPHASHALGO_MD5, 0);
    while ((rc = Fread(buf, sizeof(buf[0]), sizeof(buf), fd)) > 0)
    fdFiniDigest(fd, PGPHASHALGO_MD5, (void **)&md5sum, &md5len, asAscii);

    if (Ferror(fd))
        rc = 1;
    (void) Fclose(fd);

    if (!rc)
        memcpy(digest, md5sum, md5len);
    md5sum = _free(md5sum);

    return rc;

Comment 1 Jeff Johnson 2002-08-21 20:47:02 UTC
Yup. The comparison is between a binary and
a hex md5 string, the asAscii arg to domd5 in
the call is what's wrong, the "update digest"
function is buried deep in librpmio underneath
the Fread().

This is fixed in rpm-4.0.4-7x.18 from Red Hat 7.3.

And apologies for not responding sooner on rpm-list.

Comment 2 Chris Jaeger 2002-08-22 00:46:17 UTC
Thanks for the answer. Is there going to be an update 
to the RPM versions for 7.x (x < 3)?

Comment 3 Jeff Johnson 2002-08-22 00:54:16 UTC
rpm-4.1 will probably be the answer, coming soon.

Comment 4 Chris Jaeger 2002-08-28 19:13:58 UTC
Are there any reasons to not use the RH7.3 version of RPM with RH7.1 and 7.2

Note You need to log in before you can comment on or make changes to this bug.