Skip to content

Revert allow_symlink = True by default for non-executables - #605

Merged
tetromino merged 1 commit into
bazelbuild:mainfrom
gzm0:revert-allow-symlink
Dec 20, 2025
Merged

tetromino merged 1 commit into
bazelbuild:mainfrom
gzm0:revert-allow-symlink

Conversation

@gzm0

@gzm0 gzm0 commented Dec 19, 2025

Copy link
Copy Markdown
Contributor

Partial revert of #565, fixes #604.

@fmeum

fmeum commented Dec 19, 2025

Copy link
Copy Markdown
Contributor

I guess this part of my change was overly optimistic - sorry for that!

Now that Bazel has faster ways to copy, we could introduce a version of ctx.actions.symlink that does have all the performance optimizations (in particular no duplicate hashing), but still no discernable difference in semantics. I will look into that.

Cc @tjgq

@tetromino
tetromino merged commit ea054fc into bazelbuild:main Dec 20, 2025
@fmeum

fmeum commented Feb 23, 2026

Copy link
Copy Markdown
Contributor

@tetromino @gregestren Could you cut a 1.9.1 release with this fix? Folks on slack kept hitting the regression since the fix hasn't been released.

basvandijk added a commit to dfinity/ic that referenced this pull request Nov 18, 2026
…lib 1.9.2

bazel_skylib 1.9.2 changes copy_file's allow_symlink default back to
False (bazelbuild/bazel-skylib#605). The two copy_file calls in
publish/canisters relied on 1.9.0's default of symlinking non-executable
files, so set allow_symlink = True explicitly to keep the 87 canister
.wasm.gz and .did copies as symlinks. This is the same change as on
bas/bazel-skylib-1.9.2.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
AleDema pushed a commit to AleDema/ic that referenced this pull request Nov 18, 2026
Upgrades `bazel_skylib` from 1.9.0 to
[1.9.2](https://github.com/bazelbuild/bazel-skylib/releases/tag/1.9.2),
its latest release. 1.9.1 was tagged but its release CI failed, so it
was never released or published to the BCR (see the
[CHANGELOG](https://github.com/bazelbuild/bazel-skylib/blob/1.9.2/CHANGELOG.md)).

The unstamped release artifacts are byte-identical to master.

## Changes

- **`MODULE.bazel`**: version bump. BCR's `bazel_skylib/1.9.2` has no
patches or overlays, and its `MODULE.bazel` declares the same
dependencies as 1.9.0 (`platforms` 0.0.10, `rules_license` 1.0.0). Apart
from skylib's own version, the full `bazel mod graph` is identical to
master.
- **`publish/canisters/BUILD.bazel`**: sets `allow_symlink = True` on
its two `copy_file` calls, which copy the canister `.wasm.gz` files and
their `.did` files. This keeps those copies as symlinks (see below).

dfinity#12159 (rules_foreign_cc 0.17.0) also bumps `bazel_skylib` to 1.9.2,
because rules_foreign_cc 0.17.0 requires it. It carries the same two
`allow_symlink = True` lines, which are needed whichever of the two PRs
lands first.

## Upstream changes that touch our setup

Between the 1.9.0 and 1.9.2 release archives, only `copy_file`,
`selects`, the `common_settings` rules and the version strings change.
`write_file`, `run_binary`, `unittest`, `paths` and the rest of what we
use are unchanged.

- **`copy_file` copies by default again.** 1.9.0 made `allow_symlink`
default to `True` for non-executable files
([bazelbuild/bazel-skylib#565](bazelbuild/bazel-skylib#565)).
1.9.2 reverts that default to `False`
([bazelbuild/bazel-skylib#605](bazelbuild/bazel-skylib#605),
fixing
[bazelbuild/bazel-skylib#604](bazelbuild/bazel-skylib#604)),
so such a `copy_file` now runs `cp` instead of creating a symlink.
- The `copy_file`s in `ic-os/defs.bzl` and `ic-os/setupos/defs.bzl`
already set `allow_symlink = True`, so they don't change.
- The two in `publish/canisters/BUILD.bazel` relied on the 1.9.0
default. dfinity#10679 removed the `.did` copies' `allow_symlink = False` so
they would be symlinked, after dfinity#10672 made `ci/src/artifacts/upload.sh`
upload symlinked bundle entries under their own names. With
`allow_symlink = True` set explicitly, those 87 copies (44 `.wasm.gz`,
43 `.did`) stay symlinks; otherwise they would turn into `cp` actions.
- Outside the release artifacts' graph, the revert turns 18 external
`copy_file`s in the `//...` graph from symlinks into copies, because
they use the default: rules_python's namespace-package `__init__.py`
files for the numpy (11), pulp (4) and protobuf (2) wheels, and gawk's
`config.h` (gawk comes in through rules_distroless). Their content
doesn't change, and the tests that import those packages pass (see
Verification).
- **`selects.config_setting_group` with `//conditions:default`** now
aliases a new `@bazel_skylib//lib:always_true` target instead of
generating two `config_setting`s on `--stamp`
([bazelbuild/bazel-skylib#611](bazelbuild/bazel-skylib#611),
[bazelbuild/bazel-skylib#629](bazelbuild/bazel-skylib#629)).
We don't load `selects`, and no target in the configured `//...` graph
depends on a `@bazel_skylib//lib` target.
- **The `scope` attribute of the `common_settings` rules defaults to
`"target"` instead of `"universal"`**
([bazelbuild/bazel-skylib#608](bazelbuild/bazel-skylib#608)).
Our flags are defined with these rules (`//bazel:enable_fuzzing_code`,
`//bazel:enable_malicious_code`, `//bazel:hermetic_cc`,
`//:pocket-ic-server-variant`, ...), and none of them sets `scope`.
- Bazel 9.3.2 only reads a flag's `scope` when it is set explicitly.
That applies both to flags set on the command line
([`StarlarkOptionsParser`](https://github.com/bazelbuild/bazel/blob/9.3.2/src/main/java/com/google/devtools/build/lib/runtime/StarlarkOptionsParser.java#L256-L260))
and to flags set by transitions
([`BuildOptionsScopeFunction`](https://github.com/bazelbuild/bazel/blob/9.3.2/src/main/java/com/google/devtools/build/lib/skyframe/BuildOptionsScopeFunction.java#L181-L189)).
- `--incompatible_exclude_starlark_flags_from_exec_config` is off by
default in 9.3.2, and we don't set it. With it off, a flag without an
explicit scope still propagates to the exec configuration
([`FunctionTransitionUtil`](https://github.com/bazelbuild/bazel/blob/9.3.2/src/main/java/com/google/devtools/build/lib/analysis/starlark/FunctionTransitionUtil.java#L239-L251)).
- Checked with both versions: `--//bazel:enable_fuzzing_code=True` on
the command line and `//bazel:enable_malicious_code` set by the
`malicious_binary` transition both reach the exec configurations. The
configuration hashes are the same as on master.

## Verification

All in the dev container:

- **Module graph:** `bazel mod graph` is identical to master apart from
skylib's own version. `bazel mod explain bazel_skylib` shows every
dependent resolving 1.9.2. There are no new warnings; the only one is
the existing `rules_qemu` `use_repo()` warning.
- **Analysis:** `bazel build //... --nobuild` analyzes all 3387 targets.
- **Lint:** the CI Linter checks (`shfmt-check`, `ruff-check`,
`buf-check`, `DFINITY-capitalization-check`, `do-not-merge-check`,
`buildifier-check`, `gazelle-check`, `buf-breaking-check`) pass.
`buildifier-fix`, `shfmt-fix`, `ruff-fix` and `gazelle` change nothing.
- **`copy_file` actions:** in the release artifacts' graph there are 227
(215 symlinks, 12 copies). `bazel aquery` prints identical output for
them with 1.9.0 and 1.9.2, action keys included. In the `//...` graph,
the only differences are the 18 external symlink-to-copy switches listed
above.
- **Release artifacts are byte-identical to master** (133 files): the
unstamped IC-OS bundles that `ci/container/build-ic.sh --icos` builds
(GuestOS prod disk and update, GuestOS recovery update, HostOS update,
SetupOS), `//publish/binaries:bundle` and `//publish/canisters:bundle`.
No sandboxed actions ran: everything was a disk-cache hit apart from 26
uncacheable local actions.
- **Tests:** these 33 pass:
- `//bazel/mainnet_artifact_refs_tests:mainnet_artifact_refs_test`: 10
analysis tests built on skylib's `unittest`.
- The 20 `file_size_check` tests in `//publish/canisters`, which read
the symlinked canisters.
- `//rs/recovery/subnet_splitting/split_finder:split_finder_test`,
`//ci/githubstats:query_test` and `//ci/githubstats:query_help_test`.
They import pandas (and with it numpy), pulp and protobuf, whose
namespace `__init__.py` files are now copies.
- **Builds:**
- `//rs/rosetta-api/icp:version` and `//rs/rosetta-api/icrc1:version`
(`write_file`) contain `2.1.10` and `1.2.10`.
  - `@@gawk+//:gawk` compiles with its `config.h` now a copied file.
- **Not run locally:** the full build and test suite, the system tests
and the macOS builds. CI covers those.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression in 1.9.0: copy_file sets allow_symlink = True by default

3 participants