On Mon, Jun 22, 2020 at 11:00:09PM +0200, Tim Düsterhus wrote: > I tested this with: > > printf "listen foo\nbind *:8080\x00test\nmode http\x00stuff\nlog > global\x00bad\n" > > And this is the result: > > $ ./haproxy -c -f ./example.cfg > [WARNING] 173/225406 (30776) : parsing [./example.cfg:2]: Stray NUL > character at position 12. This will become a hard error in HAProxy 2.3. > [WARNING] 173/225406 (30776) : parsing [./example.cfg:3]: Stray NUL > character at position 10. This will become a hard error in HAProxy 2.3. > [WARNING] 173/225406 (30776) : parsing [./example.cfg:4]: Missing LF > on last line, file might have been truncated at position 11. This will > become a hard error in HAProxy 2.3. > [WARNING] 173/225406 (30776) : config : missing timeouts for proxy > 'foo'. > | While not properly invalid, you will certainly encounter > various problems > | with such a configuration. To fix this, please ensure that all > following > | timeouts are set to a non-zero value: 'client', 'connect', > 'server'. > Warnings were found. > Configuration file is valid
Looks good to me. > I guess a truncated last line cannot be differentiated from file that > does not > end with a new line, because fgets() consumes the full line (triggering the > eof), even if reading a NUL byte? Definitely! At least we're giving info with the warning and that's what matters to me. Lukas is that also OK for you ? Thanks, Willy