diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2013-11-05 17:12:22 -0800 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2013-11-05 17:12:22 -0800 |
commit | fd9aa0403b6fa151630efe5088c5beffe00d8ecd (patch) | |
tree | de0280b13b8c31987508e71b520a38e9284855e0 | |
parent | Merge branch 'upstream' (diff) | |
download | gitolite-gentoo-fd9aa0403b6fa151630efe5088c5beffe00d8ecd.tar.gz gitolite-gentoo-fd9aa0403b6fa151630efe5088c5beffe00d8ecd.tar.bz2 gitolite-gentoo-fd9aa0403b6fa151630efe5088c5beffe00d8ecd.zip |
Fix umask stability issues that caused only partially visible repos in gitweb.gitolite-gentoo-2.3.2
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
-rw-r--r-- | src/gitolite.pm | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/gitolite.pm b/src/gitolite.pm index 37f3977..487f265 100644 --- a/src/gitolite.pm +++ b/src/gitolite.pm @@ -286,7 +286,9 @@ sub new_repo { my ($repo, $hooks_dir, $creator, $umask) = @_; - umask($umask ? $umask : get_repo_umask($repo)); + my $oldumask = umask(); + my $newumask = $umask ? $umask : get_repo_umask($repo); + umask($newumask); die "wildrepos disabled, can't set creator $creator on new repo $repo\n" if $creator and not $GL_WILDREPOS; @@ -310,6 +312,7 @@ sub new_repo # set to "gitolite-admin", so we need to make sure that for the duration # of the hook it is set correctly. system("env", "GL_REPO=$repo", "hooks/gl-post-init") if -x "hooks/gl-post-init"; + umask($oldumask); } sub new_wild_repo { @@ -529,7 +532,7 @@ sub setup_daemon_access sub setup_web_access { # input is a hashref; keys are project names if ($WEB_INTERFACE eq 'gitweb') { - + my $oldumask = umask(022); my $projlist = shift; my $projlist_fh = wrap_open( ">", "$PROJECTS_LIST.$$"); for my $proj (sort keys %{ $projlist }) { @@ -537,7 +540,7 @@ sub setup_web_access { } close $projlist_fh; rename "$PROJECTS_LIST.$$", $PROJECTS_LIST; - + umask($oldumask); } else { warn "sorry, unknown web interface $WEB_INTERFACE\n"; } @@ -570,6 +573,9 @@ sub setup_gitweb_access # we may override but we do not remove gitweb.owner and description # for wild repos + my $newumask = get_repo_umask($repo); + my $oldumask = umask(); + if ($desc) { open(DESC, ">", $desc_file); print DESC $desc . "\n"; @@ -590,6 +596,7 @@ sub setup_gitweb_access system("git config --remove-section gitweb 2>/dev/null"); } + umask($oldumask); return (can_read($repo, 'gitweb') or $desc); # this return value is used by the caller to write to projects.list } |