bat icon indicating copy to clipboard operation
bat copied to clipboard

Reports no error but empty file when EIO on read()

Open ctxnop opened this issue 8 months ago • 0 comments

What steps will reproduce the bug?

  1. bat /dev/ttyS1

What happens? It displays an empty file and report success (exit code is zero).

LANG=C /usr/bin/bat /dev/ttyS1 && echo "STATUS:$?"
───────┬────────────────────────────────────────────────────
       │ File: /dev/ttyS1   <EMPTY>
───────┴────────────────────────────────────────────────────
STATUS:0

What did you expect to happen instead? It should report an error just like cat

LANG=C /usr/bin/cat /dev/ttyS1 && echo "STATUS:$?"
/usr/bin/cat: /dev/ttyS1: Input/output error

How did you install bat? pacman -S bat


bat version and environment

Software version

bat 0.24.0 (fc954685)

Operating system

Linux 6.9.3-arch1-1

Command-line

bat --diagnostic 

Environment variables

SHELL=/usr/bin/zsh
PAGER=<not set>
LESS=<not set>
LANG=fr_FR.UTF-8
LC_ALL=<not set>
BAT_PAGER=<not set>
BAT_PAGING=<not set>
BAT_CACHE_PATH=<not set>
BAT_CONFIG_PATH=<not set>
BAT_OPTS=<not set>
BAT_STYLE=<not set>
BAT_TABS=<not set>
BAT_THEME=<not set>
XDG_CONFIG_HOME=<not set>
XDG_CACHE_HOME=<not set>
COLORTERM=truecolor
NO_COLOR=<not set>
MANPAGER=<not set>

System Config file

Could not read contents of '/etc/bat/config': No such file or directory (os error 2).

Config file

Could not read contents of '/home/ctxnop/.config/bat/config': No such file or directory (os error 2).

Custom assets metadata

Could not read contents of '/home/ctxnop/.cache/bat/metadata.yaml': No such file or directory (os error 2).

Custom assets

'/home/ctxnop/.cache/bat' not found

Compile time information

  • Profile: release
  • Target triple: x86_64-unknown-linux-gnu
  • Family: unix
  • OS: linux
  • Architecture: x86_64
  • Pointer width: 64
  • Endian: little
  • CPU features: fxsr,sse,sse2
  • Host: x86_64-unknown-linux-gnu

Less version

> less --version 
less 643 (PCRE2 regular expressions)
Copyright (C) 1984-2023  Mark Nudelman

less comes with NO WARRANTY, to the extent permitted by law.
For information about the terms of redistribution,
see the file named README in the less distribution.
Home page: https://greenwoodsoftware.com/less

ctxnop avatar Jun 13 '24 14:06 ctxnop