wting / autojump

A cd command that learns - easily navigate directories from the command line
Other
16.08k stars 703 forks source link

re.error: unterminated character set at position 4 #617

Closed huhuang03 closed 3 years ago

huhuang03 commented 3 years ago
C:\Users\huhua>j test
Traceback (most recent call last):
  File "C:\Users\huhua\AppData\Local\autojump\bin\\autojump", line 342, in <module>
    sys.exit(main(parse_arguments()))
  File "C:\Users\huhua\AppData\Local\autojump\bin\\autojump", line 335, in main
    ['.'],
  File "C:\Users\huhua\AppData\Local\autojump\bin\autojump_utils.py", line 41, in first
    return it.__next__()
  File "C:\Users\huhua\AppData\Local\autojump\bin\autojump_match.py", line 87, in <lambda>
    flags=regex_flags,
  File "E:\Program Files\Python\Python37\lib\re.py", line 183, in search
    return _compile(pattern, flags).search(string)
  File "E:\Program Files\Python\Python37\lib\re.py", line 286, in _compile
    p = sre_compile.compile(pattern, flags)
  File "E:\Program Files\Python\Python37\lib\sre_compile.py", line 764, in compile
    p = sre_parse.parse(p, flags)
  File "E:\Program Files\Python\Python37\lib\sre_parse.py", line 924, in parse
    p = _parse_sub(source, pattern, flags & SRE_FLAG_VERBOSE, 0)
  File "E:\Program Files\Python\Python37\lib\sre_parse.py", line 420, in _parse_sub
    not nested and not items))
  File "E:\Program Files\Python\Python37\lib\sre_parse.py", line 526, in _parse
    source.tell() - here)
re.error: unterminated character set at position 4
ECHO 处于关闭状态。(means echo is off)

And my cmd:

C:\Users\huhua>cmd
Microsoft Windows [版本 10.0.18363.1256]
(c) 2019 Microsoft Corporation。保留所有权利。
Clink v0.4.9 [git:2fd2c2] Copyright (c) 2012-2016 Martin Ridgers
http://mridgers.github.io/clink

So this is some encoding issue?

huhuang03 commented 3 years ago

After some reading the code. I find the issue is that on windows, the regex expression is [^\]*$, and [^/]*$ on linux. In autojump_match.py's method match_consecutive.