Blame INI-Add-INI_MS_DETECT-merge-notifications.patch

5f77bc5
From f4249d9eb263992f2804f8dc65de68e0964f9d1c Mon Sep 17 00:00:00 2001
5f77bc5
From: Alexander Scheel <ascheel@redhat.com>
5f77bc5
Date: Thu, 3 Aug 2017 08:14:02 -0400
5f77bc5
Subject: [PATCH] INI: Add INI_MS_DETECT merge notifications
5f77bc5
MIME-Version: 1.0
5f77bc5
Content-Type: text/plain; charset=UTF-8
5f77bc5
Content-Transfer-Encoding: 8bit
5f77bc5
5f77bc5
In ini_config_augment, INI_MS_DETECT is supposed to detect
5f77bc5
duplicate sections. Previously this was exposed only as
5f77bc5
a return status of EEXIST. This updates the behavior to
5f77bc5
return an error_list with warnings of files containing
5f77bc5
one or more duplicate sections.
5f77bc5
5f77bc5
Signed-off-by: Alexander Scheel <ascheel@redhat.com>
5f77bc5
Reviewed-by: Michal Židek <mzidek@redhat.com>
5f77bc5
5f77bc5
Merges: https://pagure.io/SSSD/ding-libs/issue/3167
5f77bc5
(cherry picked from commit fd539954e68ae49e6670f49e3ff3300cac3e4739)
5f77bc5
---
5f77bc5
 ini/ini_augment.c | 12 +++---------
5f77bc5
 1 file changed, 3 insertions(+), 9 deletions(-)
5f77bc5
5f77bc5
diff --git a/ini/ini_augment.c b/ini/ini_augment.c
5f77bc5
index 8e57c6a..0855381 100644
5f77bc5
--- a/ini/ini_augment.c
5f77bc5
+++ b/ini/ini_augment.c
5f77bc5
@@ -185,7 +185,7 @@ static int ini_aug_regex_prepare(const char *patterns[],
5f77bc5
                 ini_aug_add_string(ra_err,
5f77bc5
                                    "Failed to process expression: %s."
5f77bc5
                                    " Compilation returned error: %s",
5f77bc5
-                                   *pat, err_str);
5f77bc5
+                                   pat, err_str);
5f77bc5
                 free(err_str);
5f77bc5
 
5f77bc5
                 /* All error processing is done - advance to next pattern */
5f77bc5
@@ -814,6 +814,8 @@ static int ini_aug_apply(struct ini_cfgobj *cfg,
5f77bc5
                        ((merge_flags & INI_MV2S_MASK) == INI_MV2S_DETECT)))) {
5f77bc5
                         TRACE_ERROR_NUMBER("Got error in detect mode", error);
5f77bc5
                         /* Fall through! */
5f77bc5
+                    ini_aug_add_string(ra_err, "Duplicate section detected "
5f77bc5
+                                       "in snippet: %s.", snip_name);
5f77bc5
                 }
5f77bc5
                 else {
5f77bc5
                     ini_aug_add_string(ra_err,
5f77bc5
@@ -944,14 +946,6 @@ int ini_config_augment(struct ini_cfgobj *base_cfg,
5f77bc5
                           ra_err,
5f77bc5
                           ra_ok,
5f77bc5
                           result_cfg);
5f77bc5
-    if (error) {
5f77bc5
-        TRACE_ERROR_NUMBER("Failed to process snippet list.",
5f77bc5
-                           error);
5f77bc5
-        ref_array_destroy(ra_list);
5f77bc5
-        ref_array_destroy(ra_err);
5f77bc5
-        ref_array_destroy(ra_ok);
5f77bc5
-        return error;
5f77bc5
-    }
5f77bc5
 
5f77bc5
     /* Cleanup */
5f77bc5
     ref_array_destroy(ra_list);
5f77bc5
-- 
5f77bc5
2.13.2
5f77bc5