Hi,

I ran across what seems like a bug in the master socket output. When run in
a non-admin level (i.e., operator or user), it outputs an extra newline
before printing the normal output. This seems to break the following
promise from the management guide
<https://cbonte.github.io/haproxy-dconv/2.0/management.html#9.3>:

Since multiple commands may be issued at once, haproxy uses the empty line
as a
delimiter to mark an end of output for each command, and takes care of
ensuring
that no command can emit an empty line on output. A script can thus easily
parse the output even when multiple commands were pipelined on a single
line.


Here's a brief demonstration:

*# At admin level, the output is normal.*
> sudo haproxy -W -S /run/haproxy/master.sock,mode,666,level,*admin* -f
haproxy.cfg
> socat /run/haproxy/master.sock stdio
show cli level
admin

@1 show info
Name: HAProxy
Version: 2.0.1-1ppa1~bionic
Release_date: 2019/06/27
Nbthread: 8
Nbproc: 1
...

*# At operator or user level, the output is preceded by an extra blank
line.*
> sudo haproxy -W -S /run/haproxy/master.sock,mode,666,level,*operator* -f
haproxy.cfg
> socat /run/haproxy/master.sock stdio
show cli level

operator

@1 show info

Name: HAProxy
Version: 2.0.1-1ppa1~bionic
Release_date: 2019/06/27
Nbthread: 8
Nbproc: 1
...

Note that this behavior is only present on the master socket, not on worker
sockets.

For completeness, this is the haproxy.cfg file I'm using:

global
    log stdout  format raw  daemon  info

    stats socket /run/haproxy/worker.sock mode 666 level operator

    chroot /var/lib/haproxy
    user haproxy
    group haproxy

Is this indeed a bug, or am I missing something? If it is a bug, would it
be appropriate to file an issue on GitHub?

Thanks!
Daniel

Reply via email to