aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2017-06-28 22:46:06 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2017-06-28 22:56:17 -0700
commitca7bfc9c485c959fad2aee1f7c1dbc0fb484553b (patch)
tree764772ea30a12e9cda3ee2a8528fcf6462233ace
parentBug 1301887 - File::Slurp triggers warnings on perl 5.24 and it is recommende... (diff)
downloadgentoo-bugzilla-ca7bfc9c485c959fad2aee1f7c1dbc0fb484553b.zip
gentoo-bugzilla-ca7bfc9c485c959fad2aee1f7c1dbc0fb484553b.tar.gz
gentoo-bugzilla-ca7bfc9c485c959fad2aee1f7c1dbc0fb484553b.tar.bz2
Match file_write permissions.
text_write was introduced for bug 1301887 per commit df4677439d7b3658e2d896ffaab903b01c2e2fe6, but had slightly different semantics than the original File::Slurp file_write function. Specifically, file_write applied the umask for new files, while text_write is based on File::Temp and uses 0600 for new files. Add a permission grant so that new files respect the umask instead. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
-rw-r--r--Bugzilla/Util.pm2
1 files changed, 2 insertions, 0 deletions
diff --git a/Bugzilla/Util.pm b/Bugzilla/Util.pm
index 0ab13a0..a1b2513 100644
--- a/Bugzilla/Util.pm
+++ b/Bugzilla/Util.pm
@@ -126,6 +126,8 @@ sub write_text {
binmode $tmp_fh, ':encoding(utf-8)';
print $tmp_fh $content;
close $tmp_fh;
+ # File::Temp tries for secure files, but File::Slurp used the umask.
+ chmod(0666 & ~umask, $tmp_filename);
rename $tmp_filename, $filename;
}