[MDEV-24213] mariadb-upgrade ignores setgid bit on datadir Created: 2020-11-15  Updated: 2020-11-19  Resolved: 2020-11-19

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

Type: Bug Priority: Major
Reporter: Karl Levik Assignee: Unassigned
Resolution: Not a Bug Votes: 0
Labels: None
Environment:

Fedora release 31



 Description   

When the setgid bit is set on a directory, all the files created inside it should get the group of that directory.

The MariaDB server itself appears to observe this rule.

However, the mariadb-upgrade utility does not. With datadir=/var/lib/mariadb:

chgrp root /var/lib/mariadb
chmod u=rwx,g=rwxs,o= /var/lib/mariadb
chmod -R g=rwX /var/lib/mariadb/*
 
# Observe that group of an example file in datadir's mysql folder is 'root':
ls -l /var/lib/mariadb/mysql/time_zone.frm
 
# Run mariadb-upgrade:
mariadb-upgrade --force -u root -p
 
# Observe that the group of the example file in datadir's mysql folder has changed to 'mysql':
ls -l /var/lib/mariadb/mysql/time_zone.frm

I think the mariadb-upgrade tool should follow the normal convention regarding the setgid bit on directories.

Note that if the setgid bit is set on the actual datadir's mysql folder, then mariadb-upgrade seems to behave as expected.



 Comments   
Comment by Karl Levik [ 2020-11-16 ]

Apologies, I think I was wrong to imply that the convention is that all files created inside such a directory should get the group of the parent directory. I think this only works on the first level, i.e. not in sub-directories.

Therefore this can probably be closed as "not a bug".

Comment by Sergei Golubchik [ 2020-11-19 ]

closed as requested

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