fix: use lexists() for symlink checks in do_adjust_git#123
Open
timblaktu wants to merge 1 commit intoilbers:nextfrom
Open
fix: use lexists() for symlink checks in do_adjust_git#123timblaktu wants to merge 1 commit intoilbers:nextfrom
timblaktu wants to merge 1 commit intoilbers:nextfrom
Conversation
os.path.exists() follows symlinks and returns False for dangling symlinks. When DL_DIR is mounted at different paths across kas-container sessions (e.g. host path vs container mount point), the .git-downloads symlink becomes dangling. exists() fails to detect it, so the cleanup branch is skipped and the subsequent symlink() call fails with FileExistsError. Switch to os.path.lexists() which detects the symlink itself regardless of whether its target exists, allowing proper cleanup and re-creation. The os.path.exists() on line 66 (alternates file check) is intentionally left unchanged — alternates is a regular file, not a symlink.
timblaktu
added a commit
to kyosaku-kai/n3x
that referenced
this pull request
Feb 27, 2026
Update mirrors.yml PENDING placeholders with actual upstream tracking: - Issue: ilbers/isar#122 - PR: ilbers/isar#123
3 tasks
timblaktu
added a commit
to kyosaku-kai/n3x
that referenced
this pull request
Feb 27, 2026
* docs: rewrite tests/emulation/README.md from 912 to 120 lines
Remove vsim-era content: two mermaid diagrams, session history table,
stale path references (hosts/n100-*, modules/hardware/, modules/roles/,
VSIM-INTEGRATION-PLAN.md, tests/integration/), redundant architecture
sections, oversized platform/troubleshooting/ARM64/resource-control
sections, and "Integrated from vsim project" footer.
Retain: framework purpose with clear "not primary test infra" callout,
platform requirements, directory structure, build/run commands, inner-VM
usage (virsh, OVS, tc profiles), compact ASCII architecture diagram,
traffic control profile table, flake outputs, and references.
* fix: use stable kas-container mount points for DL_DIR/SSTATE_DIR
base.yml used ${HOME}/.cache/yocto/{downloads,sstate} in local_conf_header,
but inside kas-container, kas overrides HOME to an ephemeral tmpdir
(/tmp/tmpXXXXXX). BitBake expanded ${HOME} to that tmpdir, so all downloads
were destroyed when the container exited. Neither devShell nor kas-build
exported DL_DIR/SSTATE_DIR as host environment variables, so kas-container
never mounted a persistent cache directory.
Fix:
- kas-build wrapper (both Darwin and Linux): export DL_DIR and SSTATE_DIR
with defaults of ~/.cache/yocto/{downloads,sstate}, using ${VAR:-default}
so CI can override
- base.yml: hardcode /downloads and /sstate (the stable kas-container
mount points that correspond to the host DL_DIR/SSTATE_DIR)
- Delete ci-cache.yml overlay (existed solely to override the broken ${HOME}
paths for CI; now redundant)
- Remove ci-cache.yml from build-matrix.nix mkCiKasCommand
- Remove .git-downloads workaround from isar-build-all.sh and CI workflow
(DL_DIR now resolves to /downloads which is stable across container
sessions, so .git-downloads symlinks no longer go stale)
- Update CLAUDE.md: replace stale workaround docs with new caching docs
References: siemens/kas#52, siemens/kas#148
* fix: point ISAR repo at kyosaku-kai fork with symlink fix
Switch mirrors.yml from upstream ilbers/isar to our fork at
kyosaku-kai/isar on the fix/do-adjust-git-dangling-symlinks branch.
The fork contains a one-line fix: os.path.exists() → os.path.lexists()
in dpkg-base.bbclass do_adjust_git(), fixing FileExistsError when
DL_DIR mount paths change between kas-container sessions (dangling
.git-downloads symlink not detected by exists() which follows symlinks).
Revert to upstream once ilbers/isar merges the fix.
* fix: add upstream issue/PR references for ISAR symlink fix
Update mirrors.yml PENDING placeholders with actual upstream tracking:
- Issue: ilbers/isar#122
- PR: ilbers/isar#123
Contributor
|
Good catch, and the fix looks good. Please just have a look at https://github.com/ilbers/isar/blob/master/CONTRIBUTING.md. Most critical is the missing DCO ("signed-off", see that doc for its semantic). Reviews happen on the mailing list. So, please submit there if possible |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes
FileExistsErrorindo_adjust_git()whenDL_DIRchanges between kas-container sessions, leaving a dangling symlink at${WORKDIR}/git.os.path.exists()follows symlinks and returnsFalsefor dangling ones, so the stale symlink is never cleaned up andos.symlink()fails when it tries to create a replacement.os.path.exists()→os.path.lexists()(stale link detection)os.path.exists()→os.path.lexists()(pre-creation check)os.path.lexists()checks for the symlink entry itself rather than following it to the target, correctly detecting and replacing dangling links.When DL_DIR is mounted at different paths across kas-container sessions (e.g. host path vs container mount point), the .git-downloads symlink becomes dangling. exists() fails to detect it, so the cleanup branch is skipped and the subsequent symlink() call fails with FileExistsError.
Switch to os.path.lexists() which detects the symlink itself regardless of whether its target exists, allowing proper cleanup and re-creation.
The os.path.exists() on line 66 (alternates file check) is intentionally left unchanged — alternates is a regular file, not a symlink.
Closes #122