From: Willy Tarreau Date: Fri, 20 Nov 2026 13:15:11 +0000 (+0100) Subject: MINOR: init: automatically turn "set-dumpable" on when using "-d" X-Git-Url: https://git.kaiwu.me/http/%22../static/gitweb.js?a=commitdiff_plain;h=62c0c84b8137c66eef41d355d7a4cb687e52c96c;p=haproxy.git MINOR: init: automatically turn "set-dumpable" on when using "-d" Since we started to automatically chroot for unprivileged users, it has become really annoying for developers to get a core file during their testing. Let's always turn "set-dumpable" on when debug mode is forced on via "-d". --- diff --git a/doc/configuration.txt b/doc/configuration.txt index 0170ff7ac..c5ffbd4d2 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -3520,7 +3520,8 @@ set-dumpable [ on | off | libs ] command line to enable core dumps. This is for example the case with generated configurations and regression testing. In this case, it is possible to preset the set-dumpable argument in the HAPROXY_FORCE_DUMPABLE environment - variable, which accepts the same values. + variable, which accepts the same values. The forced debug mode on the command + line ("-d") also turns set-dumpable on. set-var Sets the process-wide variable '' to the result of the evaluation diff --git a/doc/management.txt b/doc/management.txt index 9450addd8..0b24df2f1 100644 --- a/doc/management.txt +++ b/doc/management.txt @@ -212,8 +212,10 @@ list of options is : condition is false or 2 if an error is encountered. -d : enable debug mode. This disables daemon mode, forces the process to stay - in foreground and to show incoming and outgoing events. It must never be - used in an init script. + in foreground and to show incoming and outgoing events. It also forcefully + enables "set-dumpable" in order to produce core dumps on crashes. This is + essentially meant to be used by developers. It must never be used in an + init script. -dA[file] : dump an archive of all dependencies detected at boot time in the designated file in tar format, immediately after the configuration is done @@ -5424,8 +5426,9 @@ global "set-dumpable" directive helps to re-enable them despite certain uid/gid and chroot changes. When editing the configuration is not an option, such as when dealing with generated configurations or regression tests, it is possible to set the HAPROXY_FORCE_DUMPABLE environment variable to one of the values -accepted by "set-dumpable". Please consult the configuration manual for more -information on this topic. +accepted by "set-dumpable". For developers who rely a lot on "-d", it also +automatically enables "set-dumpable". Please consult the configuration manual +for more information on this topic. 13. Security considerations diff --git a/src/haproxy.c b/src/haproxy.c index ea03e5b84..146ea0160 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -1882,6 +1882,10 @@ static void init_args(int argc, char **argv) } haproxy_init_args(argc, argv); + + /* always enable dumpable mode in debug mode (-d) */ + if (arg_mode & MODE_DEBUG) + global.tune.options |= GTUNE_SET_DUMPABLE; } /* call the various keyword dump functions based on the comma-delimited list of