Re: [PATCH] MEDIUM: cfgparse: Emit hard error on truncated lines

2020-08-19 Thread William Lallemand
On Wed, Aug 19, 2020 at 11:45:57AM +0200, Willy Tarreau wrote:
> I retested at home on my other machine and it also fails 100% (so I messed
> up this morning). Maybe a problem with your bash ? (private joke :-)).
> 

Okay I can reproduce, yet another PEBKAC. :-)

-- 
William Lallemand



Re: [PATCH] MEDIUM: cfgparse: Emit hard error on truncated lines

2020-08-19 Thread Willy Tarreau
On Wed, Aug 19, 2020 at 11:38:51AM +0200, William Lallemand wrote:
> On Wed, Aug 19, 2020 at 11:19:02AM +0200, Willy Tarreau wrote:
> > On Wed, Aug 19, 2020 at 10:56:59AM +0200, Tim Düsterhus wrote:
> > > William,
> > > 
> > > Am 19.08.20 um 10:54 schrieb William Lallemand:
> > > > I think it broke
> > > > reg-tests/stick-table/converteers_ref_cnt_never_dec.vtc:
> > > > 
> > > > https://travis-ci.com/github/haproxy/haproxy/jobs/375236964
> > > > 
> > > > But I can't reproduce localy.
> > 
> > Strangely I didn't reproduce it this morning when applying them, so
> > either it depends on the vtest version or I did something wrong in
> > the test. Here I'm seeing fail 100%.
> > 
> 
> That's surprising because vtest is built from the git during the CI
> run. I tried with the latest vtest commit locally and I can't reproduce.
> :/

I retested at home on my other machine and it also fails 100% (so I messed
up this morning). Maybe a problem with your bash ? (private joke :-)).

Willy



Re: [PATCH] MEDIUM: cfgparse: Emit hard error on truncated lines

2020-08-19 Thread William Lallemand
On Wed, Aug 19, 2020 at 11:19:02AM +0200, Willy Tarreau wrote:
> On Wed, Aug 19, 2020 at 10:56:59AM +0200, Tim Düsterhus wrote:
> > William,
> > 
> > Am 19.08.20 um 10:54 schrieb William Lallemand:
> > > I think it broke
> > > reg-tests/stick-table/converteers_ref_cnt_never_dec.vtc:
> > > 
> > > https://travis-ci.com/github/haproxy/haproxy/jobs/375236964
> > > 
> > > But I can't reproduce localy.
> 
> Strangely I didn't reproduce it this morning when applying them, so
> either it depends on the vtest version or I did something wrong in
> the test. Here I'm seeing fail 100%.
> 

That's surprising because vtest is built from the git during the CI
run. I tried with the latest vtest commit locally and I can't reproduce.
:/

-- 
William Lallemand



Re: [PATCH] MEDIUM: cfgparse: Emit hard error on truncated lines

2020-08-19 Thread Willy Tarreau
On Wed, Aug 19, 2020 at 10:56:59AM +0200, Tim Düsterhus wrote:
> William,
> 
> Am 19.08.20 um 10:54 schrieb William Lallemand:
> > I think it broke
> > reg-tests/stick-table/converteers_ref_cnt_never_dec.vtc:
> > 
> > https://travis-ci.com/github/haproxy/haproxy/jobs/375236964
> > 
> > But I can't reproduce localy.

Strangely I didn't reproduce it this morning when applying them, so
either it depends on the vtest version or I did something wrong in
the test. Here I'm seeing fail 100%.

> Looking at the test I would suspect that removing the indentation in
> front of the brace in line 62 fixes the issue. But I did not test this
> either:
> 
> https://github.com/haproxy/haproxy/blob/ff4d86becd658f61e45692815f3b9e7a1e66107f/reg-tests/stick-table/converteers_ref_cnt_never_dec.vtc#L62

Confirmed, the spaces are sent to the output config file and cause the
error. I'm going to fix that and push the fix.

Willy

> 
> Best regards
> Tim Düsterhus



Re: [PATCH] MEDIUM: cfgparse: Emit hard error on truncated lines

2020-08-19 Thread Tim Düsterhus
William,

Am 19.08.20 um 10:54 schrieb William Lallemand:
> I think it broke
> reg-tests/stick-table/converteers_ref_cnt_never_dec.vtc:
> 
> https://travis-ci.com/github/haproxy/haproxy/jobs/375236964
> 
> But I can't reproduce localy.

Looking at the test I would suspect that removing the indentation in
front of the brace in line 62 fixes the issue. But I did not test this
either:

https://github.com/haproxy/haproxy/blob/ff4d86becd658f61e45692815f3b9e7a1e66107f/reg-tests/stick-table/converteers_ref_cnt_never_dec.vtc#L62

Best regards
Tim Düsterhus



Re: [PATCH] MEDIUM: cfgparse: Emit hard error on truncated lines

2020-08-19 Thread William Lallemand
On Tue, Aug 18, 2020 at 10:00:04PM +0200, Tim Duesterhus wrote:
> As announced within the emitted log message this is going to become a hard
> error in 2.3. It's 2.3 time now, let's do this.
> 
> see 2fd5bdb439da29f15381aeb57c51327ba57674fc
> ---
>  src/cfgparse.c | 15 +++
>  1 file changed, 7 insertions(+), 8 deletions(-)
> 
> diff --git a/src/cfgparse.c b/src/cfgparse.c
> index de82a9fd3..17db1fcae 100644
> --- a/src/cfgparse.c
> +++ b/src/cfgparse.c
> @@ -1876,11 +1876,11 @@ next_line:
>   char *line = thisline;
>  
>   if (missing_lf != -1) {
> - ha_warning("parsing [%s:%d]: Stray NUL character at 
> position %d. "
> -"This will become a hard error in HAProxy 
> 2.3.\n",
> -file, linenum, (missing_lf + 1));
> - err_code |= ERR_WARN;
> + ha_alert("parsing [%s:%d]: Stray NUL character at 
> position %d.\n",
> +  file, linenum, (missing_lf + 1));
> + err_code |= ERR_ALERT | ERR_FATAL;
>   missing_lf = -1;
> + break;
>   }
>  
>   linenum++;
> @@ -2086,10 +2086,9 @@ next_line:
>   }
>  
>   if (missing_lf != -1) {
> - ha_warning("parsing [%s:%d]: Missing LF on last line, file 
> might have been truncated at position %d. "
> -"This will become a hard error in HAProxy 2.3.\n",
> -file, linenum, (missing_lf + 1));
> - err_code |= ERR_WARN;
> + ha_alert("parsing [%s:%d]: Missing LF on last line, file might 
> have been truncated at position %d.\n",
> +  file, linenum, (missing_lf + 1));
> + err_code |= ERR_ALERT | ERR_FATAL;
>   }
>  
>   if (cs && cs->post_section_parser)
> 


I think it broke
reg-tests/stick-table/converteers_ref_cnt_never_dec.vtc:

https://travis-ci.com/github/haproxy/haproxy/jobs/375236964

But I can't reproduce localy.


-- 
William Lallemand



[PATCH] MEDIUM: cfgparse: Emit hard error on truncated lines

2020-08-18 Thread Tim Duesterhus
As announced within the emitted log message this is going to become a hard
error in 2.3. It's 2.3 time now, let's do this.

see 2fd5bdb439da29f15381aeb57c51327ba57674fc
---
 src/cfgparse.c | 15 +++
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/cfgparse.c b/src/cfgparse.c
index de82a9fd3..17db1fcae 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -1876,11 +1876,11 @@ next_line:
char *line = thisline;
 
if (missing_lf != -1) {
-   ha_warning("parsing [%s:%d]: Stray NUL character at 
position %d. "
-  "This will become a hard error in HAProxy 
2.3.\n",
-  file, linenum, (missing_lf + 1));
-   err_code |= ERR_WARN;
+   ha_alert("parsing [%s:%d]: Stray NUL character at 
position %d.\n",
+file, linenum, (missing_lf + 1));
+   err_code |= ERR_ALERT | ERR_FATAL;
missing_lf = -1;
+   break;
}
 
linenum++;
@@ -2086,10 +2086,9 @@ next_line:
}
 
if (missing_lf != -1) {
-   ha_warning("parsing [%s:%d]: Missing LF on last line, file 
might have been truncated at position %d. "
-  "This will become a hard error in HAProxy 2.3.\n",
-  file, linenum, (missing_lf + 1));
-   err_code |= ERR_WARN;
+   ha_alert("parsing [%s:%d]: Missing LF on last line, file might 
have been truncated at position %d.\n",
+file, linenum, (missing_lf + 1));
+   err_code |= ERR_ALERT | ERR_FATAL;
}
 
if (cs && cs->post_section_parser)
-- 
2.28.0