summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorAlejandro Colomar <alx@nginx.com>2023-05-17 10:00:47 +0200
committerAlejandro Colomar <alx@nginx.com>2023-05-21 01:01:43 +0200
commitf32858dcb76a35513c035729d1c44ce01520e84c (patch)
tree5e60fa088cba82d633f9663696dcd5d873be97e8 /src
parent5f8d58d2a4f226db92619c447289ddbace19961f (diff)
downloadunit-f32858dcb76a35513c035729d1c44ce01520e84c.tar.gz
unit-f32858dcb76a35513c035729d1c44ce01520e84c.tar.bz2
Added back deprecated options to unitd.
We renamed the options recently, with the intention of keeping the old names as supported but deprecated for some time, before removal. This was done with the configure script options, but in the unitd binary, we accidentally removed the old names, causing some unintended breakage. Keep support for the old names, albeit with a deprecation message to stderr, for some time, until we decide to remove them. Fixes: 5a37171f733f ("Added default values for pathnames.") Closes: <https://github.com/nginx/unit/issues/876> Reported-by: El RIDO <elrido@gmx.net> Acked-by: Liam Crilly <liam@nginx.com> Acked-by: Artem Konev <a.konev@f5.com> Acked-by: Timo Stark <t.stark@nginx.com> Reviewed-by: Andrew Clayton <a.clayton@nginx.com> Cc: Andrei Zeliankou <zelenkov@nginx.com> Signed-off-by: Alejandro Colomar <alx@nginx.com>
Diffstat (limited to 'src')
-rw-r--r--src/nxt_runtime.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/nxt_runtime.c b/src/nxt_runtime.c
index 96f801fb..9bfabc75 100644
--- a/src/nxt_runtime.c
+++ b/src/nxt_runtime.c
@@ -966,6 +966,13 @@ nxt_runtime_conf_read_cmd(nxt_task_t *task, nxt_runtime_t *rt)
"option \"--statedir\" requires directory\n";
static const char no_tmp[] = "option \"--tmpdir\" requires directory\n";
+ static const char modules_deprecated[] =
+ "option \"--modules\" is deprecated; use \"--modulesdir\" instead\n";
+ static const char state_deprecated[] =
+ "option \"--state\" is deprecated; use \"--statedir\" instead\n";
+ static const char tmp_deprecated[] =
+ "option \"--tmp\" is deprecated; use \"--tmpdir\" instead\n";
+
static const char help[] =
"\n"
"unit options:\n"
@@ -992,6 +999,10 @@ nxt_runtime_conf_read_cmd(nxt_task_t *task, nxt_runtime_t *rt)
" --tmpdir DIR set tmp directory name\n"
" default: \"" NXT_TMPDIR "\"\n"
"\n"
+ " --modules DIR [deprecated] synonym for --modulesdir\n"
+ " --state DIR [deprecated] synonym for --statedir\n"
+ " --tmp DIR [deprecated] synonym for --tmpdir\n"
+ "\n"
" --user USER set non-privileged processes to run"
" as specified user\n"
" default: \"" NXT_USER "\"\n"
@@ -1073,7 +1084,14 @@ nxt_runtime_conf_read_cmd(nxt_task_t *task, nxt_runtime_t *rt)
continue;
}
+ if (nxt_strcmp(p, "--modules") == 0) {
+ write(STDERR_FILENO, modules_deprecated,
+ nxt_length(modules_deprecated));
+ goto modulesdir;
+ }
+
if (nxt_strcmp(p, "--modulesdir") == 0) {
+modulesdir:
if (*argv == NULL) {
write(STDERR_FILENO, no_modules, nxt_length(no_modules));
return NXT_ERROR;
@@ -1086,7 +1104,14 @@ nxt_runtime_conf_read_cmd(nxt_task_t *task, nxt_runtime_t *rt)
continue;
}
+ if (nxt_strcmp(p, "--state") == 0) {
+ write(STDERR_FILENO, state_deprecated,
+ nxt_length(state_deprecated));
+ goto statedir;
+ }
+
if (nxt_strcmp(p, "--statedir") == 0) {
+statedir:
if (*argv == NULL) {
write(STDERR_FILENO, no_state, nxt_length(no_state));
return NXT_ERROR;
@@ -1099,7 +1124,13 @@ nxt_runtime_conf_read_cmd(nxt_task_t *task, nxt_runtime_t *rt)
continue;
}
+ if (nxt_strcmp(p, "--tmp") == 0) {
+ write(STDERR_FILENO, tmp_deprecated, nxt_length(tmp_deprecated));
+ goto tmpdir;
+ }
+
if (nxt_strcmp(p, "--tmpdir") == 0) {
+tmpdir:
if (*argv == NULL) {
write(STDERR_FILENO, no_tmp, nxt_length(no_tmp));
return NXT_ERROR;