[bugfix] Fix packaging of the default MySQL server log
We've received a bug report, that the 'rpm -qc' incorrectly returns the MySQL
server default log file '/var/log/mysql/mysqld.log' as a configuration file.
https://issues.redhat.com/browse/RHEL-57601
This was caused by us packing it in the SPECfile '%files' section with the
'%config %ghost' directives. The reason was historical. We tried to mark
the file as owned by the package, but at the same time to not pack it,
and also prevent its deleteion on package removal.
The correct way is to not list the file at all.
The parent directory is properly packed and owned instead (already), so it should be
clear that the files inside are associated with that package. This is how we already
do it with the DB datadir '/var/lib/mysql'.
Resolves: RHEL-112386
While investigating this issue, we also reviewed the log file creation.
The log file is created automatically by the MySQL server when needed.
This can even happen in the middle of the server runtime, when the file
is (re)moved, and the DB server is tasked to flush the logs.
I checked the MySQL server documentation, and tested it, and I found, that the logfile
is indeed created by the server. The only possible reason why the file might be needed
to be created beforehand, is when the file lies on a location to which the MySQL server
won't have permissions to write to.
This is likely the case of MySQL upstream RPMs, which place it by default to the '/var/log':
96d58aa2b9/packaging/rpm-fedora/mysql.spec.in (L703)
However Fedora and RHEL uses a designated directory '/var/log/mysql', which is owened by 'mysql:mysql',
so the issue does not exists here.
This commit is contained in:
parent
a094014ba0
commit
670b865cb2
@ -818,9 +818,6 @@ popd
|
||||
|
||||
%post -n %{pkgname}-server
|
||||
%systemd_post %{daemon_name}.service
|
||||
if [ ! -e "%{logfile}" -a ! -h "%{logfile}" ] ; then
|
||||
install /dev/null -m0640 -omysql -gmysql "%{logfile}"
|
||||
fi
|
||||
|
||||
%preun -n %{pkgname}-server
|
||||
%systemd_preun %{daemon_name}.service
|
||||
@ -1001,7 +998,6 @@ fi
|
||||
%attr(0700,mysql,mysql) %dir %{_localstatedir}/lib/mysql-keyring
|
||||
%attr(0755,mysql,mysql) %dir %{pidfiledir}
|
||||
%attr(0750,mysql,mysql) %dir %{logfiledir}
|
||||
%attr(0640,mysql,mysql) %config %ghost %verify(not md5 size mtime) %{logfile}
|
||||
%config(noreplace) %{logrotateddir}/%{daemon_name}
|
||||
|
||||
%if %{with devel}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user