Repository navigation
Commit 607bd0a
committed
fix(zipapp): store _solib shared libraries as files, not absolute symlinks
Since #4165, the zipper keeps a symlink for an input whose original source is a
symlink, looking through the absolute symlink the Bazel sandbox exposes the
input as. For the `_solib` entries Bazel creates for shared libraries, the
original source is itself an absolute symlink into the build machine's output
base, so the zipapp stored entries like
runfiles/_main/_solib_x86_64/libST-..._Slibgrpc.so
-> /home/<user>/.cache/bazel/<hash>/execroot/_main/bazel-out/.../libgrpc.so
which dangle on any other machine. Any zipapp whose Python code loads a shared
library from `_solib` (a C extension that links a `cc_library` dynamically, or
`libpython` for an extension that links it) fails to load it outside the
machine that built it. Before #4165 these files were copied.
To fix, only keep the looked-through target when it is relative, e.g.
`libpython3.10.so -> libpython3.10.so.1.0` inside the runtime, which is what
the size optimization in #4165 is for. Otherwise the file is stored.
* Adds a zipper test with the `_solib` shape: a sandbox symlink to an absolute
symlink to the library. It fails without the fix ("should NOT be a symlink
but is").1 parent fc7dc41 commit 607bd0a
3 files changed
Lines changed: 40 additions & 1 deletion
File tree
- news
- tests/tools/zipapp
- tools/zipapp
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
177 | 207 | | |
178 | 208 | | |
179 | 209 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
133 | 136 | | |
134 | | - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
135 | 140 | | |
136 | 141 | | |
137 | 142 | | |
| |||
0 commit comments