astring.strip_console_codes raises error on recent kernel messages
Opened this issue · 1 comments
smitterl commented
Applying the strip_console_codes to the output of a recent (rescue) kernel "6.10.0-15" boot messages, a test error is raised:
ERROR: c is not included in the known console codes list %[G@8]|\[[@A-HJ-MPXa-hl-nqrsu\`]|\[[\d;]+[HJKgqnrm]|#8|\([B0UK]|\)|\[\?2004[lh]
The location that hits this is after the 'read-only' in
[ 0.527428] systemd[1]: Successfully made /usr/ read-only.
^[c^[[!p^[]104^G^[[?7h[ 0.527576] systemd[1]: systemd 256-11<cut> running in system mode (+PAM +AUDIT +SELINUX -APPARMOR +IMA +SMACK +SECCOMP -GCRYPT -GNUTLS +OPENSSL +ACL +BLKID +CURL +ELFUTILS +FIDO2 +IDN2 -IDN -IPTC +KMOD +LIBCRYPTSETUP +LIBCRYPTSETUP_PLUGINS +LIBFDISK +PCRE2 +PWQUALITY +P11KIT -QRENCODE +TPM2 +BZIP2 +LZ4 +XZ +ZLIB +ZSTD +BPF_FRAMEWORK +XKBCOMMON +UTMP +SYSVINIT +LIBARCHIVE)
The tmp_word at this point is:
2024-08-07 09:57:07,684 astring L0052 DEBUG| tmp_word: ^[
2024-08-07 09:57:07,684 astring L0052 DEBUG| tmp_word: ^[c
2024-08-07 09:57:07,684 astring L0052 DEBUG| tmp_word: ^[c^[
2024-08-07 09:57:07,684 astring L0056 DEBUG| tmp_word: c
before it's recognized as unknown word.
IIUC "ESC c" is used to clear the console and in python this ESC is \x1b
displayed as ^[
. https://man7.org/linux/man-pages/man4/console_codes.4.html
smitterl commented
It looks to me the sequences are:
ESC c: terminal reset
ESC !p: terminal reset
ESC ]: introduces an OS command
I don't have details about the OS command 104.
Ref. https://gist.github.com/justinmk/a5102f9a0c1810437885a04a07ef0a91