← Back to issue list

fix: exclude .venv and .tox from source pull

View original Github issue

Metadata

Project
charmcraft
Number
#2864
Type
pull request
State
merged
Author
dwilding
Labels
—
Created
Updated
Closed

Current evaluation

Merged as 430ee59a; adds .venv and .tox to source_ignore_patterns to avoid ELOOP on virtiofs symlink metadata copy.

Resolution: closed resolved

Reason: PR #2864 merged as commit 430ee59a, adding .venv/.tox to AppMetadata source_ignore_patterns. This mitigates issue #2661; the underlying craft-parts bug is tracked in canonical/craft-parts#1703.

Evaluated by: mr-cal-bot

No scores available.

Issue body

Fixes https://github.com/canonical/charmcraft/issues/2661 (as far as I can tell). My agent investigated the issue locally, determined that the fix works, and couldn't find any regressions. Caveat: I don't have a Mac, so can't fully validate the fix. Also, craft-parts may be the more appropriate place to apply a fix. Additional details from the investigation: - **Why this resolves the issue:** Adds `.venv` and `.tox` to `source_ignore_patterns` in `AppMetadata`, which flows through `craft_application` → `LifecycleManager(ignore_local_sources=...)` → `LocalSource` pull-step filtering. The directories (and their symlinks like `lib64 -> lib`) are never copied to the parts src dir, so `shutil.copy2` → `copystat` → `listxattr` never runs on them — no ELOOP (`ELOOP` is errno 40, "Too many levels of symbolic links"; here it's triggered because `llistxattr` on virtiofs follows the symlink instead of examining the link itself). Verified: pull step skips both dirs; end-to-end pack succeeds; packed charm contains neither. - **What it lacks:** Only matches top-level `.venv`/`.tox` (glob has no `**/` prefix, so nested venvs are still pulled). Doesn't fix the underlying `craft-parts`/`shutil` fragility — any other symlink that triggers `ELOOP` on `llistxattr` (virtiofs) would still crash the pull step. Charmcraft-specific; other craft apps are unaffected. - **Root cause in craft-parts:** `file_utils.copy()` calls `shutil.copy2(src, dst, follow_symlinks=False)`, which reaches `shutil._copyxattr` → `os.listxattr(src, follow_symlinks=False)` → `llistxattr()`. On virtiofs (macOS host mounted into LXD VM), `llistxattr` returns `ELOOP` (errno 40, "Too many levels of symbolic links") on symlinks instead of examining the link itself. `shutil._copyxattr` only suppresses `ENOTSUP`/`ENODATA`/`EINVAL` — not `ELOOP` — so the error propagates and crashes the build. --- - [x] I've followed the [contribution guidelines](https://github.com/canonical/charmcraft/blob/main/CONTRIBUTING.md). - [x] I've signed the [CLA](http://www.ubuntu.com/legal/contributors/). - [x] I've successfully run `make lint && make test`. - [ ] ~I've added or updated any relevant documentation.~ - [ ] ~In documents I changed, I [added a meta description](https://canonical-starflow.readthedocs-hosted.com/how-to/add-a-page-meta-description/) if one was missing.~ - [x] I've updated the relevant release notes.

Evaluation history

Date Model Scores Action Summary
~deepseek/deepseek-pro-latest — closed resolved Merged as 430ee59a; adds .venv and .tox to source_ignore_patterns to avoid ELOOP on virtiofs symlink metadata copy.
stealth/space-bunny-alpha — closed resolved Merged PR #2864 as 430ee59a, excluding .venv and .tox from source pulls to avoid macOS virtiofs symlink ELOOP failures; the generic copy bug remains tracked in craft-parts#1703.
stealth/space-bunny-alpha — closed resolved Merged PR #2864 (commit 430ee59a) adds .venv and .tox to source_ignore_patterns in AppMetadata, so LocalSource pull skips them and shutil.copy2/copystat no longer raises ELOOP. Fixes #2661; released in charmcraft 4.5.
stealth/space-bunny-alpha — closed resolved Merged PR #2864 as commit 430ee59a, excluding .venv and .tox from source pulls to prevent macOS virtiofs symlink ELOOP failures.
qwen/qwen3.6-35b-a3b — — Merged a workaround excluding .venv and .tox from source pulls to prevent ELOOP symlink errors on macOS virtiofs. Resolves charmcraft#2661 while upstream craft-parts#1703 tracks a broader fix. Approved, CI passed, and release notes updated.
qwen3.6-35b-a3b-mtp-q6
Impact: 55
Quick Win: 41
Staleness: 10
Complexity: 25
Confidence: 75
needs review Excludes .venv and .tox from source pull to fix ELOOP crash on virtiofs (macOS). Approved by 2 reviewers, most CI passing, 3 snap-tests failing on specific Ubuntu versions (claimed preexisting).

Update history

Date Change
updated
closed
updated
updated
updated
updated
updated
updated
created

Related work

Related issues

No related issues found above the similarity threshold.