sharkdp / bat

A cat(1) clone with wings.
Apache License 2.0
49.74k stars 1.25k forks source link

Bat segfaults when trying to view any file. #2013

Closed depesz closed 2 years ago

depesz commented 2 years ago

Installed new system. One of the steps is installing some rust tools. So I did:

export RUSTUP_HOME=/opt/rustup
export CARGO_HOME=/opt/cargo
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
export PATH="${CARGO_HOME}/bin:${PATH}"
cargo install cargo-update bat

This was done using root account.

Unfortuantely viewing ANY file results in:

=# ls -l /etc/hosts
-rw-r--r-- 1 root root 244 sty  2 13:37 /etc/hosts

=# bat /etc/hosts
memory allocation of 7881122326526296064 bytes failed
Aborted (core dumped)

I don't know anything about debugging rust tools, so figured I'll try strace: bat.strace.gz

Unfortunately nothing came out of it, for me.

bat version and environment

=# bat --diagnostic /etc/hosts

Software version

bat 0.18.3

Operating system

Linux 5.13.0-22-generic

Command-line

bat --diagnostic /etc/hosts 

Environment variables

SHELL=/bin/bash
PAGER=less
LESS=-iMFXSx4R
BAT_PAGER=<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=<not set>
NO_COLOR=<not set>
MANPAGER=<not set>

Config file

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

Compile time information

Less version

> less --version 
less 551 (GNU regular expressions)
Copyright (C) 1984-2019  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: http://www.greenwoodsoftware.com/less
Enselic commented 2 years ago

Thanks for reporting this quickly.

It's my fault again :(

We are waiting for syntect to yank 4.7.1, see https://github.com/trishume/syntect/pull/403#issuecomment-1003940363

depesz commented 2 years ago

Is there anything I can do on my end (short of cargo uninstall) to make that work? some way to let cargo to use different version(s) ?

Enselic commented 2 years ago

Yeah you can do cargo install --locked bat which will use a compatible version of syntect.

depesz commented 2 years ago

Sweet. thanks a lot. that saves me a lot of hassle. And thanks a lot for great software :)

Enselic commented 2 years ago

Syntect 4.7.1 was yanked long ago. Closing.