beetbox / beetbox/beets

Unable to see terminal input after beet bad

Open
#6,750 0 comments 0 reactions 0 assignees View on GitHub
badfiles
Dominant language
Python
Stars
15.7k
Forks
2.1k
Avg merge
4d 21h
Merged PRs (30d)
31

Description

### Problem

Running this command in verbose (`-vv`) mode:

```sh
$ beet -vv bad
```

Led to this problem:

```
After `beet bad` finishes, my terminal is left in a broken state where I cannot see what I type at the next shell prompt. Input still appears to be accepted, but typed characters are not echoed.

Pressing Ctrl-C shows `^C`, but it does not restore normal terminal input. The spacing between `^C` and the next prompt also looks larger than normal.

Running either of these fixes the terminal until the next time I run `beet bad`:

reset
stty sane

Redirecting stdout/stderr does not fully solve the issue:

beet bad > ~/beet-bad.log 2>&1

This makes me suspect that `beet bad`, or one of the external checker commands invoked by the `badfiles` plugin, is leaving the terminal/TTY in a modified state, possibly with echo disabled.
```

Here's a link to the music files that trigger the bug (if relevant):

### Setup

* OS: Ubuntu Linux
* Python version: TODO: paste output of `python --version`
* beets version: 2.11.0
* Turning off plugins made problem go away (yes/no): TODO

My configuration (output of `beet config`) is:

```yaml
directory: /path/to/Music
library: ~/path/to/beets/library.db
paths:
default: $albumartist/$album/$id-$title
singleton: Non-Album/$artist/$id-$title
comp: Compilations/$album/$id-$title
replace:
'[\\/]': _
'^\.+': _
'[\x00-\x1f]': _
'[<>:"\?\*\|]': _
'\.$': _
'\s+': _
import:
copy: yes
write: yes
plugins:
- musicbrainz
- chroma
- badfiles
- info
- unimported
badfiles:
check_on_import: yes
commands:
m4a: /path/to/Scripts/music/check-m4a-ffmpeg
```

Additional notes:

`beet bad` is mainly just outputing these warnings which I am working with:

```text
WARNING, cannot check MD5 signature since it was unset in the STREAMINFO
```

I do not know whether that warning is related to the terminal state issue. The terminal echo problem happens after running `beet bad`, and `reset` or `stty sane` restores the terminal.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing `beet -vv bad` with the `badfiles` plugin enabled and inspect the configured `commands` entry, especially `/path/to/Scripts/music/check-m4a-ffmpeg`. Compare behavior with plugins disabled and with output redirected. Done means the command no longer leaves terminal input echo disabled or spacing corrupted, while the reported warning can still be assessed separately.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, shell
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.