From a5fa073727a30fcd2fa3f99dbd937d6d810eaa32 Mon Sep 17 00:00:00 2001 From: Tatjana Azundris Nuernberg Date: Wed, 17 Oct 2012 07:22:06 +0100 Subject: Bug#11764559: UMASK IS IGNORED BY ERROR LOG mysqld_safe script did not heed MySQL specific environment variable $UMASK, leading to divergent behavior between mysqld and mysqld_safe. Patch adds an approximation of mysqld's behavior to mysqld_safe, within the bounds dictated by attempt to have mysqld_safe run on even the most basic of shells (proper '70s sh, not just bash with a fancy symlink). Patch also adds approximation of said behavior to mysqld_multi (in perl). --- scripts/mysqld_multi.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'scripts/mysqld_multi.sh') diff --git a/scripts/mysqld_multi.sh b/scripts/mysqld_multi.sh index 8a4d0d44203..5bf59ae27be 100644 --- a/scripts/mysqld_multi.sh +++ b/scripts/mysqld_multi.sh @@ -47,6 +47,28 @@ $homedir = $ENV{HOME}; $my_progname = $0; $my_progname =~ s/.*[\/]//; + +if (defined($ENV{UMASK})) { + my $UMASK = $ENV{UMASK}; + my $m; + my $fmode = "0640"; + + if(($UMASK =~ m/[^0246]/) || ($UMASK =~ m/^[^0]/) || (length($UMASK) != 4)) { + printf("UMASK must be a 3-digit mode with an additional leading 0 to indicate octal.\n"); + printf("The first digit will be corrected to 6, the others may be 0, 2, 4, or 6.\n"); } + else { + $fmode= substr $UMASK, 2, 2; + $fmode= "06${fmode}"; } + + if($fmode != $UMASK) { + printf("UMASK corrected from $UMASK to $fmode ...\n"); } + + $fmode= oct($fmode); + + umask($fmode); +} + + main(); #### -- cgit v1.2.1