summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2018-03-16 17:53:01 +0100
committerDylan William Hardison <dylan@hardison.net>2018-03-18 04:50:10 +0100
commit34249adbad14608948a0bf1f881e7d718d9d4da1 (patch)
tree7da012c60016b9603b42dc43665741833feaaf2a
parent5f4ef66e740f2677df00894510c1a675060f13fa (diff)
downloadbugzilla-34249adbad14608948a0bf1f881e7d718d9d4da1.tar.gz
bugzilla-34249adbad14608948a0bf1f881e7d718d9d4da1.tar.xz
Bug 1446156 - mkdir template_cache: Permission denied
-rw-r--r--Bugzilla/Template.pm2
-rwxr-xr-xchecksetup.pl11
2 files changed, 13 insertions, 0 deletions
diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm
index 7a97f6da2..ae4f9bbad 100644
--- a/Bugzilla/Template.pm
+++ b/Bugzilla/Template.pm
@@ -1074,6 +1074,8 @@ our %_templates_to_precompile;
sub precompile_templates {
my ($output) = @_;
+ return unless is_webserver_group();
+
# Remove the compiled templates.
my $cache_dir = bz_locations()->{'template_cache'};
my $datadir = bz_locations()->{'datadir'};
diff --git a/checksetup.pl b/checksetup.pl
index 6cea8549d..d3f08e024 100755
--- a/checksetup.pl
+++ b/checksetup.pl
@@ -30,6 +30,7 @@ use Pod::Usage;
# Bug 1270550 - Tie::Hash::NamedCapture must be loaded before Safe.
use Tie::Hash::NamedCapture;
use Safe;
+use English qw(-no_match_vars $EUID $EGID);
use Bugzilla::Constants;
use Bugzilla::Install::Requirements;
@@ -155,6 +156,16 @@ unless ($ENV{LOCALCONFIG_ENV}) {
}
my $lc_hash = Bugzilla->localconfig;
+if ( $EUID == 0 && $lc_hash->{webservergroup} && !ON_WINDOWS ) {
+ # So checksetup was run as root, and we have a webserver group set.
+ # Let's assume the user wants us to make files that are writable
+ # by the webserver group.
+
+ $EGID = getgrnam $lc_hash->{webservergroup}; ## no critic (Variables::RequireLocalizedPunctuationVars)
+ umask 002
+ or die "failed to set umask 002: $!";
+}
+
unless ($switch{'no-database'}) {
die "urlbase is not set\n" unless $lc_hash->{urlbase};
die "urlbase must end with slash\n" unless $lc_hash->{urlbase} =~ m{/$}ms;