Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • A autojump
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 158
    • Issues 158
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 54
    • Merge requests 54
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • William Ting
  • autojump
  • Issues
  • #436
Closed
Open
Issue created Jul 31, 2016 by Administrator@rootContributor

Crash on Windows due to improper backslash handling in autojump_match.py

Created by: agorgl

Executing any normal autojump command in Windows leads to this:

Traceback (most recent call last):
  File "C:\Program Files (x86)\CowShell\Vendor\AutoJump\bin\\autojump", line 320, in <module>
    sys.exit(main(parse_arguments()))
  File "C:\Program Files (x86)\CowShell\Vendor\AutoJump\bin\\autojump", line 314, in main
    ['.'])))
  File "C:\Program Files (x86)\CowShell\Vendor\AutoJump\bin\autojump_utils.py", line 42, in first
    return it.next()
  File "C:\Program Files (x86)\CowShell\Vendor\AutoJump\bin\autojump_match.py", line 86, in <lambda>
    flags=regex_flags,
  File "F:\Programs\Python\lib\re.py", line 146, in search
    return _compile(pattern, flags).search(string)
  File "F:\Programs\Python\lib\re.py", line 251, in _compile
    raise error, v # invalid expression
sre_constants.error: unexpected end of regular expression
ECHO is off.

The highlighted change here: https://github.com/wting/autojump/commit/7c7865ea7ecfd937284f774fb0818c5cc10c340a#diff-4b97c2fd2ae952c567c1646bc80e5d43L78 lead to the dysfunction in Windows systems.

The proposed solution is basically changing the lines 78-80 in autojump_match.py to:

    sep = '\\\\' if os.sep == '\\' else os.sep
    regex_no_sep = '[^' + sep + ']*'
    regex_no_sep_end = regex_no_sep + '$'
    regex_one_sep = regex_no_sep + sep + regex_no_sep

(Conditionally setting the separator value used in the regex construction)

Assignee
Assign to
Time tracking