From: Francois Gouget Subject: [Tools 1/2] winetest: Get the work directory directly from the web server. Message-Id: Date: Wed, 7 Jun 2017 11:07:22 +0200 (CEST) Signed-off-by: Francois Gouget --- The goal of this patchset is to remove the need for winetest.conf's $workdir setting. This is one more step towards making it unnecessary to edit winetest.conf (which is checked into Git). NOTE: This patch requires modifying the web server configuration to make sure $::workdir is set. vhost_winetest.conf shows how to do it for Apache. winetest/vhost_winetest.conf | 1 + winetest/winetest.cgi | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/winetest/vhost_winetest.conf b/winetest/vhost_winetest.conf index 797aac3f..6d72ccc3 100644 --- a/winetest/vhost_winetest.conf +++ b/winetest/vhost_winetest.conf @@ -17,6 +17,7 @@ BEGIN { unshift @INC, "/home/wine/tools/winetest"; + $::workdir = "/home/winehq/sites/winetest"; } diff --git a/winetest/winetest.cgi b/winetest/winetest.cgi index 9a4ad717..a2aebef7 100755 --- a/winetest/winetest.cgi +++ b/winetest/winetest.cgi @@ -18,7 +18,7 @@ use strict; use warnings; -use vars qw/$workdir $maxfilesize/; +use vars qw/$maxfilesize/; BEGIN { require "winetest.conf"; @@ -29,7 +29,7 @@ use File::Temp qw(tempdir); use CGI qw(:standard); # Cater for some overhead $CGI::POST_MAX = $maxfilesize + 1024; -$ENV{TMPDIR} = "$workdir/queue"; +$ENV{TMPDIR} = "$::workdir/queue"; my $name = param ("reportfile"); my $error = cgi_error (); @@ -47,7 +47,7 @@ sub move_file($) { my ($filename) = @_; my $orig = tmpFileName($filename); - my $tmpdir = tempdir ("repXXXXX", DIR => "$workdir/queue"); + my $tmpdir = tempdir ("repXXXXX", DIR => "$::workdir/queue"); chmod 0777, $tmpdir; chmod 0666&~umask, $orig; my $size = -s $orig; -- 2.11.0