-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
What version of bat are you using?
[paste the output of bat --version here]
bat 0.15.4
Describe the bug you encountered:
When input file is also an output file, an infinite loop can be created, where shell writes to a file, bat reads the file, the shell redirects it to the same file and bat has to read than again, ad infinitum.
To reproduce:
echo a > a
bat a b > b
Describe what you expected to happen?
bat should behave as cat; cat prints cat: b: input file is output file to stderr. While this behaviour could be useful, it has the potential to use up all the disk space and reduce nand lifespan.
How did you install bat?
pacman, Arch Linux
[paste the output of info.sh here]
system
$ uname -srm
Linux 5.8.9-zen2-1-zen x86_64
bat
$ bat --version
bat 0.15.4
$ env
ALACRITTY_LOG=/tmp/Alacritty-59883.log
COLORTERM=truecolor
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
DISPLAY=:0
HOME=/home/lizzie
I3SOCK=/run/user/1000/sway-ipc.1000.720.sock
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_ADDRESS=pl_PL.UTF-8
LC_COLLATE=pl_PL.UTF-8
LC_CTYPE=pl_PL.UTF-8
LC_MEASUREMENT=pl_PL.UTF-8
LC_MESSAGES=en_US.UTF-8
LC_MONETARY=pl_PL.UTF-8
LC_NAME=pl_PL.UTF-8
LC_NUMERIC=pl_PL.UTF-8
LC_PAPER=pl_PL.UTF-8
LC_TELEPHONE=pl_PL.UTF-8
LC_TIME=pl_PL.UTF-8
LOGNAME=lizzie
MAIL=/var/spool/mail/lizzie
OMF_CONFIG=/home/lizzie/.config/omf
OMF_PATH=/home/lizzie/.local/share/omf
PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
PWD=/home/lizzie
QT_QPA_PLATFORM=wayland
SHELL=/usr/bin/fish
SHLVL=2
SWAYSOCK=/run/user/1000/sway-ipc.1000.720.sock
TERM=alacritty
USER=lizzie
WAYLAND_DISPLAY=wayland-0
XCURSOR_SIZE=24
XDG_RUNTIME_DIR=/run/user/1000
XDG_SEAT=seat0
XDG_SESSION_CLASS=user
XDG_SESSION_ID=1
XDG_SESSION_TYPE=tty
XDG_VTNR=1
bat_config
bat_wrapper
No wrapper script for 'bat'.
bat_wrapper_function
No wrapper function for 'bat'.
No wrapper function for 'cat'.
tool
$ less --version
less 551 (PCRE regular expressions)