Skip to content

source_env prints incorrect path in its log message #1143

@wentasah

Description

@wentasah

Describe the bug

When using source_env to source .envrc from a subdirectory, the subdirectory is printed twice in the printed path.

To Reproduce

Run this in bash:

mkdir -p subdir
EDITOR=tee direnv edit subdir <<<"echo From subdir"
EDITOR=tee direnv edit . <<<"source_env subdir"

You will get something like:

direnv: loading ~/tmp/.envrc                                                                                                                               
direnv: loading ~/tmp/subdir/subdir/.envrc
From subdir

Expected behavior
The printed message should be:

direnv: loading ~/tmp/.envrc                                                                                                                               
direnv: loading ~/tmp/subdir/.envrc
From subdir

The difference is in the middle line.

Environment

  • OS: NixOS
  • Shell: should not matter (zsh)
  • Direnv version 2.32.3

Additional context

I'll post a PR with a fix.

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