[Pkg-rust-maintainers] Bug#1134488: /usr/bin/batcat: batcat color don't play nice with heredoc syntax

Wesley Schwengle wesley at schwengle.net
Mon Apr 20 20:53:41 BST 2026


Package: bat
Version: 0.26.1+dfsg-1+b1
Severity: important
File: /usr/bin/batcat
X-Debbugs-Cc: wesley at schwengle.net

Dear Maintainer,

batcat claims to be a drop-in replacement for cat. That may be true, but it
acts really weird in some cases where you don't want this to happen:

$ which cat
cat: aliased to batcat
$ cat > foo.xml  <<'OEF'
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
  <debug-overrides>
    <trust-anchors>
      <certificates src="@raw/opndev_ca" />
      <certificates src="system" />
    </trust-anchors>
  </debug-overrides>
</network-security-config>
OEF

$ command cat foo.xml | od | head -10
0000000 055433 034063 031073 034473 035464 031061 035471 033461
0000020 066462 037474 055433 066460 055433 034063 031073 034473
0000040 035464 031061 035471 033461 066462 066570 015554 030133
0000060 015555 031533 035470 035462 031462 035466 031462 035471
0000100 032062 066464 015440 030133 015555 031533 035470 035462
0000120 032061 035463 034061 035470 034061 066467 062566 071562
0000140 067551 015556 030133 015555 031533 035470 035462 031462
0000160 035466 031462 035471 032062 066464 015475 030133 015555
0000200 031533 035470 035462 033061 035463 034461 035460 032061
0000220 066460 015442 030133 015555 031533 035470 035462 033061

$ file foo.xml
foo.xml: ASCII text, with very long lines (380), with escape sequences


$ command cat foo.xml | head -10
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
  <debug-overrides>
    <trust-anchors>
      <certificates src="@raw/opndev_ca" />
      <certificates src="system" />
    </trust-anchors>
  </debug-overrides>
</network-security-config>

$ command cat foo.xml | od | head -10
0000000 037474 066570 020154 062566 071562 067551 036556 030442
0000020 030056 020042 067145 067543 064544 063556 021075 072165
0000040 026546 021070 037077 036012 062556 073564 071157 026553
0000060 062563 072543 064562 074564 061455 067157 064546 037147
0000100 020012 036040 062544 072542 026547 073157 071145 064562
0000120 062544 037163 020012 020040 036040 071164 071565 026564
0000140 067141 064143 071157 037163 020012 020040 020040 036040
0000160 062543 072162 063151 061551 072141 071545 071440 061562
0000200 021075 071100 073541 067457 067160 062544 057566 060543
0000220 020042 037057 020012 020040 020040 036040 062543 072162

$ file foo.xml
foo.xml: XML 1.0 document, ASCII text

I consider this a bug, as this should be standard behaviour from cat that is
breaking assumptions with batcat.

Cheers,
Wesley


-- System Information:
Debian Release: forky/sid
  APT prefers unstable
  APT policy: (900, 'unstable'), (500, 'testing'), (100, 'experimental'), (10, 'stable-updates'), (10, 'stable-security'), (10, 'oldstable-updates'), (10, 'oldstable-security'), (10, 'oldoldstable'), (10, 'stable'), (10, 'oldstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.19.11+deb14-amd64 (SMP w/8 CPU threads; PREEMPT)
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages bat depends on:
ii  libc6        2.42-14
ii  libgcc-s1    16-20260322-1
ii  libgit2-1.9  1.9.2+ds-6
ii  libonig5     6.9.10-1

bat recommends no packages.

bat suggests no packages.

-- no debconf information



More information about the Pkg-rust-maintainers mailing list