Skip to content

astring.strip_console_codes raises error on recent kernel messages #133

@smitterl

Description

@smitterl

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions