Commit d605df7
committed
fix(generate_klayout_tech): drop realpath() — breaks Bazel sandbox
os.path.realpath() follows symlinks. Inside a Bazel sandbox, the
bazel-out/ tree is symlinked from the sandbox back to the bare
execroot; realpath resolves through that symlink and yields the
bare-execroot path, not the sandbox path.
That alone doesn't matter for os.path.relpath(a, b) when both
operands are realpath'd from the same sandbox — the relative
result is unchanged. But the resulting <lef-files> path in the
generated klayout.lyt is later resolved by klayout against the LYT
file's location. Klayout opens the LYT (also through a symlink),
resolves through to the bare execroot, and then looks for the
sibling klayout_tech.lef at the bare-execroot path — where the
in-flight file does not exist during action execution (only the
sandbox copy does), so def2stream fails with errno=2.
Fix: don't realpath. os.path.relpath produces the correct relative
path from sandbox-relative inputs directly. Map files keep their
absolute form via abspath for the unchanged-under-non-sandbox case.
Surfaced for the first time on bazelisk build
//flow/designs/sky130hd/gcd:gcd_final_blender_html — the
orfs_blender macro is the first bazel-side consumer of orfs_gds
(klayout def2stream), so the latent path bug had no prior trigger.
Mirrors bazel-orfs's patches/0037-fix-generate_klayout_tech-drop-realpath.patch
into ORFS directly so bazel-orfs no longer needs to carry it.
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>1 parent 2f6e9c9 commit d605df7
1 file changed
Lines changed: 6 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
60 | 59 | | |
61 | 60 | | |
62 | 61 | | |
63 | | - | |
| 62 | + | |
64 | 63 | | |
65 | 64 | | |
66 | 65 | | |
| |||
0 commit comments