Repository navigation
Keep local files and escaping symlinks out of packaged std inputs #903
Description
Problem
stage_package recursively copies the entire local std directory and follows symlinks. A local-only file is included in the compiler distribution; a symlink to a file outside std is materialized as package content. Package metadata still identifies the Git HEAD rather than these extra inputs.
Reproduction
Audited on Linux amd64 at 53bb5809cf32d29f5a5a9d313ffa332ea3cd4beb, whose tracked tree matches canonical master c5ab63f9eec388c75b00f5cd59eae28a45a9b39f. Compiler built with Rust 1.89.0, LLVM 21, and the checkout std; Whale is locked to 020d2a4. Executed the real staging function with temporary compiler/license files and dependency-helper stubs; no LLVM distribution build or publication was performed.
A temporary ROOT/std contained .local-notes.txt with untracked local notes and link.wave pointing to ROOT/outside.txt with outside std marker. Calling tools.ci.package.stage_package included both files in the returned stage; std/link.wave was a regular file containing the outside marker. The copying code is unconditional:
shutil.copytree(legacy.ROOT / "std", stage / "std")Starting point: tools/ci/package.py, stage_package and package_targets. copytree defaults to following links, and subsequent tar/zip creation archives the staged files.
Scope
Define and enforce package input membership before copying so local/ignored files and paths escaping the std boundary cannot enter an archive. Preserve legitimate std assets, licenses, and matching compiler/std compatibility validation. Document any intentional inclusion of non-Git build inputs in the package contract rather than silently including arbitrary files.
Completion criteria
- Harmless local-file and out-of-tree symlink sentinels are excluded or rejected before archive publication.
- Legitimate std files are complete and package identity accurately describes their source.
- Cover tar.gz and zip staging, safe internal links if supported, and failure preservation of existing packages.
Please mention @LunaStev to discuss the design before starting implementation.
Activity