Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package crmsh for openSUSE:Factory checked in at 2022-10-28 19:31:27 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/crmsh (Old) and /work/SRC/openSUSE:Factory/.crmsh.new.2275 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "crmsh" Fri Oct 28 19:31:27 2022 rev:265 rq:1031831 version:4.4.1+20221027.e42809ff Changes: -------- --- /work/SRC/openSUSE:Factory/crmsh/crmsh.changes 2022-10-25 11:39:48.420522378 +0200 +++ /work/SRC/openSUSE:Factory/.crmsh.new.2275/crmsh.changes 2022-10-28 19:32:10.435426757 +0200 @@ -1,0 +2,16 @@ +Thu Oct 27 05:09:14 UTC 2022 - xli...@suse.com + +- Update to version 4.4.1+20221027.e42809ff: + * Packaging: create /var/log/crmsh with tmpfiles.d + * fix: behave: mkdir /var/log/crmsh in docker image + * Fix: log: ownership and mode of log files should be set in RotatingFileHandler + * Fix: #977 crmsh not working when using ACL + * fix: log: fail to open log file even if user is in haclient group (bsc#1204670) + +------------------------------------------------------------------- +Wed Oct 26 01:27:08 UTC 2022 - xli...@suse.com + +- Update to version 4.4.1+20221026.a0f9a70f: + * fix: userdir: race condition during directory creation + +------------------------------------------------------------------- Old: ---- crmsh-4.4.1+20221014.0b04f693.tar.bz2 New: ---- crmsh-4.4.1+20221027.e42809ff.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ crmsh.spec ++++++ --- /var/tmp/diff_new_pack.ISQHvh/_old 2022-10-28 19:32:11.087430026 +0200 +++ /var/tmp/diff_new_pack.ISQHvh/_new 2022-10-28 19:32:11.091430046 +0200 @@ -36,7 +36,7 @@ Summary: High Availability cluster command-line interface License: GPL-2.0-or-later Group: %{pkg_group} -Version: 4.4.1+20221014.0b04f693 +Version: 4.4.1+20221027.e42809ff Release: 0 URL: http://crmsh.github.io Source0: %{name}-%{version}.tar.bz2 ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.ISQHvh/_old 2022-10-28 19:32:11.147430327 +0200 +++ /var/tmp/diff_new_pack.ISQHvh/_new 2022-10-28 19:32:11.151430347 +0200 @@ -9,7 +9,7 @@ </service> <service name="tar_scm"> <param name="url">https://github.com/ClusterLabs/crmsh.git</param> - <param name="changesrevision">626f3c90ac626ab6a3d967208bc9186002127740</param> + <param name="changesrevision">e42809ff2422901768967a79b9374e446f394c58</param> </service> </servicedata> (No newline at EOF) ++++++ crmsh-4.4.1+20221014.0b04f693.tar.bz2 -> crmsh-4.4.1+20221027.e42809ff.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.4.1+20221014.0b04f693/Dockerfile new/crmsh-4.4.1+20221027.e42809ff/Dockerfile --- old/crmsh-4.4.1+20221014.0b04f693/Dockerfile 2022-10-14 03:36:24.000000000 +0200 +++ new/crmsh-4.4.1+20221027.e42809ff/Dockerfile 2022-10-27 06:51:55.000000000 +0200 @@ -18,6 +18,7 @@ RUN zypper --non-interactive refresh RUN zypper --non-interactive up --allow-vendor-change -y python3-parallax +RUN mkdir -p /var/log/crmsh RUN mkdir -p /root/.ssh && chmod 0700 /root/.ssh RUN echo "$ssh_prv_key" > /root/.ssh/id_rsa && chmod 600 /root/.ssh/id_rsa RUN echo "$ssh_pub_key" > /root/.ssh/id_rsa.pub && chmod 600 /root/.ssh/id_rsa.pub diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.4.1+20221014.0b04f693/crmsh/log.py new/crmsh-4.4.1+20221027.e42809ff/crmsh/log.py --- old/crmsh-4.4.1+20221014.0b04f693/crmsh/log.py 2022-10-14 03:36:24.000000000 +0200 +++ new/crmsh-4.4.1+20221027.e42809ff/crmsh/log.py 2022-10-27 06:51:55.000000000 +0200 @@ -102,6 +102,24 @@ return True +class GroupWriteRotatingFileHandler(logging.handlers.RotatingFileHandler): + """ + A custom rotating file handler which keeps log files group wirtable after rotating + Source: https://stackoverflow.com/a/6779307 + """ + def _open(self): + rtv = super()._open() + try: + shutil.chown(rtv.name, group=constants.HA_GROUP) + os.fchmod(rtv.fileno(), 0o664) + shutil.chown(rtv.name, user=constants.HA_USER) + except PermissionError: + # The file has been open, and FileHandler can write to it. + # Failing to change owner or mode is not a fatal error. + pass + return rtv + + LOGGING_CFG = { "version": 1, "disable_existing_loggers": "False", @@ -141,7 +159,7 @@ "flushLevel": logging.CRITICAL, }, "file": { - "class": "logging.handlers.RotatingFileHandler", + "()": GroupWriteRotatingFileHandler, "filename": CRMSH_LOG_FILE, "formatter": "file", "filters": ["filter"], @@ -416,14 +434,6 @@ sys.stdout.flush() -def setup_directory_for_logfile(): - """ - Create log file's parent directory - """ - _dir = os.path.dirname(CRMSH_LOG_FILE) - os.makedirs(_dir, exist_ok=True) - - def setup_logging(only_help=False): """ Setup log directory and loadding logging config dict @@ -431,11 +441,14 @@ # To avoid the potential "permission denied" error under other users (boo#1192754) if only_help: LOGGING_CFG["handlers"]["file"] = {'class': 'logging.NullHandler'} - else: - setup_directory_for_logfile() + # dirname(CRMSH_LOG_FILE) should be created by package manager during installation + try: + with open(CRMSH_LOG_FILE, 'a'): + pass + except (PermissionError, FileNotFoundError) as e: + print('{}WARNING:{} Failed to open log file: {}'.format(constants.YELLOW, constants.END, e), file=sys.stderr) + LOGGING_CFG["handlers"]["file"] = {'class': 'logging.NullHandler'} logging.config.dictConfig(LOGGING_CFG) - if os.path.exists(CRMSH_LOG_FILE): - shutil.chown(CRMSH_LOG_FILE, constants.HA_USER, constants.HA_GROUP) def setup_logger(name): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.4.1+20221014.0b04f693/crmsh/userdir.py new/crmsh-4.4.1+20221027.e42809ff/crmsh/userdir.py --- old/crmsh-4.4.1+20221014.0b04f693/crmsh/userdir.py 2022-10-14 03:36:24.000000000 +0200 +++ new/crmsh-4.4.1+20221027.e42809ff/crmsh/userdir.py 2022-10-27 06:51:55.000000000 +0200 @@ -47,8 +47,8 @@ def _xdg_file(name, xdg_name, chk_fun, directory): if not name: return name - if not os.path.isdir(directory): - os.makedirs(directory, 0o700) + os.makedirs(directory, 0o700, exist_ok=True) + # FileExistsError will be raised if `directory` exists and it is not a directory new = os.path.join(directory, xdg_name) if directory == CONFIG_HOME and chk_fun(new) and chk_fun(name): logger.warning("both %s and %s exist, please cleanup", name, new) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.4.1+20221014.0b04f693/crmsh.spec.in new/crmsh-4.4.1+20221027.e42809ff/crmsh.spec.in --- old/crmsh-4.4.1+20221014.0b04f693/crmsh.spec.in 2022-10-14 03:36:24.000000000 +0200 +++ new/crmsh-4.4.1+20221027.e42809ff/crmsh.spec.in 2022-10-27 06:51:55.000000000 +0200 @@ -40,6 +40,7 @@ Release: 0 Url: http://crmsh.github.io Source0: %{name}-%{version}.tar.bz2 +Source1: %{name}.tmpfiles.d.conf BuildRoot: %{_tmppath}/%{name}-%{version}-build %if 0%{?suse_version} @@ -174,10 +175,15 @@ install -Dm0755 %{buildroot}%{_bindir}/crm %{buildroot}%{_sbindir}/crm rm %{buildroot}%{_bindir}/crm fi +install -d -m 0755 %{buildroot}%{_tmpfilesdir} +install -m 0644 %{SOURCE1} %{buildroot}%{_tmpfilesdir}/%{name}.conf %if 0%{?suse_version} %fdupes %{buildroot} %endif +%post +%tmpfiles_create %{_tmpfilesdir}/%{name}.conf + %if %{with regression_tests} # Run regression tests after installing the package # NB: this is called twice by OBS, that's why we touch the file @@ -212,6 +218,8 @@ %exclude %{_datadir}/%{name}/tests %exclude %{_datadir}/%{name}/scripts +%{_tmpfilesdir}/%{name}.conf + %doc %{_mandir}/man8/* %{crmsh_docdir}/COPYING %{crmsh_docdir}/AUTHORS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.4.1+20221014.0b04f693/crmsh.tmpfiles.d.conf new/crmsh-4.4.1+20221027.e42809ff/crmsh.tmpfiles.d.conf --- old/crmsh-4.4.1+20221014.0b04f693/crmsh.tmpfiles.d.conf 1970-01-01 01:00:00.000000000 +0100 +++ new/crmsh-4.4.1+20221027.e42809ff/crmsh.tmpfiles.d.conf 2022-10-27 06:51:55.000000000 +0200 @@ -0,0 +1 @@ +d /var/log/crmsh 0775 hacluster haclient -