Skip to content

prefix_paths double-slashes absolute env-var paths #302

@moshe-elastix

Description

@moshe-elastix

prefix_paths double-slashes absolute env-var paths

Summary

Environment variables in dependency path: fields do not work when the
variable expands to an absolute path. Bender prepends the consuming
Bender.yml's parent directory to the template string (e.g. ${ABS})
before substituting the env var, so the substitution happens inside an
already-prefixed path and produces a malformed result like
<parent>//<absolute-expansion>.

The prefix step should be skipped (or applied after expansion) when the
expansion produces an absolute path. As is, env vars in path: are
effectively unusable for absolute paths — direct absolute literals and
relative env vars both work, only absolute env-var expansions break.

Bender version

0.31.0 and master (0a98f9e).

Setup

/tmp/x/
├── a/Bender.yml
└── b/Bender.yml

a/Bender.yml:

package: { name: a }

b/Bender.yml:

package: { name: b }
dependencies:
  a: { path: "${ABS}" }

Repro

cd /tmp/x/b && ABS=/tmp/x/a bender update

Expected

a resolves to /tmp/x/a.

Actual

error[E32]: Path /tmp/x/b//tmp/x/a for dependency a does not exist.

Note the // between b/ and /tmp/x/a — bender concatenated the parent dir
onto the template, then expanded ${ABS} inside the combined string.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions