zsh completion error - invalid regex : )
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 2.1k
- Avg merge
- 4d 21h
- Merged PRs (30d)
- 31
Description
### Problem
Using the latest (c153f72) version of _beet still produces the invalid regex error.
```
$ beet …
_beet:zregexparse:4: invalid regex : )
_beet:zregexparse:4: invalid regex : )
```
I have `mawk` installed, which according to https://github.com/beetbox/beets/issues/3546#issuecomment-1878395666 should have avoided this issue in the previous version, but it's present in both versions.
```
$ awk -W version
mawk 1.3.4 20200120
Copyright 2008-2019,2020, Thomas E. Dickey
Copyright 1991-1996,2014, Michael D. Brennan
random-funcs: srandom/random
regex-funcs: internal
compiled limits:
sprintf buffer 8192
maximum-integer 2147483647
```
### Setup
* OS: Ubuntu 22.04.3 LTS
* Python version: python 3.10.12
* beets version: 1.6.0
* Turning off plugins made problem go away (yes/no): no
My configuration (output of `beet config`) is:
```yaml
directory: /media/library/Music
library: /media/library/Music/musiclibrary.db
import:
move: yes
plugins:
chroma:
fuzzy:
embedart:
fetchart:
acoustid:
apikey: REDACTED
```
---
```zsh
$ which _beet
_beet () {
local _ra_p1 _ra_p2 _ra_left _ra_right _ra_com expl tmp nm="$compstate[nmatches]"
local _ra_actions _ra_line="${(pj:\0:)${(@)words[1,CURRENT - 1]:Q}}"$'\0'"$PREFIX"
_ra_actions=()
zregexparse -c _ra_p1 _ra_p2 "$_ra_line" $'/[^\0]##\0/' $'(' $'(' $'/-c\0/' $'/[^\0]##\0/' $':_ra_comp $\'file:file:_files\'' $'|' $'/-v\0/' $'|' $'/-l\0/' $'/[^\0]##\0/' $':_ra_comp $\'file:file:_files\'' $'|' $'/-h\0/' $'|' $'/-d\0/' $'/[^\0]##\0/' $':_ra_comp $\'dir:directory:_dirs\'' $'|' $'/[]/' $':_ra_comp $\'options:global options:(( -c\\\\:path\\\\ to\\\\ configuration\\\\ file -v\\\\:print\\\\ debugging\\\\ information -l\\\\:library\\\\ database\\\\ file\\\\ to\\\\ use -h\\\\:show\\\\ this\\\\ help\\\\ message\\\\ and\\\\ exit -d\\\\:destination\\\\ music\\\\ directory ))\'' $')' $'#' $')' $')'
case "$?" in
(0 | 2) _message "no more arguments" ;;
(1) if [[ "$_ra_line[_ra_p1 + 1, -1]" = *$'\0'* ]]
then
_message "parse failed before current word"
else
_ra_left="$_ra_line[_ra_p1 + 1, _ra_p2]"
_ra_right="$_ra_line[_ra_p2 + 1, -1]"
compset -p $(( $#PREFIX - $#_ra_line + $_ra_p1 ))
(( $#_ra_actions )) && _alternative "$_ra_actions[@]"
fi ;;
(3) _message "invalid regex" ;;
esac
[[ nm -ne "$compstate[nmatches]" ]]
}
```
Contributor guide
Research direction
Reproduce the error using the reported Ubuntu, beets 1.6.0, mawk, plugins, and configuration. Start with the displayed _beet completion function and its zregexparse invocation, then trace the completion source it comes from. Done means invoking beet completion no longer reports an invalid regex and still provides the expected options and file or directory completions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- zsh
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100