diff options
author | Alejandro Colomar <alx@nginx.com> | 2022-10-17 12:38:40 +0200 |
---|---|---|
committer | Alejandro Colomar <alx@nginx.com> | 2023-07-01 17:52:35 +0200 |
commit | 60866a8006bc19af3b30cd578b4b22669365b86b (patch) | |
tree | d1e9272da82165a38834f8162e46e524d39b09b9 | |
parent | c185ae7512460b850d97f9e849a577550a3a2797 (diff) |
Using $TMPDIR instead of --tmp=xxxtmpdir
$TMPDIR is a standard (POSIX) environment variable to tell a
program to use a different tmp directory. Let's use it, instead
of having a custom way (--tmp).
I don't expect any braking changes, as most users will probably
don't even set it. It will require some changes (removals) in the
packaging though.
Since we were using /var/tmp in the packaging, due to it allowing
larger files, I've kept that preference. /tmp is used in case
/var/tmp is not available.
Cc: Andrew Clayton <a.clayton@nginx.com>
Cc: Konstantin Pavlov <thresh@nginx.com>
Cc: Artem Konev <artem.konev@nginx.com>
Signed-off-by: Alejandro Colomar <alx@nginx.com>
-rw-r--r-- | auto/help | 1 | ||||
-rw-r--r-- | auto/options | 7 | ||||
-rw-r--r-- | auto/save | 1 | ||||
-rw-r--r-- | auto/summary | 1 | ||||
-rwxr-xr-x | configure | 1 | ||||
-rw-r--r-- | pkg/deb/Makefile | 1 | ||||
-rw-r--r-- | pkg/docker/Dockerfile.jsc11 | 1 | ||||
-rw-r--r-- | pkg/docker/Dockerfile.minimal | 1 | ||||
-rw-r--r-- | pkg/docker/Dockerfile.perl5.36 | 1 | ||||
-rw-r--r-- | pkg/docker/template.Dockerfile | 1 | ||||
-rw-r--r-- | pkg/rpm/Makefile | 1 | ||||
-rw-r--r-- | src/nxt_runtime.c | 33 | ||||
-rw-r--r-- | test/conftest.py | 2 |
13 files changed, 4 insertions, 48 deletions
@@ -24,7 +24,6 @@ cat << END --statedir=DIR default: "\$localstatedir/lib/unit" --runstatedir=DIR default: "\$localstatedir/run/unit" --logdir=DIR default: "\$localstatedir/log/unit" - --tmpdir=DIR default: "/tmp" --incdir=DIR [deprecated] synonym for --includedir --modules=DIR [deprecated] synonym for --modulesdir diff --git a/auto/options b/auto/options index 5487be7f..ef2e6049 100644 --- a/auto/options +++ b/auto/options @@ -81,11 +81,6 @@ do ;; --logdir=*) NXT_LOGDIR="$value" ;; --runstatedir=*) NXT_RUNSTATEDIR="$value" ;; - --tmpdir=*) NXT_TMPDIR="$value" ;; - --tmp=*) - >&2 echo "[warn] option --tmp is deprecated; use --tmpdir" - NXT_TMPDIR="$value" - ;; --pid=*) NXT_PID="$value" ;; --log=*) NXT_LOG="$value" ;; @@ -166,5 +161,3 @@ NXT_LOG="${NXT_LOG-"$NXT_LOGDIR/unit.log"}" NXT_RUNSTATEDIR="${NXT_RUNSTATEDIR-"$NXT_LOCALSTATEDIR/run/unit"}" NXT_CONTROL="${NXT_CONTROL-"unix:$NXT_RUNSTATEDIR/control.unit.sock"}" NXT_PID="${NXT_PID-"$NXT_RUNSTATEDIR/unit.pid"}" - -NXT_TMPDIR="${NXT_TMPDIR-"/tmp"}" @@ -29,6 +29,5 @@ NXT_LIB_AUX_LIBS= NXT_LIB_UNIT_STATIC='$NXT_LIB_UNIT_STATIC' NXT_MODULESDIR='$NXT_MODULESDIR' -NXT_TMPDIR='$NXT_TMPDIR' END diff --git a/auto/summary b/auto/summary index fabe3b10..750a950e 100644 --- a/auto/summary +++ b/auto/summary @@ -14,7 +14,6 @@ Unit configuration summary: man pages directory: ....... "$NXT_MANDIR" modules directory: ......... "$NXT_MODULESDIR" state directory: ........... "$NXT_STATEDIR" - tmp directory: ............. "$NXT_TMPDIR" pid file: .................. "$NXT_PID" log file: .................. "$NXT_LOG" @@ -85,7 +85,6 @@ cat << END >> $NXT_AUTO_CONFIG_H #define NXT_LOG "$NXT_LOG" #define NXT_MODULESDIR "$NXT_MODULESDIR" #define NXT_STATEDIR "$NXT_STATEDIR" -#define NXT_TMPDIR "$NXT_TMPDIR" #define NXT_CONTROL_SOCK "$NXT_CONTROL" diff --git a/pkg/deb/Makefile b/pkg/deb/Makefile index 044b7226..52966d99 100644 --- a/pkg/deb/Makefile +++ b/pkg/deb/Makefile @@ -147,7 +147,6 @@ CONFIGURE_ARGS_COMMON=\ --control="unix:/var/run/control.unit.sock" \ --pid=/var/run/unit.pid \ --log=/var/log/unit.log \ - --tmpdir=/var/tmp \ --user=unit \ --group=unit \ --tests \ diff --git a/pkg/docker/Dockerfile.jsc11 b/pkg/docker/Dockerfile.jsc11 index bd987ae5..796ae5ff 100644 --- a/pkg/docker/Dockerfile.jsc11 +++ b/pkg/docker/Dockerfile.jsc11 @@ -24,7 +24,6 @@ RUN set -ex \ --control=unix:/var/run/control.unit.sock \ --pid=/var/run/unit.pid \ --log=/var/log/unit.log \ - --tmpdir=/var/tmp \ --user=unit \ --group=unit \ --openssl \ diff --git a/pkg/docker/Dockerfile.minimal b/pkg/docker/Dockerfile.minimal index 06a85b22..368375d8 100644 --- a/pkg/docker/Dockerfile.minimal +++ b/pkg/docker/Dockerfile.minimal @@ -24,7 +24,6 @@ RUN set -ex \ --control=unix:/var/run/control.unit.sock \ --pid=/var/run/unit.pid \ --log=/var/log/unit.log \ - --tmpdir=/var/tmp \ --user=unit \ --group=unit \ --openssl \ diff --git a/pkg/docker/Dockerfile.perl5.36 b/pkg/docker/Dockerfile.perl5.36 index 2dc31e53..cb0bc426 100644 --- a/pkg/docker/Dockerfile.perl5.36 +++ b/pkg/docker/Dockerfile.perl5.36 @@ -24,7 +24,6 @@ RUN set -ex \ --control=unix:/var/run/control.unit.sock \ --pid=/var/run/unit.pid \ --log=/var/log/unit.log \ - --tmpdir=/var/tmp \ --user=unit \ --group=unit \ --openssl \ diff --git a/pkg/docker/template.Dockerfile b/pkg/docker/template.Dockerfile index c6a72aa8..dc56a827 100644 --- a/pkg/docker/template.Dockerfile +++ b/pkg/docker/template.Dockerfile @@ -24,7 +24,6 @@ RUN set -ex \ --control=unix:/var/run/control.unit.sock \ --pid=/var/run/unit.pid \ --log=/var/log/unit.log \ - --tmpdir=/var/tmp \ --user=unit \ --group=unit \ --openssl \ diff --git a/pkg/rpm/Makefile b/pkg/rpm/Makefile index d3cc34bd..1c4bc32c 100644 --- a/pkg/rpm/Makefile +++ b/pkg/rpm/Makefile @@ -124,7 +124,6 @@ CONFIGURE_ARGS_COMMON=\ --control="unix:/var/run/unit/control.sock" \ --pid=/var/run/unit/unit.pid \ --log=/var/log/unit/unit.log \ - --tmpdir=/var/tmp \ --user=unit \ --group=unit \ --tests \ diff --git a/src/nxt_runtime.c b/src/nxt_runtime.c index 9bfabc75..08d09a52 100644 --- a/src/nxt_runtime.c +++ b/src/nxt_runtime.c @@ -788,7 +788,6 @@ nxt_runtime_conf_init(nxt_task_t *task, nxt_runtime_t *rt) rt->modules = NXT_MODULESDIR; rt->state = NXT_STATEDIR; rt->control = NXT_CONTROL_SOCK; - rt->tmp = NXT_TMPDIR; nxt_memzero(&rt->capabilities, sizeof(nxt_capabilities_t)); @@ -946,9 +945,10 @@ nxt_runtime_conf_init(nxt_task_t *task, nxt_runtime_t *rt) static nxt_int_t nxt_runtime_conf_read_cmd(nxt_task_t *task, nxt_runtime_t *rt) { - char *p, **argv; - u_char *end; - u_char buf[1024]; + char *p, **argv; + u_char *end; + u_char buf[1024]; + struct stat statbuf; static const char version[] = "unit version: " NXT_VERSION "\n" @@ -970,8 +970,6 @@ nxt_runtime_conf_read_cmd(nxt_task_t *task, nxt_runtime_t *rt) "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" @@ -996,12 +994,8 @@ nxt_runtime_conf_read_cmd(nxt_task_t *task, nxt_runtime_t *rt) " --statedir DIR set state directory name\n" " default: \"" NXT_STATEDIR "\"\n" "\n" - " --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" @@ -1124,25 +1118,6 @@ statedir: 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; - } - - p = *argv++; - - rt->tmp = p; - - continue; - } - if (nxt_strcmp(p, "--no-daemon") == 0) { rt->daemon = 0; continue; diff --git a/test/conftest.py b/test/conftest.py index 31709d24..382e9ccd 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -300,8 +300,6 @@ def unit_run(state_dir=None): f'{temp_dir}/unit.log', '--control', f'unix:{temp_dir}/control.unit.sock', - '--tmpdir', - temp_dir, ] if option.user: |