← Back to issue list

Warn on outward relative path sources

View original Github issue

Metadata

Project
craft-parts
Number
#1390
Type
issue
State
open
Author
bepri
Labels
Status: Triaged
Created
2025-11-04 12:45:44+00:00
Updated
2025-12-01 23:34:52+00:00
Closed

Current evaluation

No evaluation has been recorded for this issue yet.

Issue body

### What needs to get done A warning should be raised when a part with a source above `Path.cwd()` is parsed. This works in destructive mode, but it will almost always fail in managed builds. ### Why it needs to get done Currently, supplying a relative path for a `source:` isn't supported and can very easily lead to unexpected behavior. Consider the following project structure: ``` ├── misc │   └── packaging │   └── snap │   └── snapcraft.yaml └── src └── main.c ``` And a part with the following: ```yaml parts: plugin: [any] source: ../../../ source-type: [git or local] ``` Once this gets into a LXD build environment, `../../../` will always resolve to `/`. Then, depending on the file-type, you can get behaviors ranging from "not a git directory" (from `source-type: git`) to disk space errors due to it attempting to copy _the entire root_ (from `source-type: local`). Since this _could_ be a desired behavior, but is almost certainly not, a warning should be issued in this case.

Evaluation history

No evaluation history available.