Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package blog for openSUSE:Factory checked in 
at 2025-04-03 18:43:24
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/blog (Old)
 and      /work/SRC/openSUSE:Factory/.blog.new.1907 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "blog"

Thu Apr  3 18:43:24 2025 rev:19 rq:1266909 version:2.32

Changes:
--------
--- /work/SRC/openSUSE:Factory/blog/blog.changes        2023-11-30 
22:00:39.683601295 +0100
+++ /work/SRC/openSUSE:Factory/.blog.new.1907/blog.changes      2025-04-03 
18:43:59.646258529 +0200
@@ -1,0 +2,57 @@
+Thu Apr  3 14:20:30 UTC 2025 - Dr. Werner Fink <wer...@suse.de>
+
+- Update to version 2.32
+  * Better 3270 console support, use uevent below /sys file system 
+
+-------------------------------------------------------------------
+Wed Apr  2 09:53:11 UTC 2025 - Dr. Werner Fink <wer...@suse.de>
+
+- Update to version 2.31
+  * Handel BS on password prompt as well
+  * Drop spining code as systemd uses clear to end of line
+    escape sequence (hard coded!) for its cylon lines.
+- blog: again suggest blog-plymouth
+
+-------------------------------------------------------------------
+Mon Mar 31 13:10:13 UTC 2025 - Dr. Werner Fink <wer...@suse.de>
+
+- Update to version 2.30
+  * The asking variable is not shared
+  * Allow password asking prompt to be repeated if empty.
+  * Make spinner support UTF-8 multibyte conform.
+  * Spinner lines of system still not handled.
+
+-------------------------------------------------------------------
+Fri Mar 28 11:42:55 UTC 2025 - Dr. Werner Fink <wer...@suse.de>
+
+- Update to version 2.29
+  * Make sure that password prompt is seen Latest
+    Use a temporary buffer to be silent during asking passwords.
+    And stop system console output during password questions
+    only if temporary buffer becomes short. As well as do coloring
+    on /dev/ttysclp0 for S390. 
+- Drop patch.patch as now upstream
+
+-------------------------------------------------------------------
+Fri Mar 28 10:15:28 UTC 2025 - Dr. Werner Fink <wer...@suse.de>
+
+- Modify temporary patch patch.patch
+  * Use a temporary buffer to be silent during asking passwords
+  * Stop system console output during password questions only
+    if temporary buffer becomes short 
+
+-------------------------------------------------------------------
+Thu Mar 27 14:35:55 UTC 2025 - Dr. Werner Fink <wer...@suse.de>
+
+- Add temporary patch named patch.patch
+  * Stop system console output during password questions 
+  * Do coloring on /dev/ttysclp0
+
+-------------------------------------------------------------------
+Wed Mar 12 10:40:47 UTC 2025 - Dr. Werner Fink <wer...@suse.de>
+
+- blog: recommend blog-plymouth instead of only suggesting
+  * More house advertising to make plymouth support of blogd
+    more familiar and known by the users
+
+-------------------------------------------------------------------
@@ -12 +69 @@
-  and ansers (blogctl) as well as passphrases (blogd) 
+  and answers (blogctl) as well as passphrases (blogd)

Old:
----
  showconsole-2.28.tar.gz

New:
----
  showconsole-2.32.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ blog.spec ++++++
--- /var/tmp/diff_new_pack.0AZ165/_old  2025-04-03 18:44:00.158280009 +0200
+++ /var/tmp/diff_new_pack.0AZ165/_new  2025-04-03 18:44:00.162280177 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package blog
 #
-# Copyright (c) 2023 SUSE LLC
+# Copyright (c) 2025 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
 
 
 Name:           blog
-Version:        2.28
+Version:        2.32
 %define sonum   2
 Release:        0
 Summary:        Boot logging
@@ -26,7 +26,6 @@
 URL:            https://github.com/bitstreamout/showconsole
 Source:         
https://github.com/bitstreamout/showconsole/archive/v%{version}.tar.gz#/showconsole-%{version}.tar.gz
 Source1:        blog-rpmlintrc
-BuildRequires:  suse-module-tools
 Requires(post): coreutils
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 Provides:       sysvinit-tools:/sbin/blogd
@@ -79,9 +78,13 @@
 
 %prep
 %setup -q -n showconsole-%version
+for l in rt util pthread
+do
+    ln -sf %{_libdir}/lib${l}.so.[0-9] lib${l}.so
+done
 
 %build
-make %{?_smp_mflags} CC="%__cc" \
+make V=1 %{?_smp_mflags} CC="%__cc" \
     LIBDIR=%{_libdir} \
     INCDIR=%{_includedir} \
     SYSDUNITS=%{_unitdir} \

++++++ showconsole-2.28.tar.gz -> showconsole-2.32.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/showconsole-2.28/Makefile 
new/showconsole-2.32/Makefile
--- old/showconsole-2.28/Makefile       2023-11-29 13:17:01.000000000 +0100
+++ new/showconsole-2.32/Makefile       2025-04-03 15:35:19.000000000 +0200
@@ -15,7 +15,7 @@
 DEBUG   =
 DESTDIR         =
 MAJOR   :=     2
-MINOR   :=     28
+MINOR   :=     31
 VERSION         :=     $(MAJOR).$(MINOR)
 DATE    =      $(shell date +'%d%b%y' | tr '[:lower:]' '[:upper:]')
 COPTS    =
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/showconsole-2.28/blogd.c new/showconsole-2.32/blogd.c
--- old/showconsole-2.28/blogd.c        2023-11-29 13:17:01.000000000 +0100
+++ new/showconsole-2.32/blogd.c        2025-04-03 15:35:19.000000000 +0200
@@ -42,6 +42,7 @@
 
 extern volatile sig_atomic_t nsigsys;
 extern volatile sig_atomic_t signaled;
+extern volatile sig_atomic_t asking;
 extern int final;
 
 static int show_status;
@@ -357,7 +358,7 @@
     if (pts > 2)
        close(pts);
 
-    signaled = nsigsys = 0;
+    asking = signaled = nsigsys = 0;
     set_signal(SIGTTIN, &saved_sigttin, SIG_IGN);
     set_signal(SIGTTOU, &saved_sigttou, SIG_IGN);
     set_signal(SIGTSTP, &saved_sigtstp, SIG_IGN);
@@ -405,19 +406,20 @@
                ispeed = cfgetispeed(&c->otio);
                ospeed = cfgetospeed(&c->otio);
 
-               c->otio.c_iflag = c->otio.c_lflag = 0;
-               c->otio.c_oflag = (ONLCR | OPOST);
-               c->otio.c_cflag = CREAD | CS8 | HUPCL | (c->otio.c_cflag & 
CLOCAL);
+               c->otio.c_iflag  = c->otio.c_lflag = 0;
+               c->otio.c_oflag  = (ONLCR | OPOST);
+               c->otio.c_oflag &= ~(OLCUC);
+               c->otio.c_cflag  = CREAD | CS8 | HUPCL | (c->otio.c_cflag & 
CLOCAL);
 
                cfsetispeed(&c->otio, ispeed);
                cfsetospeed(&c->otio, ospeed);
        } else {
                ioctl(fd, KDSETMODE, KD_TEXT);          /* Enforce text mode */
 
-               c->otio.c_iflag |= (ICRNL | IGNBRK);
+               c->otio.c_iflag |= (ICRNL | IXON);
                c->otio.c_iflag &= ~(INLCR | IGNCR | BRKINT);
                c->otio.c_oflag |= (ONLCR | OPOST);
-               c->otio.c_oflag &= ~(OCRNL | ONLRET);
+               c->otio.c_oflag &= ~(OCRNL | ONLRET | OLCUC);
        }
 
        (void)tcsetattr(c->fd, TCSADRAIN, &c->otio);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/showconsole-2.28/libconsole/console.c 
new/showconsole-2.32/libconsole/console.c
--- old/showconsole-2.28/libconsole/console.c   2023-11-29 13:17:01.000000000 
+0100
+++ new/showconsole-2.32/libconsole/console.c   2025-04-03 15:35:19.000000000 
+0200
@@ -1,7 +1,7 @@
 /*
  * console.c
  *
- * Copyright 2000,2015 Werner Fink, 2000 SuSE GmbH Nuernberg, Germany.
+ * Copyright 2000,2015,2025 Werner Fink, 2000 SuSE GmbH Nuernberg, Germany.
  * Copyright 2015 SuSE Linux GmbH.
  *
  * This source is free software; you can redistribute it and/or modify
@@ -23,6 +23,7 @@
 #include <string.h>
 #include <sys/epoll.h>
 #include <sys/ioctl.h>
+#include <sys/klog.h>
 #include <sys/mman.h>
 #include <sys/prctl.h>
 #include <sys/socket.h>
@@ -49,24 +50,35 @@
 # define _PATH_BLOG_FIFO       "/dev/blog"
 #endif
 
-#if defined(__s390__)
-# define RED   ""
-# define BOLD  ">> "
-# define NORM  ""
-#else
-# define RED   "\e[31m"
-# define BOLD  "\e[1m"
-# define NORM  "\e[m"
-#endif
+#define RED    "\e[31m"
+#define BOLD   "\e[1m"
+#define NORM   "\e[m"
+
+/* Disable printk's to console */
+#define SYSLOG_ACTION_CONSOLE_OFF      6
+/* Enable printk's to console */
+#define SYSLOG_ACTION_CONSOLE_ON       7
+/* Set level of messages printed to console */
+#define SYSLOG_ACTION_CONSOLE_LEVEL    8
+/* Return number of unread characters in the log buffer */
+#define SYSLOG_ACTION_SIZE_UNREAD      9
 
+/*
+ * Password/Passphrase is asked if true.
+ */
+volatile sig_atomic_t asking;
+
+/*
+ * Move log file to old file
+ */
 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.
  */
+static volatile char *_arg0;
 void remember_arg0(volatile char *arg0)
 {
     _arg0 = arg0;
@@ -123,10 +135,10 @@
        ssize_t p;
        if (issocket) {
            int flags = MSG_NOSIGNAL;
-            if (s > max)
+           if (s > max)
                flags |= MSG_MORE;
            p = send (fd, ptr, (max < 1) ? 1 : ((s < (size_t)max) ? s : 
(size_t)max), flags);
-        } else
+       } else
            p = write (fd, ptr, (max < 1) ? 1 : ((s < (size_t)max) ? s : 
(size_t)max));
        if (p < 0) {
            if (errno == EPIPE)
@@ -257,11 +269,20 @@
 }
 
 /*
- * Our transfer buffer
+ * Our transfer buffer from system console to the devices
  */
 static char trans[TRANS_BUFFER_SIZE];
 
 /*
+ * Our temporary buffer during asking a password/passphrase
+ */
+static      char temp[4*TRANS_BUFFER_SIZE];
+static const char *const tend = temp + sizeof(temp);
+static       char *     thead = temp;
+static       char *     ttail = temp;
+static volatile ssize_t tavail;
+
+/*
  * Prepare I/O
  */
 static const char *fifo_name = _PATH_BLOG_FIFO;
@@ -389,7 +410,10 @@
 
            ret = lstat("/var/log", &st);
            if (ret < 0) {
-               warn("can not get file status of /var/log");
+               if (errno != ENOENT)
+                   warn("can not get file status of /var/log: %m");
+               else
+                   atboot = 1;
                goto skip;
            }
            if ((st.st_mode & S_IFMT) == S_IFLNK) {
@@ -667,7 +691,7 @@
            if (strchr(fbuf, con_flags[n].name))
                flags |= con_flags[n].flag;
 
-       ret = asprintf(&tty, "/dev/char/%s", dev);
+       ret = asprintf(&tty, "/sys/dev/char/%s", dev);
        if (ret < 0)
            error("can not allocate string");
 
@@ -676,10 +700,39 @@
        if (!tty) {
            if (errno != ENOENT && errno != ENOTDIR)
                error("can not determine real path of %s", tmp);
-
+     fail:
            tty = charname(dev);
            if (!tty)
                error("can not determine real path of %s", tmp);
+       } else {
+           FILE *ue;
+           size_t len;
+           ssize_t nread;
+           char *line, *uevent;
+
+           ret = asprintf(&uevent, "%s/uevent", tty);
+           if (ret < 0)
+               error("can not allocate string");
+
+           ue = fopen(uevent, "r");
+           if (!ue)
+               goto fail;
+
+           line = NULL;
+           while ((nread = getline(&line, &len, ue)) != -1)  {
+               line[nread-1] = '\0';
+               if (strncmp(line, "DEVNAME=", 8) == 0) {
+                   ret = asprintf(&tty, "/dev/%s", line+8);
+                   if (ret < 0)
+                       error("can not allocate string");
+                   break;
+               }
+           }
+           free(line);
+           fclose(ue);
+
+           if (!tty)
+               goto fail;
        }
        free(tmp);
 
@@ -741,13 +794,52 @@
 
        parselog(trans, cnt);                           /* Parse and make copy 
of the input */
 
+       /*
+        * During asking a password/passphrase we are temporary
+        * buffer console output to release it if we've got an answer.
+        */
+       if (asking) {
+           if (cnt <= (size_t)(tend - ttail)) {
+               memcpy(ttail, trans, cnt);
+               tavail = (ttail += cnt) - thead;
+           }
+
+           goto flush;                                 /* Temporary silent as 
waiting on passphrase */
+
+       } else while (tavail > 0) {                     /* Empty temporary 
buffer if any */
+           size_t len = (size_t)tavail;
+
+           if (tavail > TRANS_BUFFER_SIZE)
+               len = TRANS_BUFFER_SIZE;
+
+           list_for_each_entry(c, &cons->node, node) {
+               if (c->fd < 0)
+                   continue;
+               safeout(c->fd, thead, len, c->max_canon);
+               (void)tcdrain(c->fd);                   /* Write copy of input 
to real tty */
+           }
+           thead += len;
+
+           if (thead >= ttail) {
+               ttail = thead = temp;
+               tavail = 0;
+               break;
+           }
+
+           if (thead > temp) {                         /* Buffer not empty, 
move contents */
+               tavail = ttail - thead;
+               thead = (char *)memmove(temp, thead, tavail);
+               ttail = thead + tavail;
+           }
+       }
+
        list_for_each_entry(c, &cons->node, node) {
            if (c->fd < 0)
                continue;
            safeout(c->fd, trans, cnt, c->max_canon);
            (void)tcdrain(c->fd);                       /* Write copy of input 
to real tty */
        }
-
+flush:
        flushlog();
     }
 }
@@ -1130,19 +1222,41 @@
 /*
  * Do handle the connection in data
  */
+char* currenttty;
 static void ask_for_password(void)
 {
     struct timespec timeout = {0, 50000000};
     siginfo_t status = {};
     sigset_t set = {};
     struct console *c;
-    int wait = 0;
+    int wait;
+    size_t len;
 
-    if (!pwprompt)
+    if (!pwprompt && !*pwprompt)
        return;
 
+    len = strlen(pwprompt);
+    len--;
+    if (pwprompt[len] == ' ') {
+       pwprompt[len] = '\0';
+       len--;
+    }
+    if (pwprompt[len] == ':') {
+       pwprompt[len] = '\0';
+       len--;
+    }
     set_signal(SIGCHLD, NULL, chld_handler);
 
+    wait = 200;
+    while (wait > 0 && (len = klogctl(SYSLOG_ACTION_SIZE_UNREAD, NULL, 0)) > 
0) {
+       usleep(1000);
+        wait--;
+    }
+    wait = 0;
+
+    asking = 1;                                /* Show only our question about 
password/passphrase */
+    klogctl(SYSLOG_ACTION_CONSOLE_OFF, NULL, 0);
+
     /* pwprompt */
     list_for_each_entry(c, &cons->node, node) {
 
@@ -1175,6 +1289,7 @@
            dup2(1, 2);
            dup2(c->fd, 0);
            dup2(c->fd, 1);
+           currenttty = c->tty;
 
            list_for_each_entry(d, &cons->node, node)
                if (d->fd >= 0) {
@@ -1203,12 +1318,19 @@
            dup2(fdc, 1);
            close(fdc);
 
+       again:
            clear_input(0);
-
+#if defined(__s390__)
+           if (major(c->dev) == 4 && minor(c->dev) >= 65)
+               len = asprintf(&message, BOLD RED "\n\r%s: " NORM, pwprompt);
+           else
+               len = asprintf(&message, "\n\r>> %s: ", pwprompt);
+#else
            if (c->flags & CON_SERIAL)
-               len = asprintf(&message, "\n\r%s: ", pwprompt);
+               len = asprintf(&message, BOLD RED "\n\r%s: " NORM, pwprompt);
            else
-               len = asprintf(&message, BOLD "\r%s: " NORM, pwprompt);
+               len = asprintf(&message, BOLD RED "\r%s: " NORM, pwprompt);
+#endif
            if (len < 0) {
                warn("can not set password prompt");
                _exit(1);
@@ -1232,6 +1354,9 @@
            tcsetattr(0, TCSANOW, &c->ctio);
            safeout(1, "\n", 1, c->max_canon);
 
+            if (*pwsize == 0)
+                goto again;
+
            if (*pwsize < 0)
                warn("can not read password");
 
@@ -1240,47 +1365,52 @@
        }
     }
 
-    do {                                       /* Wait on any job if any */
+    do {                               /* Wait on any job if any */
        int ret;
 
        status.si_pid = 0;
        ret = waitid(P_ALL, 0, &status, WEXITED);
 
        if (ret == 0)
-               break;
+           break;
 
        if (ret < 0) {
            if (errno == ECHILD)
                break;
            if (errno == EINTR)
                continue;
+           error("can not wait on password asking process: %m");
+           break;
        }
 
-       error("can not wait on password asking process");
-
     } while (1);
 
+    asking = 0;                                /* Now throw out any collected 
messages if any */
+    klogctl(SYSLOG_ACTION_CONSOLE_ON, NULL, 0);
+
     list_for_each_entry(c, &cons->node, node) {
        if (c->fd < 0)
            continue;
        if (c->pid < 0)
            continue;
-       if (c->pid == status.si_pid)            /* Remove first reply ... */
+       if (c->pid == status.si_pid)    /* Remove first reply ... */
            c->pid = -1;
        else {
-           kill(c->pid, SIGTERM);              /* and terminate the others */
+           kill(c->pid, SIGTERM);      /* and terminate the others */
            wait++;
        }
     }
 
     sigemptyset(&set);
-    sigaddset(&set, SIGCHLD);                  /* On exit we'll see SIGCHLD */
+    sigaddset(&set, SIGCHLD);          /* On exit we'll see SIGCHLD */
 
     do {
        int signum, ret;
 
-       if (!wait)
+       if (wait <= 0) {
+           asking = 0;                 /* Now throw out any collected messages 
if any */
            break;
+       }
 
        status.si_pid = 0;
        ret = waitid(P_ALL, 0, &status, WEXITED|WNOHANG);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/showconsole-2.28/libconsole/devices.c 
new/showconsole-2.32/libconsole/devices.c
--- old/showconsole-2.28/libconsole/devices.c   2023-11-29 13:17:01.000000000 
+0100
+++ new/showconsole-2.32/libconsole/devices.c   2025-04-03 15:35:19.000000000 
+0200
@@ -36,9 +36,18 @@
        error("can not scan %s", str);
     dev = makedev(maj, min);
 
-    dir = opendir("/dev");
-    if (!dir)
-        error("can not open /dev");
+#if defined(__s390__)
+    if (maj == 227) {
+       dir = opendir("/dev/3270");
+       if (!dir)
+           error("can not open /dev/3270");
+    } else
+#endif
+    {
+       dir = opendir("/dev");
+       if (!dir)
+           error("can not open /dev");
+    }
 
     fd = dirfd(dir);
     rewinddir(dir);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/showconsole-2.28/libconsole/libconsole.h 
new/showconsole-2.32/libconsole/libconsole.h
--- old/showconsole-2.28/libconsole/libconsole.h        2023-11-29 
13:17:01.000000000 +0100
+++ new/showconsole-2.32/libconsole/libconsole.h        2025-04-03 
15:35:19.000000000 +0200
@@ -113,7 +113,7 @@
 #define CON_BOOT       (8)
 #define CON_ANYTIME    (16) /* Safe to call when cpu is offline */
 #define CON_BRL                (32) /* Used for a braille device */
-#define CON_SERIAL     (64) /* serial line */
+#define CON_SERIAL     (64) /* Serial line */
 
 extern sigset_t omask;
 extern int final;
@@ -121,6 +121,7 @@
 extern int evmax;
 extern volatile sig_atomic_t signaled;
 extern volatile sig_atomic_t nsigsys;
+extern volatile sig_atomic_t asking;
 
 extern void remember_arg0(volatile char *arg0);
 extern ssize_t safein (int fd, void *ptr, size_t s);
@@ -233,17 +234,18 @@
     /* Sane setting, allow eight bit characters, no carriage return delay
      * the same result as `stty sane cr0 pass8'
      */
-    tp->c_iflag |=  (BRKINT | ICRNL | IMAXBEL);
-    tp->c_iflag &= ~(IGNBRK | INLCR | IGNCR | IXOFF | IUCLC | IXANY | ISTRIP);
+    tp->c_iflag |=  (ICRNL | IXON);
+    tp->c_iflag &= ~(IGNBRK | BRKINT | IGNPAR | PARMRK | INPCK | ISTRIP| \
+                    INLCR | IGNCR | IXOFF | IUCLC | IXANY | IMAXBEL);
     tp->c_oflag |=  (OPOST | ONLCR | NL0 | CR0 | TAB0 | BS0 | VT0 | FF0);
     tp->c_oflag &= ~(OLCUC | OCRNL | ONOCR | ONLRET | OFILL | \
-                   NLDLY|CRDLY|TABDLY|BSDLY|VTDLY|FFDLY);
-    tp->c_lflag |=  (ISIG | ICANON | IEXTEN | ECHO|ECHOE|ECHOK|ECHOKE|ECHOCTL);
-    tp->c_lflag &= ~(ECHONL|ECHOPRT | NOFLSH | TOSTOP);
+                    NLDLY|CRDLY|TABDLY|BSDLY|VTDLY|FFDLY);
+    tp->c_lflag |=  (ISIG | ICANON | IEXTEN | ECHO|ECHOE|ECHOK|ECHOKE);
+    tp->c_lflag &= ~(ECHONL|ECHOPRT | NOFLSH | TOSTOP | FLUSHO | EXTPROC | 
ECHOCTL);
 
     if ((flags & UL_TTY_KEEPCFLAGS) == 0) {
        tp->c_cflag |=  (CREAD | CS8 | HUPCL);
-       tp->c_cflag &= ~(PARODD | PARENB);
+       tp->c_cflag &= ~(PARODD | PARENB | CMSPAR | CLOCAL | CRTSCTS);
     }
 #ifdef OFDEL
     tp->c_oflag &= ~OFDEL;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/showconsole-2.28/libconsole/log.c 
new/showconsole-2.32/libconsole/log.c
--- old/showconsole-2.28/libconsole/log.c       2023-11-29 13:17:01.000000000 
+0100
+++ new/showconsole-2.32/libconsole/log.c       2025-04-03 15:35:19.000000000 
+0200
@@ -218,28 +218,46 @@
        ESpalette };
 #define NPAR 16
 static unsigned int state = ESnormal;
-static int npar, nl;
-static unsigned long int line;
+static int npar, nl, cr;
 
 /*
  * Workaround for spinner of fsck/e2fsck
  * Uses ascii lines ending with '\r' only
  */
 static int spin;
-#define PROGLEN 192
-static unsigned char prog[PROGLEN];
 
 void parselog(const char *buf, const size_t s)
 {
     int c;
     ssize_t r = s, up;
     unsigned char uprt[16];
+    static int follow;
 
     lock(&llock);
 
     while (r > 0) {
        c = (unsigned char)*buf;
 
+       /* Check for first byte of a UTF-8 multibyte sequence */
+       if (!follow) {
+           if ((c & 0xe0) == 0xc0) {
+               follow = 1;
+           } else if ((c & 0xf0) == 0xe0) {
+               follow = 2;
+           } else if ((c & 0xf8) == 0xf0) {
+               follow = 3;
+           } else if ((c & 0xfc) == 0xf8) {
+               follow = 4;
+           } else if ((c & 0xfe) == 0xfc) {
+               follow = 5;
+           } else {
+               /* invalid */
+               follow = 0;
+           }
+       }
+
+       nl = 0;
+
        switch(state) {
        case ESnormal:
        default:
@@ -249,27 +267,26 @@
            case 16 ... 23:
            case 25:
            case 28 ... 31:
-               nl = 0;
-               spin = 0;
+               follow = 0;
                addlog('^'); addlog(c + 64);
                break;
            case '\n':
-               if (spin > 4)   /* last spinner line */
-                   storelog((char*)prog, strlen((char*)prog));
                nl = 1;
-               line++;
-               spin = 0;
+               follow = 0;
+               cr = spin = 0;
                addlog(c);
                break;
            case '\r':
-               spin++;
-               if (spin < 5) {
-                   if (spin > 1)
-                       addlog('\n');
-                   nl = 1;
+               follow = 0;
+               if (cr++ > 0)
+               {
+                   spin++;
+#if 0
+                   storelog(">spin", 5);
+                   addlog(48+spin);
+                   addlog('<');
+#endif
                }
-               if (spin == 5)
-                   storelog("\n<progress bar skipped>\n", 24);
                break;
            case 14:
            case 15:
@@ -277,57 +294,51 @@
                 * on console \033[10m and \033[11m is used */
            case 24:
            case 26:
-               spin = 0;
+               follow = 0;
                break;
            case '\033':
-               spin = 0;
+               follow = 0;
                state = ESesc;
                break;
            case '\t':
            case  32 ... 126:
+               addlog(c);
+               follow = 0;
+               break;
            case 160 ... 255:
-               if (spin < 5) {
-                   if (spin == 1 && nl)
-                       addlog('\n');
+               if (follow) {
+                   if ((c & 0xc0) == 0x80)
+                       follow--;
                    addlog(c);
-               } else {                /* Seems to be a lengthy spinner line */
-                   static   int old = 0;
-                   static ssize_t p = 0;
-                   if (old != spin) {
-                       old = spin;     /* Next line overwrite on tty */
-                       p = 0;
-                       bzero(prog, PROGLEN);
-                   }
-                   if (p < PROGLEN)
-                       prog[p++] = c;  /* buffer always current line */
+                   break;
                }
-               nl = 0;
+               if ((up = snprintf((char*)uprt, sizeof(uprt), "\\%03o", c)) > 0)
+                   storelog((char*)uprt, (size_t)up);
                break;
            case 127:
-               nl = 0;
-               spin = 0;
+               follow = 0;
                addlog('^'); addlog('?');
                break;
-           case 128 ... 128+26:
-           case 128+28 ... 159:
-               nl = 0;
-               spin = 0;
+           case 128 ... 159:
+               if (follow) {
+                   if ((c & 0xc0) == 0x80)
+                       follow--;
+                   addlog(c);
+                   break;
+               }
                if ((up = snprintf((char*)uprt, sizeof(uprt), "\\%03o", c)) > 0)
                    storelog((char*)uprt, (size_t)up);
                break;
-           case 128+27:
-               spin = 0;
-               state = ESsquare;
-               break;
            default:
-               nl = 0;
-               spin = 0;
+               cr = 0;
+               follow = 0;
                if ((up = snprintf((char*)uprt, sizeof(uprt), "0x%X", c)) > 0)
                    storelog((char*)uprt, (size_t)up);
                break;
            }
            break;
        case ESesc:
+           follow = 0;
            state = ESnormal;
            switch((unsigned char)c) {
            case '[':
@@ -341,12 +352,8 @@
                break;
            case 'E':
            case 'D':
-               if (spin > 4)   /* last spinner line */
-                   storelog((char*)prog, strlen((char*)prog));
-               nl = 1;
-               line++;
-               spin = 0;
                addlog('\n');
+               nl = 1;
                break;
            case '(':
                state = ESsetG0;
@@ -367,6 +374,7 @@
            }
            break;
        case ESnonstd:
+           follow = 0;
            if        (c == 'P') {
                npar = 0;
                state = ESpalette;
@@ -376,6 +384,7 @@
                state = ESnormal;
            break;
        case ESpalette:
+           follow = 0;
            if ((c>='0'&&c<='9') || (c>='A'&&c<='F') || (c>='a'&&c<='f')) {
                npar++;
                if (npar==7)
@@ -384,15 +393,21 @@
                state = ESnormal;
            break;
        case ESsquare:
+           follow = 0;
            npar = 0;
            state = ESgetpars;
            if (c == '[') {
                state = ESfunckey;
                break;
            }
+#if 0
+           if (c == 'K')
+               storelog(" el ", 4);
+#endif
            if (c == '?')
                break;
        case ESgetpars:
+           follow = 0;
            if (c==';' && npar<NPAR-1) {
                npar++;
                break;
@@ -401,19 +416,23 @@
            } else
                state = ESgotpars;
        case ESgotpars:
+           follow = 0;
            state = ESnormal;
            break;
        case ESpercent:
+           follow = 0;
            state = ESnormal;
            break;
        case ESfunckey:
        case EShash:
        case ESsetG0:
        case ESsetG1:
+           follow = 0;
            state = ESnormal;
            break;
 #ifdef BLOGD_EXT
        case ESignore:                          /* Boot log extension */
+           follow = 0;
            state = ESesc;
            {
                unsigned char echo[64];
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/showconsole-2.28/libconsole/readpw.c 
new/showconsole-2.32/libconsole/readpw.c
--- old/showconsole-2.28/libconsole/readpw.c    2023-11-29 13:17:01.000000000 
+0100
+++ new/showconsole-2.32/libconsole/readpw.c    2025-04-03 15:35:19.000000000 
+0200
@@ -24,6 +24,15 @@
     int capslock;      /* upper case without lower case */
 };
 
+static inline void wput(int fd, char c)
+{
+    int ret;
+    do {
+       ret = write(fd, &c, 1);
+    } while (ret < 0 && errno == EINTR);
+}
+
+extern char* currenttty;
 ssize_t readpw(int fd, char *pass, int eightbit)
 {
     char *ptr = pass;
@@ -34,6 +43,7 @@
 
     while (cp.eol == '\0') {
        char ascval, c;
+       errno = 0;
 
        ret = read(fd, &c, 1);
        if (ret < 0) {
@@ -42,14 +52,12 @@
                continue;
            }
            switch (errno) {
-           case 0:
            case EIO:
-           case ESRCH:
-           case EINVAL:
-           case ENOENT:
-               break;
+               /* Not as in sulogin of util-linux we do nothing here */
            default:
-               warn("cannot read passphrase");
+               warn("cannot read passphrase on %s: %m", currenttty);
+               break;
+           case 0:
                break;
            }
            return -1;
@@ -78,13 +86,17 @@
        case BS:
        case CERASE:
            cp.erase = ascval;
-           if (ptr > pass)
+           if (ptr > pass) {
                ptr--;
+               wput(fd, BS);
+           }
            break;
        case CKILL:
            cp.kill = ascval;
-           while (ptr > pass)
+           while (ptr > pass) {
                ptr--;
+               wput(fd, BS);
+           }
            break;
        case CEOF:
            return 0;
@@ -94,6 +106,7 @@
                return -1;
            }
            *ptr++ = ascval;
+           wput(fd, '*');
            break;
        }
     }

Reply via email to