Commit 2e7d998
committed
Warn instead of aborting brew bundle on stale-tab dependency cycles
`brew bundle` sorts installed formulae into dependency order for display
and iteration, feeding runtime dependencies from installed keg tabs into a
TSort graph. Those recorded tab closures can disagree with the current
formulae and form a cycle the live graph does not have (e.g. a keg built
when `webp` depended on `libtiff`, against today's `libtiff` -> `webp`).
`sort!` responded to `TSort::Cyclic` by `odie`ing the entire run, so a
single stale tab aborts `brew bundle` for everyone. This sort only orders
the list; `brew install` resolves its own real dependencies, so a degraded
order is harmless. Every other sorter in the codebase degrades instead
(`upgrade.rb`, `cask/installer.rb`).
Warn and continue with a best-effort order from
`each_strongly_connected_component` instead of aborting, and surface the
real cyclic component from `strongly_connected_components` rather than
parsing it out of the exception message. The reinstall remedy is kept as
advice but softened, since it does not reliably clear these phantom cycles.
The flipped spec drives a real cycle through fixtures so it exercises the
`TSort::Cyclic` fallback end to end and fails if the hard exit returns.1 parent 3d58a45 commit 2e7d998
2 files changed
Lines changed: 61 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
426 | 426 | | |
427 | 427 | | |
428 | 428 | | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | | - | |
443 | | - | |
444 | | - | |
445 | | - | |
446 | | - | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
447 | 455 | | |
448 | 456 | | |
449 | 457 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
163 | 183 | | |
164 | 184 | | |
165 | 185 | | |
| |||
180 | 200 | | |
181 | 201 | | |
182 | 202 | | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
190 | 210 | | |
191 | 211 | | |
192 | 212 | | |
| |||
916 | 936 | | |
917 | 937 | | |
918 | 938 | | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
919 | 947 | | |
920 | 948 | | |
0 commit comments