[MDEV-23881] umask forced to 0640, should perhaps be 0127 Created: 2020-10-03  Updated: 2020-10-03  Resolved: 2020-10-03

Status: Closed
Project: MariaDB Server
Component/s: Scripts & Clients
Affects Version/s: None
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: Daniel Deimert Assignee: Sergei Golubchik
Resolution: Not a Bug Votes: 0
Labels: None
Environment:

linuxserver docker image



 Description   

server/scripts/mysqld_multi.sh, UMASK is forced to 0640 but perhaps it should be forced to 0127, so that the created files have a 0640 access:

 
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);
}



 Comments   
Comment by Sergei Golubchik [ 2020-10-03 ]

Unfortunately, it's correct. See MDEV-23058

Despite the very confusing name, UMASK variable doesn't set the umask in MariaDB it specifies what file permissions to use. This is how it was implemented in MySQL in the 90-ties and such an old historical behavior is almost impossible to change.

Generated at Thu Feb 08 09:25:46 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.