Subject: bug#57821: 29.0.50; ANSI sequence not filtered in compilation buffer

From: Matthias Meulien <[email-masked]>
Date: Thu, 15 Sep 2022 10:24:15 +0200

Under the hypothesis of a host with Python installed with poetry,
pre-commit tooling and flatpak builder:

1. Start 'emacs -Q'

2. Clone the Git repository https://github.com/orontee/argos and install
   pre-commit hooks as described in the CONTRIBUTING guide

3. Visit a file in the directory containing the cloned repository

3. C-x p c poetry run pre-commit run -a RET

4. Rename buffer (C-x x u)

5. C-x p c flatpak-builder --user --install --force-clean builddir
   io.github.orontee.Argos.json

Observe that the first compilationbuffer doesn't show any ANSI sequences
but the second displays many ^G^[ char sequences:

With `ansi-color-compilation-filter' added to `compilation-filter-hook',
the situation is the same:

Again same situation when running both commands from a shell buffer.

But with `comint-osc-process-output' added to
`comint-output-filter-functions' then everything looks good.  It seems
that flatpak-builder outputs OSC sequences and ANSI sequences.

Is there a way to filter out (or render) OSC sequences from compilation
output buffers as is possible for comint output?

In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, cairo version
 1.16.0) of 2022-09-14 built on carbon
Repository revision: f0798ac13dcb4c01a883f165e03c3cd7f208667c
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Debian GNU/Linux 11 (bullseye)

Configured using:
 'configure --with-native-compilation --with-x-toolkit=no'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES
NATIVE_COMP NOTIFY INOTIFY OLDXMENU PDUMPER PNG RSVG SECCOMP SOUND
SQLITE3 THREADS TIFF WEBP X11 XDBE XIM XINPUT2 XPM ZLIB

Important settings:
  value of $LANG: fr_FR.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Bookmark Menu

Minor modes in effect:
  shell-dirtrack-mode: t
  hl-line-mode: t
  header-line-indent-mode: t
  highlight-changes-visible-mode: t
  minions-mode: t
  global-company-mode: t
  company-mode: t
  desktop-save-mode: t
  pixel-scroll-precision-mode: t
  save-place-mode: t
  electric-pair-mode: t
  icomplete-mode: t
  global-so-long-mode: t
  global-auto-revert-mode: t
  auto-insert-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-layout-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tab-bar-mode: t
  file-name-shadow-mode: t
  context-menu-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  window-divider-mode: t
  buffer-read-only: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/home/matthias/.config/emacs/elpa/dictionary-20201001.1727/dictionary hides /usr/local/share/emacs/29.0.50/lisp/net/dictionary

Features:
(shadow sort gnus-cite mail-extr emacsbug cl-print gnus-async qp gnus-ml
disp-table gnus-topic nndraft nnmh nnfolder utf-7 epa-file gnus-agent
gnus-srvr gnus-score score-mode nnvirtual gnus-msg gnus-cache generic po
pcmpl-unix sh-script executable git-link meson-mode smie shell pulse
files-x grep rng-xsd xsd-regexp rng-cmpct rng-nxml rng-valid nxml-mode
nxml-outln nxml-rap sgml-mode facemenu shortdoc help-fns radix-tree
hideshow cap-words superword subword js restclient ox-odt rng-loc
rng-uri rng-parse rng-match rng-dt rng-util rng-pttrn nxml-parse nxml-ns
nxml-enc xmltok nxml-util ox-latex ox-icalendar org-agenda ox-html table
ox-ascii ox-publish ox org-element avl-tree ol-eww ol-rmail ol-mhe
ol-irc ol-info ol-gnus nnselect gnus-art mm-uu mml2015 mm-view mml-smime
smime dig ol-docview doc-view jka-compr ol-bibtex ol-bbdb ol-w3m ol-doi
org-link-doi mm-archive mule-util gnutls network-stream url-cache
url-http url-auth url-gw nsm finder-inf misearch multi-isearch
emacs-news-mode image-dired image-dired-tags image-dired-external
image-dired-util wallpaper image-mode exif gnus-sum man eww xdg
url-queue shr pixel-fill kinsoku url-file svg dom mm-url hl-line dabbrev
log-edit add-log smerge-mode diff whitespace display-line-numbers
hilit-chg dired-aux flyspell goto-addr rst vc-hg vc-bzr vc-src vc-sccs
vc-svn vc-cvs vc-rcs log-view pcvs-util vc-dir vc go-mode ffap eglot
array jsonrpc ert ewoc debug backtrace flymake-proc flymake compile
imenu company-oddmuse company-keywords company-etags etags fileloop
generator xref company-gtags company-dabbrev-code company-dabbrev
company-files company-clang company-capf company-cmake company-semantic
company-template company-bbdb ob-python python project minions compat
company pcase carbon-custom cus-edit cus-load gnus-demon nntp gnus-group
gnus-undo gnus-start gnus-dbus dbus xml gnus-cloud nnimap nnmail
mail-source utf7 parse-time gnus-spec gnus-win nnoo gnus-int gnus-range
message sendmail yank-media puny rfc822 mml mml-sec epa derived epg
rfc6068 epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231
rfc2047 rfc2045 ietf-drums mailabbrev gmm-utils mailheader gnus nnheader
gnus-util mail-utils range mm-util mail-prsvr wid-edit gnus-dired
dired-x dired dired-loaddefs org-capture org-refile org ob ob-tangle
ob-ref ob-lob ob-table ob-exp org-macro org-footnote org-src ob-comint
org-pcomplete pcomplete comint ansi-color org-list org-faces
org-entities org-version ob-emacs-lisp ob-core ob-eval org-table
oc-basic bibtex iso8601 ol org-keys oc org-compat org-macs org-loaddefs
format-spec find-func cal-menu calendar cal-loaddefs dictionary link
connection advice markdown-mode color thingatpt noutline outline
skeleton find-file vc-git diff-mode easy-mmode vc-dispatcher ispell
time-date comp comp-cstr warnings icons rx cl-extra help-mode desktop
frameset server bookmark text-property-search pp pixel-scroll cua-base
ring saveplace elec-pair icomplete so-long autorevert filenotify
autoinsert cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align
cc-engine cc-vars cc-defs generic-x face-remap
graphviz-dot-mode-autoloads lsp-pyright-autoloads lsp-mode-autoloads
ht-autoloads f-autoloads lv-autoloads proof-site proof-autoloads
s-autoloads spinner-autoloads info yaml-autoloads package browse-url url
url-proxy url-privacy url-expand url-methods url-history url-cookie
generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs password-cache json subr-x
map byte-opt gv bytecomp byte-compile cconv url-vars cl-loaddefs cl-lib
rmc iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq
simple cl-generic indonesian philippine cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite emoji-zwj charscript charprop case-table
epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button
loaddefs faces cus-face macroexp files window text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting cairo xinput2 x
multi-tty make-network-process native-compile emacs)

Memory information:
((conses 16 949696 128038)
 (symbols 48 46759 4)
 (strings 32 251243 27013)
 (string-bytes 1 10003438)
 (vectors 16 97565)
 (vector-slots 8 2088345 194542)
 (floats 8 651 694)
 (intervals 56 24377 3352)
 (buffers 1000 98))

-- 
Matthias