fix: n>1 occurrences of %config(noreplace) should not FA_CREATE (#4355).
authorjbj <devnull@localhost>
Mon, 16 Aug 1999 22:10:27 +0000 (22:10 +0000)
committerjbj <devnull@localhost>
Mon, 16 Aug 1999 22:10:27 +0000 (22:10 +0000)
CVS patchset: 3232
CVS date: 1999/08/16 22:10:27

CHANGES
lib/transaction.c
po/rpm.pot

diff --git a/CHANGES b/CHANGES
index a2d288a..4ba629a 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -27,6 +27,7 @@
        - fix: macro table cannot contain NULL pointers (#4263).
        - fix: last char in rpmrc w/o terminating newline lost (#4361).
        - prepare for handling \r in macro exapnsions.
+       - fix: n>1 occurrences of %config(noreplace) should not FA_CREATE (#4355).
 
 3.0.1 -> 3.0.2
        - eliminate armv4 entries from rpmrc (Andrew E. Mileski).
index 8f293cf..661315f 100644 (file)
@@ -476,8 +476,9 @@ static enum fileActions decideFileFate(const char * filespec, short dbMode,
            rpmMessage(RPMMESS_DEBUG, _("%s skipped due to missingok flag\n"),
                        filespec);
            return FA_SKIP;
-       } else
+       } else {
            return FA_CREATE;
+       }
     }
 
     diskWhat = whatis(sb.st_mode);
@@ -486,8 +487,9 @@ static enum fileActions decideFileFate(const char * filespec, short dbMode,
 
     /* RPM >= 2.3.10 shouldn't create config directories -- we'll ignore
        them in older packages as well */
-    if (newWhat == XDIR)
+    if (newWhat == XDIR) {
        return FA_CREATE;
+    }
 
     if (diskWhat != newWhat) {
        return save;
@@ -723,18 +725,20 @@ static void handleOverlappedFiles(struct fileInfo * fi, hashTable ht,
        }
 
        switch (fi->type) {
+       struct stat sb;
        case TR_ADDED:
            if (otherPkgNum < 0) {
-               struct stat sb;
                if (fi->actions[i] != FA_UNKNOWN)
                    break;
-               if ((fi->fflags[i] & RPMFILE_CONFIG) && !lstat(fi->fl[i], &sb))
+               if ((fi->fflags[i] & RPMFILE_CONFIG) && !lstat(fi->fl[i], &sb)) {
                    fi->actions[i] = (fi->fflags[i] & RPMFILE_NOREPLACE)
                        ? FA_ALTNAME : FA_BACKUP;
-               else
+               } else {
                    fi->actions[i] = FA_CREATE;
+               }
                break;
            }
+
            if (probs && filecmp(recs[otherPkgNum]->fmodes[otherFileNum],
                        recs[otherPkgNum]->fmd5s[otherFileNum],
                        recs[otherPkgNum]->flinks[otherFileNum],
@@ -750,7 +754,12 @@ static void handleOverlappedFiles(struct fileInfo * fi, hashTable ht,
            /* FIXME: is this right??? it locks us into the config
               file handling choice we already made, which may very
               well be exactly right. What about noreplace files?? */
-           fi->actions[i] = FA_CREATE;
+           if ((fi->fflags[i] & RPMFILE_CONFIG) && !lstat(fi->fl[i], &sb)) {
+               fi->actions[i] = (fi->fflags[i] & RPMFILE_NOREPLACE)
+                       ? FA_ALTNAME : FA_SKIP;
+           } else {
+               fi->actions[i] = FA_CREATE;
+           }
            break;
        case TR_REMOVED:
            if (otherPkgNum >= 0) {
@@ -759,9 +768,11 @@ static void handleOverlappedFiles(struct fileInfo * fi, hashTable ht,
                break;
 #else
                if (recs[otherPkgNum]->actions[otherFileNum] != FA_REMOVE) {
+                   /* On updates, don't remove files. */
                    fi->actions[i] = FA_SKIP;
                    break;
                }
+               /* Remove file on last occurrence. Other package should skip. */
                recs[otherPkgNum]->actions[otherFileNum] = FA_SKIP;
 #endif
            }
index aee5e25..21ce65c 100644 (file)
@@ -6,7 +6,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 1999-08-16 14:44-0400\n"
+"POT-Creation-Date: 1999-08-16 18:09-0400\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -2284,77 +2284,77 @@ msgid "======================== active %d empty %d\n"
 msgstr ""
 
 #. XXX just in case
-#: ../lib/macro.c:243
+#: ../lib/macro.c:242
 #, c-format
 msgid "%3d>%*s(empty)"
 msgstr ""
 
-#: ../lib/macro.c:278
+#: ../lib/macro.c:277
 #, c-format
 msgid "%3d<%*s(empty)\n"
 msgstr ""
 
-#: ../lib/macro.c:457
+#: ../lib/macro.c:456
 msgid "Macro %%%s has unterminated body"
 msgstr ""
 
-#: ../lib/macro.c:483
+#: ../lib/macro.c:482
 msgid "Macro %%%s has illegal name (%%define)"
 msgstr ""
 
-#: ../lib/macro.c:489
+#: ../lib/macro.c:488
 msgid "Macro %%%s has unterminated opts"
 msgstr ""
 
-#: ../lib/macro.c:494
+#: ../lib/macro.c:493
 msgid "Macro %%%s has empty body"
 msgstr ""
 
-#: ../lib/macro.c:499
+#: ../lib/macro.c:498
 msgid "Macro %%%s failed to expand"
 msgstr ""
 
-#: ../lib/macro.c:524
+#: ../lib/macro.c:523
 msgid "Macro %%%s has illegal name (%%undefine)"
 msgstr ""
 
-#: ../lib/macro.c:601
+#: ../lib/macro.c:600
 msgid "Macro %%%s (%s) was not used below level %d"
 msgstr ""
 
-#: ../lib/macro.c:698
+#: ../lib/macro.c:697
 #, c-format
 msgid "Unknown option %c in %s(%s)"
 msgstr ""
 
-#: ../lib/macro.c:870
+#: ../lib/macro.c:869
 #, c-format
 msgid "Recursion depth(%d) greater than max(%d)"
 msgstr ""
 
-#: ../lib/macro.c:936 ../lib/macro.c:952
+#: ../lib/macro.c:935 ../lib/macro.c:951
 #, c-format
 msgid "Unterminated %c: %s"
 msgstr ""
 
-#: ../lib/macro.c:992
+#: ../lib/macro.c:991
 msgid "A %% is followed by an unparseable macro"
 msgstr ""
 
-#: ../lib/macro.c:1115
+#: ../lib/macro.c:1114
 msgid "Macro %%%.*s not found, skipping"
 msgstr ""
 
-#: ../lib/macro.c:1196
+#: ../lib/macro.c:1195
 msgid "Target buffer overflow"
 msgstr ""
 
-#: ../lib/macro.c:1343 ../lib/macro.c:1351
+#: ../lib/macro.c:1342 ../lib/macro.c:1350
 #, c-format
 msgid "File %s: %s"
 msgstr ""
 
-#: ../lib/macro.c:1354
+#: ../lib/macro.c:1353
 #, c-format
 msgid "File %s is smaller than %d bytes"
 msgstr ""