# [PATCH 0/1] Hot fix for js/empty-config-section-fix

3 messages from 2018-05-17 to 2018-05-17. Participants: Johannes Schindelin, Junio C Hamano.
Thread: https://gitlist.dev/t/48512

## Johannes Schindelin, 2018-05-17 21:47

Subject: [PATCH 0/1] Hot fix for js/empty-config-section-fix
Message-ID: <cover.1526593623.git.johannes.schindelin@gmx.de>
URL: https://gitlist.dev/e/cover.1526593623.git.johannes.schindelin%40gmx.de

```
In https://public-inbox.org/git/20180508134248.GA25513@sigill.intra.peff.net/
Jeff King pointed out that an invalid config section is not an indicator
of a bug, as it is usually provided by the user.

So we should not throw a fit and tell the user about a bug that they
might even report.

Instead, let's just error out.


Johannes Schindelin (1):
  config: a user-provided invalid section is not a BUG

 config.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


base-commit: ccdcbd54c4475c2238b310f7113ab3075b5abc9c
Published-As: https://github.com/dscho/git/releases/tag/empty-config-section-fix-v1
Fetch-It-Via: git fetch https://github.com/dscho/git empty-config-section-fix-v1
-- 
2.17.0.windows.1.42.gaba71d8cd65


```

## Johannes Schindelin, 2018-05-17 21:47

Subject: [PATCH 1/1] config: a user-provided invalid section is not a BUG
Message-ID: <7559f3e7e1e5858b0f50afd53da5aafb683b9828.1526593623.git.johannes.schindelin@gmx.de>
URL: https://gitlist.dev/e/7559f3e7e1e5858b0f50afd53da5aafb683b9828.1526593623.git.johannes.schindelin%40gmx.de
In-Reply-To: <cover.1526593623.git.johannes.schindelin@gmx.de>

```
This was pointed out by Jeff King while the empty-config-section-fix
patch series was cooking, and was not addressed in time for that patch
series to advance to `master`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 config.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config.c b/config.c
index 6f8f1d8c113..2392a8076b7 100644
--- a/config.c
+++ b/config.c
@@ -2359,7 +2359,7 @@ static int store_aux_event(enum config_event_t type,
 
 	if (type == CONFIG_EVENT_SECTION) {
 		if (cf->var.len < 2 || cf->var.buf[cf->var.len - 1] != '.')
-			BUG("Invalid section name '%s'", cf->var.buf);
+			return error("invalid section name '%s'", cf->var.buf);
 
 		/* Is this the section we were looking for? */
 		store->is_keys_section =
-- 
2.17.0.windows.1.42.gaba71d8cd65

```

## Junio C Hamano, 2018-05-17 23:00

Subject: Re: [PATCH 0/1] Hot fix for js/empty-config-section-fix
Message-ID: <xmqqy3gh51md.fsf@gitster-ct.c.googlers.com>
URL: https://gitlist.dev/e/xmqqy3gh51md.fsf%40gitster-ct.c.googlers.com
In-Reply-To: <cover.1526593623.git.johannes.schindelin@gmx.de>

```
Johannes Schindelin <johannes.schindelin@gmx.de> writes:

> In https://public-inbox.org/git/20180508134248.GA25513@sigill.intra.peff.net/
> Jeff King pointed out that an invalid config section is not an indicator
> of a bug, as it is usually provided by the user.
>
> So we should not throw a fit and tell the user about a bug that they
> might even report.
>
> Instead, let's just error out.

Yeah, makes sense.  Thanks for a prompt fix-up.


>
>
> Johannes Schindelin (1):
>   config: a user-provided invalid section is not a BUG
>
>  config.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
>
> base-commit: ccdcbd54c4475c2238b310f7113ab3075b5abc9c
> Published-As: https://github.com/dscho/git/releases/tag/empty-config-section-fix-v1
> Fetch-It-Via: git fetch https://github.com/dscho/git empty-config-section-fix-v1

```
