Manpage displays garbled characters

This isn't a help request rather a solution to a new issue that updating your system brings.

The latest update displays garbled characters while reading any man page the reason being bat is not receiving the expected format to color the output. The output being something akin to this

example of erroneous output
4mPACMAN24m(8)                                      Pacman Manual                                      4mPACMAN24m(8)

1mNAME0m
pacman - package manager utility

1mSYNOPSIS0m
4mpacman24m <operation> [options] [targets]

1mDESCRIPTION0m
Pacman is a package management utility that tracks installed packages on a Linux system. It features
dependency support, package groups, install and uninstall scripts, and the ability to sync your
local machine with a remote repository to automatically upgrade packages. Pacman packages are a
zipped tar format.

Since version 3.0.0, pacman has been the front-end to 1mlibalpm22m(3), the “Arch Linux Package
Management” library. This library allows alternative front-ends to be written (for instance, a GUI
front-end).

Invoking pacman involves specifying an operation with any potential options and targets to operate
on. A 4mtarget24m is usually a package name, file name, URL, or a search string. Targets can be provided
as command line arguments. Additionally, if stdin is not from a terminal and a single hyphen (-) is
passed as an argument, targets will be read from stdin.

There are two simple solutions for this.

  1. Either stop using bat to color the output and let man page use it's default less instead. This can be done via editing the ~/.config/fish/config.fish file and changing
set -x MANPAGER "sh -c 'col -bx | bat -l man -p'"

line to

# set -x MANPAGER "sh -c 'col -bx | bat -l man -p'"

notice the '#' before the line it's to comment out the line. Now save the changes and open a new terminal and check if the changes have been applied.

  1. Another method, a hacky workaround that let's us use bat to color the output while disabling bold highlighting is to add
set -x MANROFFOPT "-c"

at the top of ~/.config/fish/config.fish it would look something like this with the line added.

set fish_greeting
set VIRTUAL_ENV_DISABLE_PROMPT "1"
set -x MANROFFOPT "-c"
set -x MANPAGER "sh -c 'col -bx | bat -l man -p'"
set -x SHELL /bin/fish

then save and exit. Now open a new terminal and check if the issue has been resolved.
Please note this workaround was reported here and doesn't seem to work for everyone.

My inxi so that SGS doesn't move it to 412 Precondition Failed :sweat_smile:

inxi
System:
  Kernel: 6.4.2-zen1-1-zen arch: x86_64 bits: 64 compiler: gcc v: 13.1.1
    parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-zen
    root=UUID=6a7bcee6-f3ae-4c03-b6b0-7cb27fb4c8d4 rw rootflags=subvol=@
    quiet quiet splash rd.udev.log_priority=3 vt.global_cursor_default=0
    resume=UUID=1b9b6f2d-a19b-4eee-b2bf-6af31dfdf566 loglevel=3
  Desktop: KDE Plasma v: 5.27.6 tk: Qt v: 5.15.10 wm: kwin_x11 vt: 2
    dm: SDDM Distro: Garuda Linux base: Arch Linux
Machine:
  Type: Convertible System: LENOVO product: 81X1 v: IdeaPad Flex 5 14IIL05
    serial: <superuser required> Chassis: type: 31 v: IdeaPad Flex 5 14IIL05
    serial: <superuser required>
  Mobo: LENOVO model: LNVNB161216 v: SDK0Q55722 WIN
    serial: <superuser required> UEFI: LENOVO v: ECCN41WW date: 06/27/2022
Battery:
  ID-1: BAT0 charge: 8.9 Wh (20.5%) condition: 43.5/52.6 Wh (82.5%)
    volts: 10.9 min: 11.5 model: Sunwoda L19D3PD6 type: Li-poly serial: <filter>
    status: discharging cycles: 1694
CPU:
  Info: model: Intel Core i7-1065G7 bits: 64 type: MT MCP arch: Ice Lake
    gen: core 10 level: v4 note: check built: 2019-21 process: Intel 10nm
    family: 6 model-id: 0x7E (126) stepping: 5 microcode: 0xBA
  Topology: cpus: 1x cores: 4 tpc: 2 threads: 8 smt: enabled cache:
    L1: 320 KiB desc: d-4x48 KiB; i-4x32 KiB L2: 2 MiB desc: 4x512 KiB L3: 8 MiB
    desc: 1x8 MiB
  Speed (MHz): avg: 1437 high: 1500 min/max: 400/3900 scaling:
    driver: intel_pstate governor: powersave cores: 1: 1500 2: 1500 3: 1000
    4: 1500 5: 1500 6: 1500 7: 1500 8: 1500 bogomips: 23961
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
  Vulnerabilities: <filter>
Graphics:
  Device-1: Intel Iris Plus Graphics G7 vendor: Lenovo driver: i915 v: kernel
    arch: Gen-11 process: Intel 10nm built: 2019-21 ports: active: eDP-1
    empty: DP-1, DP-2, DP-3, HDMI-A-1 bus-ID: 00:02.0 chip-ID: 8086:8a52
    class-ID: 0300
  Device-2: NVIDIA GP108M [GeForce MX330] vendor: Lenovo driver: nvidia
    v: 535.54.03 alternate: nouveau,nvidia_drm non-free: 530.xx+
    status: current (as of 2023-05) arch: Pascal code: GP10x
    process: TSMC 16nm built: 2016-21 pcie: gen: 1 speed: 2.5 GT/s lanes: 4
    link-max: gen: 3 speed: 8 GT/s bus-ID: 01:00.0 chip-ID: 10de:1d16
    class-ID: 0302
  Device-3: Bison Integrated Camera driver: uvcvideo type: USB rev: 2.0
    speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 3-2:2 chip-ID: 5986:212a
    class-ID: 0e02
  Display: x11 server: X.Org v: 21.1.8 with: Xwayland v: 23.1.2
    compositor: kwin_x11 driver: X: loaded: modesetting,nvidia unloaded: nouveau
    alternate: fbdev,intel,nv,vesa dri: iris gpu: i915 display-ID: :0
    screens: 1
  Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x285mm (20.00x11.22")
    s-diag: 582mm (22.93")
  Monitor-1: eDP-1 model: ChiMei InnoLux 0x1406 built: 2019 res: 1920x1080
    hz: 60 dpi: 158 gamma: 1.2 size: 309x173mm (12.17x6.81") diag: 354mm (13.9")
    ratio: 16:9 modes: 1920x1080
  API: OpenGL v: 4.6 Mesa 23.1.3 renderer: Mesa Intel Iris Plus Graphics
    (ICL GT2) direct-render: Yes
Audio:
  Device-1: Intel Ice Lake-LP Smart Sound Audio vendor: Lenovo
    driver: sof-audio-pci-intel-icl
    alternate: snd_hda_intel,snd_sof_pci_intel_icl bus-ID: 00:1f.3
    chip-ID: 8086:34c8 class-ID: 0401
  API: ALSA v: k6.4.2-zen1-1-zen status: kernel-api tools: N/A
  Server-1: PipeWire v: 0.3.73 status: active with: 1: pipewire-pulse
    status: active 2: wireplumber status: active 3: pipewire-alsa type: plugin
    4: pw-jack type: plugin tools: pactl,pw-cat,pw-cli,wpctl
Network:
  Device-1: Intel Ice Lake-LP PCH CNVi WiFi driver: iwlwifi v: kernel
    bus-ID: 00:14.3 chip-ID: 8086:34f0 class-ID: 0280
  IF: wlp0s20f3 state: up mac: <filter>
  IF-ID-1: docker0 state: down mac: <filter>
  IF-ID-2: vboxnet0 state: down mac: <filter>
Bluetooth:
  Device-1: Intel AX201 Bluetooth driver: btusb v: 0.8 type: USB rev: 2.0
    speed: 12 Mb/s lanes: 1 mode: 1.1 bus-ID: 3-10:4 chip-ID: 8087:0026
    class-ID: e001
  Report: bt-adapter ID: hci0 rfk-id: 7 state: down
    bt-service: enabled,running rfk-block: hardware: no software: yes
    address: <filter>
Drives:
  Local Storage: total: 476.94 GiB used: 137.49 GiB (28.8%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Samsung
    model: MZALQ512HALU-000L2 size: 476.94 GiB block-size: physical: 512 B
    logical: 512 B speed: 31.6 Gb/s lanes: 4 tech: SSD serial: <filter>
    fw-rev: 3L1QFXV7 temp: 26.9 C scheme: GPT
Partition:
  ID-1: / raw-size: 459.82 GiB size: 459.82 GiB (100.00%)
    used: 137.49 GiB (29.9%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
  ID-2: /boot/efi raw-size: 300 MiB size: 299.4 MiB (99.80%)
    used: 576 KiB (0.2%) fs: vfat dev: /dev/nvme0n1p1 maj-min: 259:1
  ID-3: /home raw-size: 459.82 GiB size: 459.82 GiB (100.00%)
    used: 137.49 GiB (29.9%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
  ID-4: /var/log raw-size: 459.82 GiB size: 459.82 GiB (100.00%)
    used: 137.49 GiB (29.9%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
  ID-5: /var/tmp raw-size: 459.82 GiB size: 459.82 GiB (100.00%)
    used: 137.49 GiB (29.9%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
Swap:
  Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default)
  ID-1: swap-1 type: zram size: 15.29 GiB used: 881.8 MiB (5.6%)
    priority: 100 dev: /dev/zram0
  ID-2: swap-2 type: partition size: 16.82 GiB used: 0 KiB (0.0%)
    priority: -2 dev: /dev/nvme0n1p3 maj-min: 259:3
Sensors:
  System Temperatures: cpu: 49.0 C mobo: N/A
  Fan Speeds (RPM): N/A
Info:
  Processes: 317 Uptime: 13h 6m wakeups: 65082 Memory: available: 15.29 GiB
  used: 7.34 GiB (48.0%) Init: systemd v: 253 default: graphical
  tool: systemctl Compilers: gcc: 13.1.1 Packages: pm: pacman pkgs: 1407
  libs: 388 tools: paru Shell: fish v: 3.6.1 running-in: konsole inxi: 3.3.27
Garuda (2.6.16-1):
  System install date:     2022-11-12
  Last full system update: 2023-07-09
  Is partially upgraded:   No
  Relevant software:       snapper NetworkManager dracut nvidia-dkms
  Windows dual boot:       No/Undetected
  Failed units:            
20 Likes

Man, @NaN , You've been so helpful to me lately. I wish they made you in a pocket sized model. The hack worked for me. Still using bat.

5 Likes

Right on the spot! I was already getting mad at this bug. Thank you!

1 Like

But I wonder, apparently this bug has been around for quite a while (from what I see in the issue thread you shared, last comment from Jan 13). I wonder why it too so long to manifest in our systems. I suppose the bug is from man-db package, the bug is not mentioned on its site. I can open a issue, do you have more information on it @Kiss-my-axe ?

Even I am not sure what suddenly changed on arch's version of man for this bug to appear here. Though this comment should answer your query partially.

3 Likes

Omg thank you for the solution. I have no idea when this happened I just pulled up a man page today and was like wtf???

happy to help :smile:

2 Likes

Thank You so much!

2 Likes