← 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
closed
Author
dwilding
Labels
Created
Updated
Closed

Current evaluation

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.

Suggested action:

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
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.25
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
closed
updated
updated
updated
updated
updated
updated
created

Related issues

No related issues found above the similarity threshold.