Commit defdd7c
Harden preserved-config rescue against divergence and long names
Address three review findings on the reinstall config-rescue path:
- A complete .rescue-complete marker proves only that staging finished,
not that dest_dir was modified. A crash after staging sync but before
the rmtree leaves the live kept config intact; if the user edits it
before retrying, preferring the staged bytes silently overwrote the
newer config. The two copies are indistinguishable in provenance from
disk, so detect divergence between a complete staging copy and the live
config and abort (preserving both) instead of unconditionally choosing
staging.
- The staging directory embedded the full extension ID in one path
component. Extension IDs are length-unbounded, so a valid long ID could
install at dest_dir yet fail every reinstall-after-keep-config with
ENAMETOOLONG. Derive the staging component from a fixed-length hash via
a new _rescue_staging_dir() helper.
- The stranded-config restore used the full config filename as a
NamedTemporaryFile prefix; a name already near the component limit plus
the random suffix raised ENAMETOOLONG. Use a short fixed prefix.
Updates the retry regression test to the new divergence semantics and
adds conflict-abort, long-ID, and fixed-prefix coverage.
Assisted-by: GitHub Copilot (model: Claude Opus 4.8, autonomous)
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>1 parent 57d90dc commit defdd7c
2 files changed
Lines changed: 155 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
746 | 746 | | |
747 | 747 | | |
748 | 748 | | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
749 | 763 | | |
750 | 764 | | |
751 | 765 | | |
| |||
1470 | 1484 | | |
1471 | 1485 | | |
1472 | 1486 | | |
1473 | | - | |
| 1487 | + | |
1474 | 1488 | | |
1475 | 1489 | | |
1476 | 1490 | | |
| |||
1492 | 1506 | | |
1493 | 1507 | | |
1494 | 1508 | | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
1495 | 1522 | | |
1496 | 1523 | | |
1497 | 1524 | | |
1498 | 1525 | | |
1499 | 1526 | | |
1500 | 1527 | | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
1501 | 1537 | | |
1502 | | - | |
| 1538 | + | |
1503 | 1539 | | |
1504 | 1540 | | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
| 1550 | + | |
| 1551 | + | |
1505 | 1552 | | |
1506 | 1553 | | |
1507 | 1554 | | |
| |||
1599 | 1646 | | |
1600 | 1647 | | |
1601 | 1648 | | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + | |
| 1654 | + | |
1602 | 1655 | | |
1603 | 1656 | | |
1604 | 1657 | | |
1605 | | - | |
| 1658 | + | |
1606 | 1659 | | |
1607 | 1660 | | |
1608 | 1661 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1421 | 1421 | | |
1422 | 1422 | | |
1423 | 1423 | | |
1424 | | - | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
1425 | 1430 | | |
1426 | 1431 | | |
1427 | 1432 | | |
| |||
1446 | 1451 | | |
1447 | 1452 | | |
1448 | 1453 | | |
1449 | | - | |
| 1454 | + | |
1450 | 1455 | | |
1451 | 1456 | | |
1452 | 1457 | | |
| |||
1473 | 1478 | | |
1474 | 1479 | | |
1475 | 1480 | | |
1476 | | - | |
1477 | | - | |
1478 | | - | |
1479 | | - | |
1480 | | - | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
1481 | 1484 | | |
1482 | 1485 | | |
1483 | 1486 | | |
| |||
1493 | 1496 | | |
1494 | 1497 | | |
1495 | 1498 | | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
| 1539 | + | |
| 1540 | + | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
| 1550 | + | |
| 1551 | + | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
| 1568 | + | |
| 1569 | + | |
| 1570 | + | |
| 1571 | + | |
| 1572 | + | |
| 1573 | + | |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
1496 | 1588 | | |
1497 | 1589 | | |
1498 | 1590 | | |
| |||
0 commit comments