From 94af1c6b538194f1a576d3c38615a713f8121d49 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 9 Sep 2020 14:40:53 +0000 Subject: [PATCH] Bug 24749: Attempt to use tmp_path from koha-conf for TMPDIR for starman The issue described on this bug is triggered when a process ID is reused, but the directory belongs to another koha instance on the same server To mitigate this issue we attemtped to force plack to use an instance specific TMPDIR as CGI::Compile simply uses File::Spec::tmpdir to decide where to compile files If the folder belongs to the instance then we shouldn't have permissions issues Sadly these patches, while brilliant, do not work Attaching in the hopes someone even more brilliant can complete the work --- Koha/Middleware/SetEnv.pm | 3 +++ debian/scripts/koha-plack | 2 ++ 2 files changed, 5 insertions(+) diff --git a/Koha/Middleware/SetEnv.pm b/Koha/Middleware/SetEnv.pm index 6807392c1a..3abe1d779a 100644 --- a/Koha/Middleware/SetEnv.pm +++ b/Koha/Middleware/SetEnv.pm @@ -95,6 +95,9 @@ sub call { } } @setenv_headers; + $setenvs{TMPDIR} = C4::Context->temporary_directory; + # See bug 24749 + # Finally, everything is shoved into the $env. $env = { %$env, diff --git a/debian/scripts/koha-plack b/debian/scripts/koha-plack index 3dcce331a9..72cd21a928 100755 --- a/debian/scripts/koha-plack +++ b/debian/scripts/koha-plack @@ -84,6 +84,8 @@ start_plack() [ -z $PLACK_MAX_REQUESTS ] && PLACK_MAX_REQUESTS="50" PLACK_WORKERS=$(run_safe_xmlstarlet $instancename plack_workers) [ -z $PLACK_WORKERS ] && PLACK_WORKERS="2" + KOHATMPDIR=$(run_safe_xmlstarlet $instancename tmp_path) + [ -z $KOHATMPDIR ] || TMPDIR=$KOHATMPDIR instance_user="${instancename}-koha" -- 2.11.0