On Mon, May 17, 2010 at 6:15 PM, Marc - A. Dahlhaus <m...@wol.de> wrote:
>
> It would be very nice if Xavier or you could take a look at it as i
> don't want to step on anybodies foots along the way if i change this...
>

You really wouldn't. When you spot a regression caused by a commit
that doesn't mention the regression anywhere (commit log or in the
code), it's almost certainly unwanted. So a patch is welcome :)
It's just as Dan said, the only use of Include I ever see if to
include mirror list in Server section, so I overlooked your usage.

Can you please test the attached untested patch ?
From 119ab7a30247ada588c405fa5554b4afa79997ba Mon Sep 17 00:00:00 2001
From: Xavier Chantry <chantry.xav...@gmail.com>
Date: Mon, 17 May 2010 19:10:50 +0200
Subject: [PATCH] Allow Include directive in any sections

Fix a regression of 51f9e5e40a7 that only allowed Include in repo sections.

Thanks to Marc - A. Dahlhaus for reporting the issue.

Signed-off-by: Xavier Chantry <chantry.xav...@gmail.com>
---
 src/pacman/pacman.c |   28 ++++++++++++++++------------
 1 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index 09a8105..6ecda05 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -959,7 +959,21 @@ static int _parseconfig(const char *file, const char *givensection,
 			ret = 1;
 			goto cleanup;
 		}
+		/* Include is allowed in both options and repo sections */
+		if(strcmp(key, "Include") == 0) {
+			if(value == NULL) {
+				pm_printf(PM_LOG_ERROR, _("config file %s, line %d: directive %s needs a value\n"),
+						file, linenum, key);
+				ret = 1;
+				goto cleanup;
+			}
+			pm_printf(PM_LOG_DEBUG, "config: including %s\n", value);
+			/* Ignore include failures... assume non-critical */
+			_parseconfig(value, section, db);
+			continue;
+		}
 		if(strcmp(section, "options") == 0) {
+			/* we are either in options ... */
 			if((ret = _parse_options(key, value)) != 0) {
 				pm_printf(PM_LOG_ERROR, _("config file %s, line %d: problem in options section\n"),
 						file, linenum);
@@ -968,18 +982,8 @@ static int _parseconfig(const char *file, const char *givensection,
 			}
 			continue;
 		} else {
-			/* we are in a repo section */
-			if(strcmp(key, "Include") == 0) {
-				if(value == NULL) {
-					pm_printf(PM_LOG_ERROR, _("config file %s, line %d: directive %s needs a value\n"),
-							file, linenum, key);
-					ret = 1;
-					goto cleanup;
-				}
-				pm_printf(PM_LOG_DEBUG, "config: including %s\n", value);
-				_parseconfig(value, section, db);
-				/* Ignore include failures... assume non-critical */
-			} else if(strcmp(key, "Server") == 0) {
+			/* ... or in a repo section */
+			if(strcmp(key, "Server") == 0) {
 				if(value == NULL) {
 					pm_printf(PM_LOG_ERROR, _("config file %s, line %d: directive %s needs a value\n"),
 							file, linenum, key);
-- 
1.7.1



Reply via email to