Skip to content

Regression in 2.32.2 on Windows and git-bash: Certain path characters are interpreted as escape sequences #1020

@goostleek

Description

@goostleek

Describe the bug

If one of the directory names in a path to the .envrc starts with certain characters (eg. b) then direnv mangles the path while searching for the .envrc

To Reproduce

  1. Install Git For Windows 2.38.1

  2. Run git-bash shell

  3. Instal direnv hook: eval "$(direnv hook bash)"

  4. Create a dir directory and dir/.envrc file then navigate to dir

mkdir dir && cd dir && touch .envrc

In this case, everything works as expected, .envrc is loaded 👌

direnv: loading /d/dir/.envrc
  1. Still being in dir directory create a bug directory and bug/.envrc file then navigate to bug
 mkdir bug && cd bug && touch .envrc

In this case, direnv mangles the path and fails 💥

direnv: referenced /d/diug/.envrc does not exist
direnv: error exit status 1

Expected behavior

Mind the broken .envrc load path /d/diug/.envrc. It should be /d/dir/bug/.envrc. It seems the .../b... character was interpreted as a backspace escape sequence.

Environment

  • OS: MSYS_NT-10.0-19044
  • Shell: git-bash
  • Direnv version: 2.32.2

Additional context

It seems the bug is a regression introduced in the 2.32.2 release. It does not occur in a previous 2.32.1 version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions