haproxy/include/haproxy
Willy Tarreau c54e5ad9cc MINOR: cfgparse: sanitize the output a little bit
With the rework of the config line parser, we've started to emit a dump
of the initial line underlined by a caret character indicating the error
location. But with extremely large lines it starts to take time and can
even cause trouble to slow terminals (e.g. over ssh), and this becomes
useless. In addition, control characters could be dumped as-is which is
bad, especially when the input file is accidently wrong (an executable).

This patch adds a string sanitization function which isolates an area
around the error position in order to report only that area if the string
is too large. The limit was set to 80 characters, which will result in
roughly 40 chars around the error being reported only, prefixed and suffixed
with "..." as needed. In addition, non-printable characters in the line are
now replaced with '?' so as not to corrupt the terminal. This way invalid
variable names, unmatched quotes etc will be easier to spot.

A typical output is now:

  [ALERT] 176/092336 (23852) : parsing [bad.cfg:8]: forbidden first char in environment variable name at position 811957:
    ...c$PATH$PATH$d(xlc`%?$PATH$PATH$dgc?T$%$P?AH?$PATH$PATH$d(?$PATH$PATH$dgc?%...
                                            ^
2020-06-25 09:43:27 +02:00
..
acl-t.h REORG: include: make list-t.h part of the base API 2020-06-11 10:18:59 +02:00
acl.h CLEANUP: include: tree-wide alphabetical sort of include files 2020-06-11 10:18:59 +02:00
action-t.h CLEANUP: include: tree-wide alphabetical sort of include files 2020-06-11 10:18:59 +02:00
action.h REORG: include: move action.h to haproxy/action{,-t}.h 2020-06-11 10:18:57 +02:00
activity-t.h MINOR: activity: rename the "stream" field to "stream_calls" 2020-06-17 20:52:29 +02:00
activity.h CLEANUP: include: tree-wide alphabetical sort of include files 2020-06-11 10:18:59 +02:00
api-t.h REORG: include: make list-t.h part of the base API 2020-06-11 10:18:59 +02:00
api.h CLEANUP: include: tree-wide alphabetical sort of include files 2020-06-11 10:18:59 +02:00
applet-t.h CLEANUP: include: tree-wide alphabetical sort of include files 2020-06-11 10:18:59 +02:00
applet.h CLEANUP: include: tree-wide alphabetical sort of include files 2020-06-11 10:18:59 +02:00
arg-t.h REORG: include: make list-t.h part of the base API 2020-06-11 10:18:59 +02:00
arg.h REORG: include: move arg.h to haproxy/arg{,-t}.h 2020-06-11 10:18:57 +02:00
atomic.h BUILD: atomic: add string.h for memcpy() on ARM64 2020-06-14 08:08:13 +02:00
auth-t.h REORG: include: make list-t.h part of the base API 2020-06-11 10:18:59 +02:00
auth.h CLEANUP: include: tree-wide alphabetical sort of include files 2020-06-11 10:18:59 +02:00
backend-t.h CLEANUP: include: tree-wide alphabetical sort of include files 2020-06-11 10:18:59 +02:00
backend.h CLEANUP: include: tree-wide alphabetical sort of include files 2020-06-11 10:18:59 +02:00
base64.h CLEANUP: include: don't include stddef.h directly 2020-06-11 10:18:59 +02:00
buf-t.h CLEANUP: include: don't include stddef.h directly 2020-06-11 10:18:59 +02:00
buf.h REORG: include: split buf.h into haproxy/buf-t.h and haproxy/buf.h 2020-06-11 10:18:56 +02:00
bug.h REORG: include: move the BUG_ON() code to haproxy/bug.h 2020-06-11 10:18:56 +02:00
capture-t.h REORG: include: move capture.h to haproxy/capture{,-t}.h 2020-06-11 10:18:57 +02:00
capture.h REORG: include: move capture.h to haproxy/capture{,-t}.h 2020-06-11 10:18:57 +02:00
cfgparse.h REORG: include: make list-t.h part of the base API 2020-06-11 10:18:59 +02:00
channel-t.h CLEANUP: include: tree-wide alphabetical sort of include files 2020-06-11 10:18:59 +02:00
channel.h CLEANUP: include: tree-wide alphabetical sort of include files 2020-06-11 10:18:59 +02:00
check-t.h REORG: include: make list-t.h part of the base API 2020-06-11 10:18:59 +02:00
check.h REORG: include: make list-t.h part of the base API 2020-06-11 10:18:59 +02:00
chunk.h CLEANUP: include: tree-wide alphabetical sort of include files 2020-06-11 10:18:59 +02:00
cli-t.h REORG: include: make list-t.h part of the base API 2020-06-11 10:18:59 +02:00
cli.h REORG: include: move stream.h to haproxy/stream{,-t}.h 2020-06-11 10:18:58 +02:00
compat.h REORG: include: move connection.h to haproxy/connection{,-t}.h 2020-06-11 10:18:58 +02:00
compiler.h MINOR: compiler: always define __has_feature() 2020-06-16 19:13:24 +02:00
compression-t.h REORG: include: move compression.h to haproxy/compression{,-t}.h 2020-06-11 10:18:57 +02:00
compression.h REORG: include: move compression.h to haproxy/compression{,-t}.h 2020-06-11 10:18:57 +02:00
connection-t.h REORG: include: make list-t.h part of the base API 2020-06-11 10:18:59 +02:00
connection.h REORG: check: move tcpchecks away from check.c 2020-06-11 10:18:58 +02:00
counters-t.h REORG: include: move counters.h to haproxy/counters-t.h 2020-06-11 10:18:57 +02:00
debug.h CLEANUP: debug: drop unused function p_malloc() 2020-06-11 10:18:56 +02:00
defaults.h REORG: include: move MAX_THREADS to defaults.h 2020-06-11 10:18:59 +02:00
dgram-t.h REORG: dgram: rename proto_udp to dgram 2020-06-11 10:18:59 +02:00
dgram.h REORG: dgram: rename proto_udp to dgram 2020-06-11 10:18:59 +02:00
dict-t.h REORG: include: move THREAD_LOCAL and __decl_thread() to compiler.h 2020-06-11 10:18:59 +02:00
dict.h REORG: include: move dict.h to hparoxy/dict{,-t}.h 2020-06-11 10:18:57 +02:00
dns-t.h REORG: dgram: rename proto_udp to dgram 2020-06-11 10:18:59 +02:00
dns.h REORG: include: move dns.h to haproxy/dns{,-t}.h 2020-06-11 10:18:57 +02:00
dynbuf-t.h REORG: include: make list-t.h part of the base API 2020-06-11 10:18:59 +02:00
dynbuf.h REORG: include: make list-t.h part of the base API 2020-06-11 10:18:59 +02:00
errors.h REORG: include: move the error reporting functions to from log.h to errors.h 2020-06-11 10:18:59 +02:00
extcheck.h REORG: check: extract the external checks from check.{c,h} 2020-06-11 10:18:58 +02:00
fcgi-app-t.h REORG: include: make list-t.h part of the base API 2020-06-11 10:18:59 +02:00
fcgi-app.h REORG: include: move stream.h to haproxy/stream{,-t}.h 2020-06-11 10:18:58 +02:00
fcgi.h REORG: include: move common/fcgi.h to haproxy/ 2020-06-11 10:18:57 +02:00
fd-t.h MINOR: debug: add a new DEBUG_FD build option 2020-06-23 10:04:54 +02:00
fd.h MINOR: debug: add a new DEBUG_FD build option 2020-06-23 10:04:54 +02:00
filters-t.h REORG: include: make list-t.h part of the base API 2020-06-11 10:18:59 +02:00
filters.h REORG: include: move stream.h to haproxy/stream{,-t}.h 2020-06-11 10:18:58 +02:00
flt_http_comp.h REORG: include: move proxy.h to haproxy/proxy{,-t}.h 2020-06-11 10:18:58 +02:00
freq_ctr-t.h REORG: include: move freq_ctr to haproxy/ 2020-06-11 10:18:56 +02:00
freq_ctr.h CLEANUP: include: make atomic.h part of the base API 2020-06-11 10:18:59 +02:00
frontend.h REORG: include: move stream.h to haproxy/stream{,-t}.h 2020-06-11 10:18:58 +02:00
global-t.h MEDIUM: tasks: add a tune.sched.low-latency option 2020-06-24 12:21:26 +02:00
global.h MINOR: peers: do not use localpeer as an array anymore 2020-06-19 11:37:11 +02:00
h1.h REORG: include: move common/h1.h to haproxy/h1.h 2020-06-11 10:18:57 +02:00
h1_htx.h REORG: include: move h1_htx.h to haproxy/h1_htx.h 2020-06-11 10:18:57 +02:00
h2.h REORG: include: move common/h2.h to haproxy/h2.h 2020-06-11 10:18:57 +02:00
hash.h REORG: include: move base64.h, errors.h and hash.h from common to to haproxy/ 2020-06-11 10:18:56 +02:00
hlua-t.h REORG: include: make list-t.h part of the base API 2020-06-11 10:18:59 +02:00
hlua.h REORG: include: move hlua.h to haproxy/hlua{,-t}.h 2020-06-11 10:18:57 +02:00
hlua_fcn.h REORG: include: move hlua_fcn.h to haproxy/hlua_fcn.h 2020-06-11 10:18:57 +02:00
hpack-dec.h REORG: include: move hpack*.h to haproxy/ and split hpack-tbl 2020-06-11 10:18:57 +02:00
hpack-enc.h REORG: include: move hpack*.h to haproxy/ and split hpack-tbl 2020-06-11 10:18:57 +02:00
hpack-huff.h REORG: include: move hpack*.h to haproxy/ and split hpack-tbl 2020-06-11 10:18:57 +02:00
hpack-tbl-t.h REORG: include: move hpack*.h to haproxy/ and split hpack-tbl 2020-06-11 10:18:57 +02:00
hpack-tbl.h CLEANUP: hpack: export debug functions and move inlines to .h 2020-06-11 10:18:58 +02:00
http-hdr-t.h REORG: include: split common/http-hdr.h into haproxy/http-hdr{,-t}.h 2020-06-11 10:18:57 +02:00
http-hdr.h REORG: include: split common/http-hdr.h into haproxy/http-hdr{,-t}.h 2020-06-11 10:18:57 +02:00
http-t.h REORG: include: split common/http.h into haproxy/http{,-t}.h 2020-06-11 10:18:57 +02:00
http.h CLEANUP: include: don't include stddef.h directly 2020-06-11 10:18:59 +02:00
http_ana-t.h CLEANUP: include: tree-wide alphabetical sort of include files 2020-06-11 10:18:59 +02:00
http_ana.h REORG: include: move stream.h to haproxy/stream{,-t}.h 2020-06-11 10:18:58 +02:00
http_fetch.h CLEANUP: include: tree-wide alphabetical sort of include files 2020-06-11 10:18:59 +02:00
http_htx-t.h REORG: include: make list-t.h part of the base API 2020-06-11 10:18:59 +02:00
http_htx.h REORG: include: move proxy.h to haproxy/proxy{,-t}.h 2020-06-11 10:18:58 +02:00
http_rules.h CLEANUP: include: tree-wide alphabetical sort of include files 2020-06-11 10:18:59 +02:00
htx-t.h REORG: include: split common/htx.h into haproxy/htx{,-t}.h 2020-06-11 10:18:57 +02:00
htx.h CLEANUP: include: tree-wide alphabetical sort of include files 2020-06-11 10:18:59 +02:00
initcall.h REORG: include: move the base files from common/ to haproxy/ 2020-06-11 10:18:56 +02:00
intops.h REORG: include: move integer manipulation functions from standard.h to intops.h 2020-06-11 10:18:56 +02:00
istbuf.h REORG: include: move istbuf.h to haproxy/ 2020-06-11 10:18:56 +02:00
lb_chash-t.h CLEANUP: include: tree-wide alphabetical sort of include files 2020-06-11 10:18:59 +02:00
lb_chash.h REORG: include: split global.h into haproxy/global{,-t}.h 2020-06-11 10:18:58 +02:00
lb_fas-t.h REORG: include: move lb_fas.h to haproxy/lb_fas{,-t}.h 2020-06-11 10:18:58 +02:00
lb_fas.h REORG: include: move server.h to haproxy/server{,-t}.h 2020-06-11 10:18:58 +02:00
lb_fwlc-t.h REORG: include: move lb_fwlc.h to haproxy/lb_fwlc{,-t}.h 2020-06-11 10:18:58 +02:00
lb_fwlc.h REORG: include: move server.h to haproxy/server{,-t}.h 2020-06-11 10:18:58 +02:00
lb_fwrr-t.h REORG: include: move lb_fwrr.h to haproxy/lb_fwrr{,-t}.h 2020-06-11 10:18:58 +02:00
lb_fwrr.h REORG: include: move server.h to haproxy/server{,-t}.h 2020-06-11 10:18:58 +02:00
lb_map-t.h CLEANUP: include: tree-wide alphabetical sort of include files 2020-06-11 10:18:59 +02:00
lb_map.h REORG: include: move server.h to haproxy/server{,-t}.h 2020-06-11 10:18:58 +02:00
list-t.h REORG: include: split mini-clist into haproxy/list and list-t.h 2020-06-11 10:18:56 +02:00
list.h REORG: include: make list-t.h part of the base API 2020-06-11 10:18:59 +02:00
listener-t.h REORG: include: make list-t.h part of the base API 2020-06-11 10:18:59 +02:00
listener.h REORG: include: move cli.h to haproxy/cli{,-t}.h 2020-06-11 10:18:58 +02:00
log-t.h REORG: include: make list-t.h part of the base API 2020-06-11 10:18:59 +02:00
log.h REORG: include: move THREAD_LOCAL and __decl_thread() to compiler.h 2020-06-11 10:18:59 +02:00
mailers-t.h REORG: include: make list-t.h part of the base API 2020-06-11 10:18:59 +02:00
mailers.h REORG: check: move the e-mail alerting code to mailers.c 2020-06-11 10:18:58 +02:00
map-t.h REORG: include: move sample.h to haproxy/sample{,-t}.h 2020-06-11 10:18:58 +02:00
map.h REORG: include: move sample.h to haproxy/sample{,-t}.h 2020-06-11 10:18:58 +02:00
mworker-t.h REORG: include: move signal.h to haproxy/signal{,-t}.h 2020-06-11 10:18:58 +02:00
mworker.h REORG: include: move signal.h to haproxy/signal{,-t}.h 2020-06-11 10:18:58 +02:00
namespace-t.h CLEANUP: include: don't include stddef.h directly 2020-06-11 10:18:59 +02:00
namespace.h CLEANUP: include: tree-wide alphabetical sort of include files 2020-06-11 10:18:59 +02:00
net_helper.h REORG: include: move common/net_helper.h to haproxy/net_helper.h 2020-06-11 10:18:57 +02:00
obj_type-t.h REORG: include: move obj_type.h to haproxy/obj_type{,-t}.h 2020-06-11 10:18:57 +02:00
obj_type.h CLEANUP: include: tree-wide alphabetical sort of include files 2020-06-11 10:18:59 +02:00
openssl-compat.h REORG: include: move openssl-compat.h from common/ to haproxy/ 2020-06-11 10:18:56 +02:00
pattern-t.h REORG: include: make list-t.h part of the base API 2020-06-11 10:18:59 +02:00
pattern.h MEDIUM: map: make the "clear map" operation yield 2020-06-19 16:57:51 +02:00
payload.h REORG: include: move stream.h to haproxy/stream{,-t}.h 2020-06-11 10:18:58 +02:00
peers-t.h REORG: include: make list-t.h part of the base API 2020-06-11 10:18:59 +02:00
peers.h REORG: include: move stream.h to haproxy/stream{,-t}.h 2020-06-11 10:18:58 +02:00
pipe-t.h REORG: include: move pipe.h to haproxy/pipe{,-t}.h 2020-06-11 10:18:57 +02:00
pipe.h REORG: include: move pipe.h to haproxy/pipe{,-t}.h 2020-06-11 10:18:57 +02:00
pool-os.h REORG: memory: move the OS-level allocator to haproxy/pool-os.h 2020-06-11 10:18:56 +02:00
pool-t.h MEDIUM: memory: make local pools independent on lockless pools 2020-06-11 10:18:57 +02:00
pool.h REORG: include: move common/memory.h to haproxy/pool.h 2020-06-11 10:18:57 +02:00
port_range-t.h REORG: include: move port_range.h to haproxy/port_range{,-t}.h 2020-06-11 10:18:57 +02:00
port_range.h CLEANUP: include: make atomic.h part of the base API 2020-06-11 10:18:59 +02:00
proto_sockpair.h REORG: include: move proto/proto_sockpair.h to haproxy/proto_sockpair.h 2020-06-11 10:18:57 +02:00
proto_tcp.h CLEANUP: include: tree-wide alphabetical sort of include files 2020-06-11 10:18:59 +02:00
protobuf-t.h REORG: include: move protocol_buffers.h to haproxy/protobuf{,-t}.h 2020-06-11 10:18:58 +02:00
protobuf.h REORG: include: move protocol_buffers.h to haproxy/protobuf{,-t}.h 2020-06-11 10:18:58 +02:00
protocol-t.h REORG: include: make list-t.h part of the base API 2020-06-11 10:18:59 +02:00
protocol.h REORG: include: move protocol.h to haproxy/protocol{,-t}.h 2020-06-11 10:18:57 +02:00
proxy-t.h REORG: include: make list-t.h part of the base API 2020-06-11 10:18:59 +02:00
proxy.h CLEANUP: include: tree-wide alphabetical sort of include files 2020-06-11 10:18:59 +02:00
queue-t.h REORG: include: move queue.h to haproxy/queue{,-t}.h 2020-06-11 10:18:58 +02:00
queue.h CLEANUP: include: tree-wide alphabetical sort of include files 2020-06-11 10:18:59 +02:00
regex-t.h REORG: include: move THREAD_LOCAL and __decl_thread() to compiler.h 2020-06-11 10:18:59 +02:00
regex.h REORG: include: move THREAD_LOCAL and __decl_thread() to compiler.h 2020-06-11 10:18:59 +02:00
ring-t.h REORG: include: make list-t.h part of the base API 2020-06-11 10:18:59 +02:00
ring.h REORG: include: move ring to haproxy/ring{,-t}.h 2020-06-11 10:18:57 +02:00
sample-t.h REORG: include: make list-t.h part of the base API 2020-06-11 10:18:59 +02:00
sample.h CLEANUP: include: tree-wide alphabetical sort of include files 2020-06-11 10:18:59 +02:00
sample_data-t.h CLEANUP: include: move sample_data out of sample-t.h 2020-06-11 10:18:59 +02:00
server-t.h REORG: include: make list-t.h part of the base API 2020-06-11 10:18:59 +02:00
server.h CLEANUP: include: tree-wide alphabetical sort of include files 2020-06-11 10:18:59 +02:00
session-t.h REORG: include: make list-t.h part of the base API 2020-06-11 10:18:59 +02:00
session.h REORG: include: move server.h to haproxy/server{,-t}.h 2020-06-11 10:18:58 +02:00
shctx-t.h REORG: include: move shctx to haproxy/shctx{,-t}.h 2020-06-11 10:18:57 +02:00
shctx.h REORG: include: move shctx to haproxy/shctx{,-t}.h 2020-06-11 10:18:57 +02:00
signal-t.h REORG: include: make list-t.h part of the base API 2020-06-11 10:18:59 +02:00
signal.h REORG: include: move signal.h to haproxy/signal{,-t}.h 2020-06-11 10:18:58 +02:00
sink-t.h REORG: include: make list-t.h part of the base API 2020-06-11 10:18:59 +02:00
sink.h REORG: include: make list-t.h part of the base API 2020-06-11 10:18:59 +02:00
spoe-t.h REORG: include: make list-t.h part of the base API 2020-06-11 10:18:59 +02:00
spoe.h REORG: include: move spoe.h to haproxy/spoe{,-t}.h 2020-06-11 10:18:58 +02:00
ssl_ckch-t.h REORG: include: make list-t.h part of the base API 2020-06-11 10:18:59 +02:00
ssl_ckch.h MINOR: ssl: free the crtlist and the ckch during the deinit() 2020-06-23 20:07:50 +02:00
ssl_crtlist-t.h REORG: include: make list-t.h part of the base API 2020-06-11 10:18:59 +02:00
ssl_crtlist.h MINOR: ssl: free the crtlist and the ckch during the deinit() 2020-06-23 20:07:50 +02:00
ssl_sock-t.h BUG/MEDIUM: ssl: fix ssl_bind_conf double free 2020-06-23 20:06:55 +02:00
ssl_sock.h CLEANUP: include: tree-wide alphabetical sort of include files 2020-06-11 10:18:59 +02:00
ssl_utils.h REORG: include: move ssl_utils.h to haproxy/ssl_utils.h 2020-06-11 10:18:57 +02:00
stats-t.h REORG: include: move stats.h to haproxy/stats{,-t}.h 2020-06-11 10:18:58 +02:00
stats.h CLEANUP: include: tree-wide alphabetical sort of include files 2020-06-11 10:18:59 +02:00
stick_table-t.h CLEANUP: include: tree-wide alphabetical sort of include files 2020-06-11 10:18:59 +02:00
stick_table.h CLEANUP: include: tree-wide alphabetical sort of include files 2020-06-11 10:18:59 +02:00
stream-t.h REORG: include: make list-t.h part of the base API 2020-06-11 10:18:59 +02:00
stream.h REORG: include: move stream.h to haproxy/stream{,-t}.h 2020-06-11 10:18:58 +02:00
stream_interface-t.h REORG: include: move stream_interface.h to haproxy/stream_interface{,-t}.h 2020-06-11 10:18:58 +02:00
stream_interface.h CLEANUP: include: tree-wide alphabetical sort of include files 2020-06-11 10:18:59 +02:00
task-t.h MINOR: tasks: add a mask of the queues with active tasklets 2020-06-24 12:21:26 +02:00
task.h MINOR: tasks: make run_tasks_from_lists() scan the queues itself 2020-06-24 12:21:26 +02:00
tcp_rules.h REORG: include: move stream.h to haproxy/stream{,-t}.h 2020-06-11 10:18:58 +02:00
tcpcheck-t.h REORG: include: make list-t.h part of the base API 2020-06-11 10:18:59 +02:00
tcpcheck.h REORG: include: make list-t.h part of the base API 2020-06-11 10:18:59 +02:00
thread-t.h REORG: include: move THREAD_LOCAL and __decl_thread() to compiler.h 2020-06-11 10:18:59 +02:00
thread.h BUILD: thread: add parenthesis around values of locking macros 2020-06-12 11:46:44 +02:00
ticks.h REORG: include: move common/ticks.h to haproxy/ticks.h 2020-06-11 10:18:57 +02:00
time.h REORG: include: move time.h from common/ to haproxy/ 2020-06-11 10:18:56 +02:00
tools-t.h REORG: tools: split common/standard.h into haproxy/tools{,-t}.h 2020-06-11 10:18:57 +02:00
tools.h MINOR: cfgparse: sanitize the output a little bit 2020-06-25 09:43:27 +02:00
trace-t.h REORG: include: make list-t.h part of the base API 2020-06-11 10:18:59 +02:00
trace.h REORG: include: move THREAD_LOCAL and __decl_thread() to compiler.h 2020-06-11 10:18:59 +02:00
uri_auth-t.h REORG: include: make list-t.h part of the base API 2020-06-11 10:18:59 +02:00
uri_auth.h REORG: include: split common/uri_auth.h into haproxy/uri_auth{,-t}.h 2020-06-11 10:18:58 +02:00
vars-t.h REORG: include: make list-t.h part of the base API 2020-06-11 10:18:59 +02:00
vars.h CLEANUP: include: tree-wide alphabetical sort of include files 2020-06-11 10:18:59 +02:00
version.h REORG: include: move version.h to haproxy/ 2020-06-11 10:18:56 +02:00
xref-t.h REORG: include: split common/xref.h into haproxy/xref{,-t}.h 2020-06-11 10:18:57 +02:00
xref.h CLEANUP: include: make atomic.h part of the base API 2020-06-11 10:18:59 +02:00