Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package blog for openSUSE:Factory checked in at 2021-12-06 23:59:09 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/blog (Old) and /work/SRC/openSUSE:Factory/.blog.new.31177 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "blog" Mon Dec 6 23:59:09 2021 rev:15 rq:935416 version:2.26 Changes: -------- --- /work/SRC/openSUSE:Factory/blog/blog.changes 2021-10-04 18:39:26.118005899 +0200 +++ /work/SRC/openSUSE:Factory/.blog.new.31177/blog.changes 2021-12-06 23:59:19.224577515 +0100 @@ -1,0 +2,26 @@ +Fri Dec 3 08:20:08 UTC 2021 - Dr. Werner Fink <wer...@suse.de> + +- Update to version 2.26 + * On s390/x and PPC64 gcc misses unused arg0 +- Remove patch fcb9e0c2.patch as now part of tar ball + +------------------------------------------------------------------- +Thu Dec 2 15:02:35 UTC 2021 - Dr. Werner Fink <wer...@suse.de> + +- Add upstream patch fcb9e0c2.patch + * On s390/x and PPC64 gcc misses unused arg0 + +------------------------------------------------------------------- +Thu Dec 2 13:11:05 UTC 2021 - Dr. Werner Fink <wer...@suse.de> + +- Update to version 2.24 + * Avoid install errror due missed directory + +------------------------------------------------------------------- +Thu Dec 2 11:36:36 UTC 2021 - Dr. Werner Fink <wer...@suse.de> + +- Update to version 2.22 + * Avoid KillMode=none for newer systemd version as well as rework + the systemd unit files of blog (boo#1186506) + +------------------------------------------------------------------- Old: ---- showconsole-2.21.tar.gz New: ---- showconsole-2.26.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ blog.spec ++++++ --- /var/tmp/diff_new_pack.wFqk2j/_old 2021-12-06 23:59:19.824575393 +0100 +++ /var/tmp/diff_new_pack.wFqk2j/_new 2021-12-06 23:59:19.824575393 +0100 @@ -17,7 +17,7 @@ Name: blog -Version: 2.21 +Version: 2.26 %define sonum 2 Release: 0 Summary: Boot logging @@ -30,6 +30,7 @@ Requires(post): coreutils BuildRoot: %{_tmppath}/%{name}-%{version}-build Provides: sysvinit-tools:/sbin/blogd +Suggests: blog-plymouth = %{version} %description The blogd daemon determines the real underlying character device of @@ -52,7 +53,7 @@ %package plymouth Summary: Replaces plymouth by blogd Group: System/Base -Requires: blog +Requires: blog = %{version} Requires: systemd Conflicts: plymouth Conflicts: plymouth-dracut @@ -100,17 +101,20 @@ BOOT_LOGFILE=%{_localstatedir}/log/boot.log \ BOOT_OLDLOGFILE=%{_localstatedir}/log/boot.old -%post -%{?regenerate_initrd_post} -test -x /bin/systemctl && /bin/systemctl daemon-reload >/dev/null 2>&1 || : - -%postun -test -x /bin/systemctl && /bin/systemctl daemon-reload >/dev/null 2>&1 || : +rm -vf %{buildroot}%{_unitdir}/systemd-ask-password-blog.service.wants/systemd-vconsole-setup.service %post -n libblogger%{sonum} -p /sbin/ldconfig %postun -n libblogger%{sonum} -p /sbin/ldconfig -%posttrans +%post plymouth +ln -sf ../systemd-vconsole-setup.service %{_unitdir}/systemd-ask-password-blog.service.wants/ +test -x /bin/systemctl && /bin/systemctl daemon-reload >/dev/null 2>&1 || : +%{?regenerate_initrd_post} + +%postun plymouth +test -x /bin/systemctl && /bin/systemctl daemon-reload >/dev/null 2>&1 || : + +%posttrans plymouth %{?regenerate_initrd_posttrans} %files @@ -149,21 +153,18 @@ %files plymouth %defattr(-,root,root) -%dir %{_prefix}/lib/dracut -%dir %{_prefix}/lib/dracut/modules.d -%dir %{_prefix}/lib/dracut/modules.d/99blog -%dir %{_unitdir}/basic.target.wants -%dir %{_unitdir}/default.target.wants -%dir %{_unitdir}/emergency.target.wants -%dir %{_unitdir}/halt.target.wants -%dir %{_unitdir}/initrd-switch-root.target.wants -%dir %{_unitdir}/kexec.target.wants -%dir %{_unitdir}/multi-user.target.wants -%dir %{_unitdir}/poweroff.target.wants -%dir %{_unitdir}/reboot.target.wants -%dir %{_unitdir}/rescue.target.wants -%dir %{_unitdir}/sysinit.target.wants -%dir %{_unitdir}/systemd-ask-password-blog.service.wants +%dir %{_prefix}/lib/dracut/ +%dir %{_prefix}/lib/dracut/modules.d/ +%dir %{_prefix}/lib/dracut/modules.d/99blog/ +%dir %{_unitdir}/basic.target.wants/ +%dir %{_unitdir}/default.target.wants/ +%dir %{_unitdir}/emergency.target.wants/ +%dir %{_unitdir}/initrd-switch-root.target.wants/ +%dir %{_unitdir}/rescue.target.wants/ +%dir %{_unitdir}/sysinit.target.wants/ +%dir %{_unitdir}/shutdown.target.wants/ +%dir %{_unitdir}/local-fs-pre.target.wants/ +%dir %{_unitdir}/systemd-ask-password-blog.service.wants/ %{_prefix}/lib/dracut/modules.d/99blog/module-setup.sh %{_unitdir}/blog-final.service %{_unitdir}/blog-quit.service @@ -176,18 +177,13 @@ %{_unitdir}/basic.target.wants/blog.service %{_unitdir}/default.target.wants/blog-quit.service %{_unitdir}/emergency.target.wants/blog-quit.service -%{_unitdir}/halt.target.wants/blog-final.service -%{_unitdir}/halt.target.wants/blog-umount.service %{_unitdir}/initrd-switch-root.target.wants/blog-switch-root.service %{_unitdir}/initrd-switch-root.target.wants/blog.service -%{_unitdir}/kexec.target.wants/blog-final.service -%{_unitdir}/kexec.target.wants/blog-umount.service -%{_unitdir}/poweroff.target.wants/blog-final.service -%{_unitdir}/poweroff.target.wants/blog-umount.service -%{_unitdir}/reboot.target.wants/blog-final.service -%{_unitdir}/reboot.target.wants/blog-umount.service %{_unitdir}/rescue.target.wants/blog-quit.service %{_unitdir}/sysinit.target.wants/blog-store-messages.service %{_unitdir}/sysinit.target.wants/systemd-ask-password-blog.path +%{_unitdir}/shutdown.target.wants/blog-final.service +%{_unitdir}/local-fs-pre.target.wants/blog-umount.service +%ghost %{_unitdir}/systemd-ask-password-blog.service.wants/systemd-vconsole-setup.service %changelog ++++++ blog-rpmlintrc ++++++ --- /var/tmp/diff_new_pack.wFqk2j/_old 2021-12-06 23:59:19.848575309 +0100 +++ /var/tmp/diff_new_pack.wFqk2j/_new 2021-12-06 23:59:19.852575294 +0100 @@ -1,3 +1,4 @@ addFilter(".*systemd-service-without-service_del_p.*") addFilter(".*systemd-service-without-service_add_p.*") addFilter(".*suse-missing-rclink.*") +addFilter(".*E:.*unused-rpmlintrc-filter.*suse-missing-rclink.*") ++++++ showconsole-2.21.tar.gz -> showconsole-2.26.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/showconsole-2.21/Makefile new/showconsole-2.26/Makefile --- old/showconsole-2.21/Makefile 2021-04-09 10:41:58.000000000 +0200 +++ new/showconsole-2.26/Makefile 2021-12-03 08:40:53.000000000 +0100 @@ -15,7 +15,7 @@ DEBUG = DESTDIR = MAJOR := 2 -MINOR := 21 +MINOR := 24 VERSION := $(MAJOR).$(MINOR) DATE = $(shell date +'%d%b%y' | tr '[:lower:]' '[:upper:]') COPTS = @@ -69,7 +69,7 @@ # # TODO = showconsole blogd blogger blogctl isserial libblogger.so -TODO += blog-store-messages.service blogd.8 blogger.8 +TODO += blog-store-messages.service blog-umount.service blogd.8 blogger.8 L := libconsole/ CFLAGS += -I ./ -I ./$(L) libfiles := $(sort $(wildcard $(L)*.c)) @@ -120,12 +120,6 @@ $(MKDIR) $(DESTDIR)$(INCDIR) $(MKDIR) $(DESTDIR)$(DRACUTMOD) $(MKDIR) $(DESTDIR)$(SYSDUNITS) - for target in basic default emergency halt initrd-switch-root kexec multi-user poweroff reboot rescue shutdown sysinit ; do \ - $(MKDIR) $(DESTDIR)$(SYSDUNITS)/$${target}.target.wants ; \ - done - for unit in systemd-ask-password-blog ; do \ - $(MKDIR) $(DESTDIR)$(SYSDUNITS)/$${unit}.service.wants ; \ - done $(INSTBIN) showconsole $(DESTDIR)$(SBINDIR)/ $(LINK) showconsole $(DESTDIR)$(SBINDIR)/setconsole $(INSTBIN) blogger $(DESTDIR)$(SBINDIR)/ @@ -149,25 +143,37 @@ for unit in systemd-ask-password-blog.path systemd-ask-password-blog.service ; do \ $(INSTCON) $${unit} $(DESTDIR)$(SYSDUNITS)/ ; \ done + for target in default sysinit basic local-fs-pre rescue shutdown emergency initrd-switch-root; do \ + $(MKDIR) $(DESTDIR)$(SYSDUNITS)/$${target}.target.wants ; \ + done + for service in systemd-ask-password-blog ; do \ + $(MKDIR) $(DESTDIR)$(SYSDUNITS)/$${target}.service.wants ; \ + done + for unit in blog-quit.service ; do \ + $(LINK) ../$${unit} $(DESTDIR)$(SYSDUNITS)/default.target.wants/$${unit} ; \ + $(LINK) ../$${unit} $(DESTDIR)$(SYSDUNITS)/rescue.target.wants/$${unit} ; \ + $(LINK) ../$${unit} $(DESTDIR)$(SYSDUNITS)/emergency.target.wants/$${unit} ; \ + done for unit in blog.service ; do \ $(LINK) ../$${unit} $(DESTDIR)$(SYSDUNITS)/basic.target.wants/$${unit} ; \ done - for unit in blog-final.service blog-umount.service ; do \ - $(LINK) ../$${unit} $(DESTDIR)$(SYSDUNITS)/halt.target.wants/$${unit} ; \ - $(LINK) ../$${unit} $(DESTDIR)$(SYSDUNITS)/kexec.target.wants/$${unit} ; \ - $(LINK) ../$${unit} $(DESTDIR)$(SYSDUNITS)/poweroff.target.wants/$${unit} ; \ - $(LINK) ../$${unit} $(DESTDIR)$(SYSDUNITS)/reboot.target.wants/$${unit} ; \ + for unit in blog-store-messages.service systemd-ask-password-blog.path ; do \ + $(LINK) ../$${unit} $(DESTDIR)$(SYSDUNITS)/sysinit.target.wants/$${unit} ; \ done - for unit in blog-quit.service ; do \ - $(LINK) ../$${unit} $(DESTDIR)$(SYSDUNITS)/default.target.wants/$${unit} ; \ - $(LINK) ../$${unit} $(DESTDIR)$(SYSDUNITS)/emergency.target.wants/$${unit} ; \ - $(LINK) ../$${unit} $(DESTDIR)$(SYSDUNITS)/rescue.target.wants/$${unit} ; \ + for unit in blog-umount.service ; do \ + $(LINK) ../$${unit} $(DESTDIR)$(SYSDUNITS)/local-fs-pre.target.wants/$${unit} ; \ + done + for unit in blog-final.service ; do \ + $(LINK) ../$${unit} $(DESTDIR)$(SYSDUNITS)/shutdown.target.wants/$${unit} ; \ + done + for target in systemd-ask-password-blog.service ; do \ + $(MKDIR) $(DESTDIR)$(SYSDUNITS)/$${target}.wants ; \ done for unit in blog.service blog-switch-root.service ; do \ - $(LINK) ../$${unit} $(DESTDIR)$(SYSDUNITS)/initrd-switch-root.target.wants/$${unit} ; \ + $(LINK) ../$${unit} $(DESTDIR)$(SYSDUNITS)/initrd-switch-root.target.wants/$${unit} ; \ done - for unit in blog-store-messages.service systemd-ask-password-blog.path ; do \ - $(LINK) ../$${unit} $(DESTDIR)$(SYSDUNITS)/sysinit.target.wants/${uni$t} ; \ + for unit in systemd-vconsole-setup.service ; do \ + $(LINK) ../$${unit} $(DESTDIR)$(SYSDUNITS)/systemd-ask-password-blog.service.wants/$${unit} ; \ done # @@ -197,7 +203,7 @@ blog-quit.service \ blog-store-messages.service.in \ blog-switch-root.service \ - blog-umount.service \ + blog-umount.service.in \ systemd-ask-password-blog.path \ systemd-ask-password-blog.service \ module-setup.sh \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/showconsole-2.21/blog-final.service new/showconsole-2.26/blog-final.service --- old/showconsole-2.21/blog-final.service 2021-04-09 10:41:58.000000000 +0200 +++ new/showconsole-2.26/blog-final.service 2021-12-03 08:40:53.000000000 +0100 @@ -2,21 +2,12 @@ Description=Start Blogd at System Shutdown DefaultDependencies=no Before=shutdown.target -Before=halt.target -Before=kexec.target -Before=poweroff.target -Before=reboot.target RefuseManualStart=true [Service] Type=forking -KillMode=none SendSIGKILL=no -RemainAfterExit=yes ExecStart=/sbin/blogd -f [Install] -WantedBy=halt.target -WantedBy=kexec.target -WantedBy=poweroff.target -WantedBy=reboot.target +WantedBy=shutdown.target diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/showconsole-2.21/blog-quit.service new/showconsole-2.26/blog-quit.service --- old/showconsole-2.21/blog-quit.service 2021-04-09 10:41:58.000000000 +0200 +++ new/showconsole-2.26/blog-quit.service 2021-12-03 08:40:53.000000000 +0100 @@ -10,7 +10,8 @@ [Service] Type=oneshot TimeoutSec=20 -ExecStart=-/sbin/blogctl quit +RemainAfterExit=yes +ExecStart=/sbin/blogctl quit [Install] WantedBy=default.target diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/showconsole-2.21/blog-store-messages.service.in new/showconsole-2.26/blog-store-messages.service.in --- old/showconsole-2.21/blog-store-messages.service.in 2021-04-09 10:41:58.000000000 +0200 +++ new/showconsole-2.26/blog-store-messages.service.in 2021-12-03 08:40:53.000000000 +0100 @@ -3,7 +3,9 @@ DefaultDependencies=no RequiresMountsFor=@@BOOT_LOGFILE@@ Conflicts=shutdown.target -After=systemd-remount-fs.service auditd.service +Requisite=systemd-update-utmp.service +After=systemd-update-utmp.service +After=systemd-remount-fs.service systemd-tmpfiles-setup.service auditd.service Before=sysinit.target shutdown.target ConditionPathExists=!/etc/initrd-release @@ -11,8 +13,7 @@ Type=oneshot TimeoutSec=20 RemainAfterExit=yes -ExecStart=-/sbin/blogctl ready -ExecStop=-/sbin/blogctl close +ExecStart=/sbin/blogctl ready [Install] -WantedBy=sysinit.target halt.target kexec.target poweroff.target reboot.target +WantedBy=sysinit.target diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/showconsole-2.21/blog-umount.service new/showconsole-2.26/blog-umount.service --- old/showconsole-2.21/blog-umount.service 2021-04-09 10:41:58.000000000 +0200 +++ new/showconsole-2.26/blog-umount.service 1970-01-01 01:00:00.000000000 +0100 @@ -1,19 +0,0 @@ -[Unit] -Description=Tell blogd to close log file -DefaultDependencies=no -After=blog-final.service -Before=local-fs.target -Wants=local-fs.target -RequiresMountsFor=/var/log/boot.old -ConditionPathIsReadWrite=/var/log/boot.old - -[Service] -Type=oneshot -TimeoutSec=0 -ExecStart=-/sbin/blogctl close - -[Install] -WantedBy=halt.target -WantedBy=kexec.target -WantedBy=poweroff.target -WantedBy=reboot.target diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/showconsole-2.21/blog-umount.service.in new/showconsole-2.26/blog-umount.service.in --- old/showconsole-2.21/blog-umount.service.in 1970-01-01 01:00:00.000000000 +0100 +++ new/showconsole-2.26/blog-umount.service.in 2021-12-03 08:40:53.000000000 +0100 @@ -0,0 +1,15 @@ +[Unit] +Description=Tell blogd to close log file +DefaultDependencies=no +Conflicts=shutdown.target +Before=systemd-tmpfiles-setup.service +RequiresMountsFor=@@BOOT_OLDLOGFILE@@ + +[Service] +Type=oneshot +TimeoutSec=0 +RemainAfterExit=yes +ExecStop=/sbin/blogctl close + +[Install] +WantedBy=local-fs-pre.target diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/showconsole-2.21/blog.service new/showconsole-2.26/blog.service --- old/showconsole-2.21/blog.service 2021-04-09 10:41:58.000000000 +0200 +++ new/showconsole-2.26/blog.service 2021-12-03 08:40:53.000000000 +0100 @@ -1,8 +1,10 @@ [Unit] Description=Start Blogd at System Bootup DefaultDependencies=no +Wants=systemd-ask-password-blog.path systemd-vconsole-setup.service +After=systemd-vconsole-setup.service +Before=systemd-ask-password-blog.service ConditionKernelCommandLine=!blog.enable=0 -ConditionKernelCommandLine=!init=/bin/bash Wants=systemd-ask-password-blog.path Before=systemd-ask-password-blog.service Before=sysinit.target @@ -10,7 +12,6 @@ [Service] Type=forking -KillMode=none SendSIGKILL=no RemainAfterExit=yes ExecStart=/sbin/blogd diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/showconsole-2.21/blogctl.8 new/showconsole-2.26/blogctl.8 --- old/showconsole-2.21/blogctl.8 2021-04-09 10:41:58.000000000 +0200 +++ new/showconsole-2.26/blogctl.8 2021-12-03 08:40:53.000000000 +0100 @@ -15,7 +15,8 @@ .B /sbin/blogctl .RI [ ping | quit | root=<path> | ready | close ] .SH DESCRIPTION -.B blogctl may be used to check if a +.B blogctl +may be used to check if a .B blogd daemon is active as well as to send comands to such a daemon. .SH COMANDS @@ -46,6 +47,20 @@ daemon to finish its logging only to allow .BR systemd (8) to unmount the file systems finally. +.TP +.B deactivate +This let the daemon disconnect from system console. +.TP +.B reactivate +Whereas this cause the daemon reconnect to system console. +.TP +.B final +Evoke the daemon to rename an already open log file +.I /var/log/boot.log +to the new name +.I /var/log/boot.old +as well as mask it own program name in the process table +with the @ character. .SH SEE ALSO .BR blogd (8), .BR systemd (1), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/showconsole-2.21/blogctl.c new/showconsole-2.26/blogctl.c --- old/showconsole-2.21/blogctl.c 2021-04-09 10:41:58.000000000 +0200 +++ new/showconsole-2.26/blogctl.c 2021-12-03 08:40:53.000000000 +0100 @@ -47,6 +47,7 @@ { "ping", MAGIC_PING, 0, NULL }, /* Ping */ { "ready", MAGIC_SYS_INIT, 0, NULL }, /* System ready */ { "quit", MAGIC_QUIT, 0, NULL }, /* Quit */ + { "final", MAGIC_FINAL, 0, NULL }, /* Final */ { "close", MAGIC_CLOSE, 0, NULL }, /* Close logging only */ { "deactivate", MAGIC_DEACTIVATE, 0, NULL }, /* Deactivate logging */ { "reactivate", MAGIC_REACTIVATE, 0, NULL }, /* Reactivate logging */ @@ -107,6 +108,7 @@ case MAGIC_PING: case MAGIC_SYS_INIT: case MAGIC_QUIT: + case MAGIC_FINAL: case MAGIC_CLOSE: case MAGIC_DEACTIVATE: case MAGIC_REACTIVATE: @@ -114,7 +116,6 @@ if (fdsock >= 0) safeout(fdsock, cmd, strlen(cmd)+1, SSIZE_MAX); break; - break; case '?': default: return 1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/showconsole-2.21/blogd.c new/showconsole-2.26/blogd.c --- old/showconsole-2.21/blogd.c 2021-04-09 10:41:58.000000000 +0200 +++ new/showconsole-2.26/blogd.c 2021-12-03 08:40:53.000000000 +0100 @@ -227,9 +227,9 @@ */ int main(int argc, char *argv[]) { - volatile char *arg0 = argv[0]; char ptsname[NAME_MAX+1]; const char *tty, *stt; + volatile char *arg0; struct console *c; struct termios o; struct winsize w; @@ -247,6 +247,9 @@ if (kill (1, SIGRTMIN+20) < 0) warn("could not tell system to show its status"); + arg0 = (volatile char*)argv[0]; + remember_arg0(arg0); + while ((arg = getopt(argc, argv, "f")) != -1) { switch (arg) { case 'f': @@ -261,6 +264,7 @@ argc -= optind; myname = program_invocation_short_name; + getconsoles(&cons, 1); close(0); close(1); @@ -269,6 +273,7 @@ error("Can not open system console %s", console); if (fd > 0) { + (void)ioctl(fd, TIOCNXCL); /* Avoid EBUSY */ dup2(fd, 0); close(fd); } @@ -279,8 +284,6 @@ (void)ioctl(0, TIOCCONS, NULL); /* Undo any current map if any */ - getconsoles(&cons, 1); - list_for_each_entry(c, &cons->node, node) { speed_t ospeed; speed_t ispeed; @@ -336,6 +339,10 @@ if (ioctl(pts, TIOCCONS, NULL) < 0) error("can not set console device to %s", ptsname); + /* + * Reconnecting to stdin aka ptm to 0 is done after we fork away + */ + dup2(pts, 1); dup2(pts, 2); /* Now we are blind upto safeIO() loop */ if (pts > 2) @@ -362,7 +369,7 @@ speed_t ispeed; int flags; - (void)ioctl(fd, TIOCNXCL); /* Avoid EBUSY */ + (void)ioctl(c->fd, TIOCNXCL); /* Avoid EBUSY */ #ifdef _PC_MAX_CANON if ((c->max_canon = (ssize_t)fpathconf(c->fd, _PC_MAX_CANON)) <= 0) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/showconsole-2.21/blogger.c new/showconsole-2.26/blogger.c --- old/showconsole-2.21/blogger.c 2021-04-09 10:41:58.000000000 +0200 +++ new/showconsole-2.26/blogger.c 2021-12-03 08:40:53.000000000 +0100 @@ -17,10 +17,14 @@ #include <unistd.h> #include "libblogger.h" +volatile char *arg0; + int main(int argc, char * argv[]) { int c, lvl = 'n'; + arg0 = (volatile char*)argv[0]; + while ((c = getopt(argc, argv, "ndfsu")) != -1) { switch (c) { case B_NOTICE: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/showconsole-2.21/libconsole/console.c new/showconsole-2.26/libconsole/console.c --- old/showconsole-2.21/libconsole/console.c 2021-04-09 10:41:58.000000000 +0200 +++ new/showconsole-2.26/libconsole/console.c 2021-12-03 08:40:53.000000000 +0100 @@ -16,6 +16,7 @@ #include <limits.h> #include <linux/magic.h> #include <linux/major.h> +#include <pty.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> @@ -49,6 +50,17 @@ #endif int final = 0; +static volatile char *_arg0; + +/* + * Avoid trouble if linked with e.g. blogger as there + * is no external arg0 but linker on ppc64 and s390/x + * seems to expect this. + */ +void remember_arg0(volatile char *arg0) +{ + _arg0 = arg0; +} /* * Used to ignore some signals during epoll_pwait(2) or ppoll(2) @@ -60,9 +72,6 @@ */ int epfd = -1; int evmax; -static int requests = 0; - -#define REQUEST_CLOSE (1<<0) /* * Remember if we're signaled. @@ -451,9 +460,6 @@ stop_logging(); flog = close_logging(); } - if (requests & REQUEST_CLOSE) { - ; - } if (nsigio < 0) { nsigio = SIGIO; (void)set_signal(SIGIO, NULL, SIG_IGN); @@ -501,10 +507,6 @@ stop_logging(); flog = close_logging(); - if (requests & REQUEST_CLOSE) { - ; - } - if (fdfifo >= 0) { epoll_delete(fdfifo); close(fdfifo); @@ -687,7 +689,7 @@ */ static void epoll_console_in(int fd) { - const ssize_t cnt = safein(fdread, trans, sizeof(trans)); + const ssize_t cnt = safein(fd, trans, sizeof(trans)); static struct winsize owz; struct winsize wz; @@ -939,6 +941,103 @@ break; + case MAGIC_DEACTIVATE: + + if (fdread >= 0) { + struct console *c; + + list_for_each_entry(c, &cons->node, node) { + if (c->flags & CON_CONSDEV) { + if (c->fd > 0) { + epoll_delete(fdread); + (void)ioctl(c->fd, TIOCCONS, NULL); + close(fdread); + dup2(c->fd, 0); + dup2(0, 1); + dup2(0, 2); + fdread = -1; + } + break; + } + } + } + + enqry = ANSWER_ACK; + safeout(fd, enqry, strlen(enqry)+1, SSIZE_MAX); + + break; + + case MAGIC_REACTIVATE: + + if (fdread < 0) { + struct console *c; + + list_for_each_entry(c, &cons->node, node) { + if (c->flags & CON_CONSDEV) { + if (c->fd > 0) { + char ptsname[NAME_MAX+1]; + struct termios o; + struct winsize w; + struct stat st; + speed_t ospeed = B38400; + speed_t ispeed = B38400; + int ptm, pts; + + w.ws_row = 0; + w.ws_col = 0; + if (ioctl(c->fd, TIOCGWINSZ, &w) < 0) + error("can not get window size of %s", c->tty); + + if (!w.ws_row) + w.ws_row = 24; + if (!w.ws_col) + w.ws_col = 80; + + memcpy(&o, &c->otio, sizeof(o)); + cfmakeraw(&o); + cfsetispeed(&o, ispeed); + cfsetospeed(&o, ospeed); + o.c_lflag &= ~ECHO; + o.c_lflag |= ISIG; + o.c_cc[VTIME] = 0; + o.c_cc[VMIN] = CMIN; + + if (openpty(&ptm, &pts, ptsname, &o, &w) < 0) + error("can not open pty/tty pair"); + + if (fstat(pts, &st) < 0) + error("can not stat slave pty"); + else { + struct termios lock; + memset(&lock, 0xff, sizeof(lock)); + (void)ioctl(pts, TIOCSLCKTRMIOS, &lock); + } + + if (ioctl(pts, TIOCCONS, NULL) < 0) + error("can not set console device to %s", ptsname); + + dup2(ptm, 0); + if (ptm > 0) + close(ptm); + + dup2(pts, 1); + dup2(pts, 2); + if (pts > 2) + close(pts); + + epoll_addread(0, &epoll_console_in); + fdread = 0; + } + break; + } + } + } + + enqry = ANSWER_ACK; + safeout(fd, enqry, strlen(enqry)+1, SSIZE_MAX); + + break; + case MAGIC_QUIT: enqry = ANSWER_ACK; @@ -950,9 +1049,31 @@ break; - case MAGIC_CLOSE: + case MAGIC_FINAL: + + enqry = ANSWER_ACK; + safeout(fd, enqry, strlen(enqry)+1, SSIZE_MAX); - requests |= REQUEST_CLOSE; + if (!final && _arg0) { + int ret; + + final = 1; + + if (_arg0[0] != '@') + _arg0[0] = '@'; + + ret = rename(BOOT_LOGFILE, BOOT_OLDLOGFILE); + if (ret < 0) { + if (errno == EACCES || errno == EROFS || errno == EPERM) + goto skip; + if (errno != ENOENT) + error("Can not rename %s", BOOT_LOGFILE); + } + } + skip: + break; + + case MAGIC_CLOSE: enqry = ANSWER_ACK; safeout(fd, enqry, strlen(enqry)+1, SSIZE_MAX); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/showconsole-2.21/libconsole/libconsole.h new/showconsole-2.26/libconsole/libconsole.h --- old/showconsole-2.21/libconsole/libconsole.h 2021-04-09 10:41:58.000000000 +0200 +++ new/showconsole-2.26/libconsole/libconsole.h 2021-12-03 08:40:53.000000000 +0100 @@ -91,6 +91,7 @@ #define MAGIC_PING 'P' #define MAGIC_QUIT 'Q' #define MAGIC_CLOSE 'X' /* Not known by plymouthd, but blogd does close log file */ +#define MAGIC_FINAL 'F' /* Not known by plymouthd, but blogd move log to old log */ #define MAGIC_CACHED_PWD 'c' #define MAGIC_ASK_PWD '*' #define MAGIC_DETAILS '!' /* blogd does always spool log messages */ @@ -121,6 +122,7 @@ extern volatile sig_atomic_t signaled; extern volatile sig_atomic_t nsigsys; +extern void remember_arg0(volatile char *arg0); extern ssize_t safein (int fd, void *ptr, size_t s); extern void safeout (int fd, const void *ptr, size_t s, ssize_t max); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/showconsole-2.21/module-setup.sh new/showconsole-2.26/module-setup.sh --- old/showconsole-2.21/module-setup.sh 2021-04-09 10:41:58.000000000 +0200 +++ new/showconsole-2.26/module-setup.sh 2021-12-03 08:40:53.000000000 +0100 @@ -14,45 +14,40 @@ $systemdsystemunitdir/blog.service \ $systemdsystemunitdir/blog-final.service \ $systemdsystemunitdir/blog-quit.service \ - $systemdsystemunitdir/blog-store-messages.service \ $systemdsystemunitdir/blog-switch-root.service \ - $systemdsystemunitdir/blog-umount.service \ $systemdsystemunitdir/systemd-ask-password-blog.path \ $systemdsystemunitdir/systemd-ask-password-blog.service \ $systemdsystemunitdir/systemd-vconsole-setup.service - for t in basic emergency halt initrd-switch-root kexec multi-user poweroff reboot rescue shutdown sysinit + for t in default sysinit basic local-fs-pre rescue shutdown emergency initrd-switch-root do test -d "${initdir}${systemdsystemunitdir}/${t}.target.wants" && continue mkdir -p "${initdir}${systemdsystemunitdir}/${t}.target.wants" done - for t in systemd-ask-password-blog.service + for s in blog-quit.service do - test -d "${initdir}${systemdsystemunitdir}/${t}.wants" && continue - mkdir -p "${initdir}${systemdsystemunitdir}/${t}.wants" + ln_r "${systemdsystemunitdir}/${s}" "${systemdsystemunitdir}/rescue.target.wants/${s}" + ln_r "${systemdsystemunitdir}/${s}" "${systemdsystemunitdir}/emergency.target.wants/${s}" done for s in blog.service do ln_r "${systemdsystemunitdir}/${s}" "${systemdsystemunitdir}/basic.target.wants/${s}" done - for s in blog-final.service blog-umount.service + for s in systemd-ask-password-blog.path do - ln_r "${systemdsystemunitdir}/${s}" "${systemdsystemunitdir}/halt.target.wants/${s}" - ln_r "${systemdsystemunitdir}/${s}" "${systemdsystemunitdir}/kexec.target.wants/${s}" - ln_r "${systemdsystemunitdir}/${s}" "${systemdsystemunitdir}/poweroff.target.wants/${s}" - ln_r "${systemdsystemunitdir}/${s}" "${systemdsystemunitdir}/reboot.target.wants/${s}" + ln_r "${systemdsystemunitdir}/${s}" "${systemdsystemunitdir}/sysinit.target.wants/${s}" done - for s in blog-quit.service + for s in blog-final.service do - ln_r "${systemdsystemunitdir}/${s}" "${systemdsystemunitdir}/emergency.target.wants/${s}" - ln_r "${systemdsystemunitdir}/${s}" "${systemdsystemunitdir}/rescue.target.wants/${s}" + ln_r "${systemdsystemunitdir}/${s}" "${systemdsystemunitdir}/shutdown.target.wants/${s}" done - for s in blog.service blog-switch-root.service + for t in systemd-ask-password-blog.service do - ln_r "${systemdsystemunitdir}/${s}" "${systemdsystemunitdir}/initrd-switch-root.target.wants/${s}" + test -d "${initdir}${systemdsystemunitdir}/${t}.wants" && continue + mkdir -p "${initdir}${systemdsystemunitdir}/${t}.wants" done - for s in blog-store-messages.service + for s in blog.service blog-switch-root.service do - ln_r "${systemdsystemunitdir}/${s}" "${systemdsystemunitdir}/sysinit.target.wants/${s}" + ln_r "${systemdsystemunitdir}/${s}" "${systemdsystemunitdir}/initrd-switch-root.target.wants/${s}" done for s in systemd-vconsole-setup.service do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/showconsole-2.21/systemd-ask-password-blog.path new/showconsole-2.26/systemd-ask-password-blog.path --- old/showconsole-2.21/systemd-ask-password-blog.path 2021-04-09 10:41:58.000000000 +0200 +++ new/showconsole-2.26/systemd-ask-password-blog.path 2021-12-03 08:40:53.000000000 +0100 @@ -7,6 +7,7 @@ Before=basic.target shutdown.target ConditionKernelCommandLine=!blog.enable=0 ConditionPathExists=/run/blogd.pid +ConditionVirtualization=!container [Path] DirectoryNotEmpty=/run/systemd/ask-password diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/showconsole-2.21/systemd-ask-password-blog.service new/showconsole-2.26/systemd-ask-password-blog.service --- old/showconsole-2.21/systemd-ask-password-blog.service 2021-04-09 10:41:58.000000000 +0200 +++ new/showconsole-2.26/systemd-ask-password-blog.service 2021-12-03 08:40:53.000000000 +0100 @@ -6,6 +6,7 @@ After=blog.service Before=shutdown.target ConditionKernelCommandLine=!blog.enable=0 +ConditionVirtualization=!container ConditionPathExists=/run/blogd.pid [Service]