Repository navigation
Commit c50be52
* Start refactor for #1144
Assisted-by: Claude Code:claude-opus-5-5
* Write the VEX document by stage + rename
`vex --output` and the embedded `--vex <path>` of apply, vendor and
scan wrote the OpenVEX document with `tokio::fs::write`, which
truncates the file and writes in place. A write that failed part-way
(full disk, quota, file-size limit) left a truncated document that
still starts with an OpenVEX header; the failure cleanup cannot parse
it, so it stayed, against the documented "a failed run leaves no
document" contract.
The document now goes through `utils::fs::write_user_output`, the
shared stage + rename core with the destination's mode kept: a failed
write leaves the previous document, which the cleanup then removes. A
symlinked output is written through to its target, and /dev/stdout, a
FIFO or a device is still written in place. The write is never held
back by an open group commit. The `write_failed` code and message are
unchanged.
Fixes #1144
Assisted-by: Claude Code:claude-opus-5-5
* Write Windows device outputs in place
On Windows, std reports NUL, CON and named pipes as files, so
`--vex NUL` would have staged a regular file and failed to rename it
over the device with write_failed. A DOS device name or a \\.\ path
is now written in place, as /dev/stdout and FIFOs are on Unix.
Assisted-by: Claude Code:claude-opus-5-5
* Keep the size-limited VEX test out of coverage
The regression test runs the CLI under RLIMIT_FSIZE = 512 bytes. In
the coverage job that limit also truncated the child's exit-time
.profraw, and llvm-profdata refused to merge the corrupt profile, so
the coverage job failed. The limited run now writes its profile to
/dev/null, which the limit does not cover.
Assisted-by: Claude Code:claude-opus-5-5
* Write /dev and /proc output paths in place
`vex --output /dev/stdout > vex.json` follows /dev/stdout to the file
fd 1 points at, which is regular, so the document was staged and
renamed over it: the caller's open descriptor kept the old empty
inode, macOS failed because /dev/fd holds no stage, and with fd 1 on
a deleted file a root run could stage in /dev and replace /dev/stdout.
A path that is, or links through, anything under /dev or /proc
(/dev/stdout, /dev/fd/1, /proc/self/fd/1, a user's link to one) is
now written in place, as before this branch. The link chain is read
hop by hop, never canonicalized, since canonicalizing /proc/self/fd/1
yields the regular file behind it.
Assisted-by: Claude Code:claude-opus-5-5
* Treat only descriptor paths as output streams
The in-place rule matched every path under /dev or /proc, so a
regular file on /dev/shm or reached through /proc/self/cwd skipped
stage + rename and could again be left truncated by a failed write.
Only /dev/std{in,out,err}, /dev/fd/<n> and /proc/<pid>/fd/<n> (or a
link to one) are written in place now.
Assisted-by: Claude Code:claude-opus-5-5
---------
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 6c01c7f commit c50be52
3 files changed
Lines changed: 434 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
912 | 912 | | |
913 | 913 | | |
914 | 914 | | |
915 | | - | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
916 | 919 | | |
917 | 920 | | |
918 | 921 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1559 | 1559 | | |
1560 | 1560 | | |
1561 | 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 | + | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
| 1592 | + | |
| 1593 | + | |
| 1594 | + | |
| 1595 | + | |
| 1596 | + | |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
| 1630 | + | |
| 1631 | + | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
| 1635 | + | |
| 1636 | + | |
| 1637 | + | |
| 1638 | + | |
| 1639 | + | |
| 1640 | + | |
| 1641 | + | |
| 1642 | + | |
| 1643 | + | |
| 1644 | + | |
| 1645 | + | |
| 1646 | + | |
| 1647 | + | |
| 1648 | + | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + | |
| 1654 | + | |
| 1655 | + | |
| 1656 | + | |
| 1657 | + | |
| 1658 | + | |
| 1659 | + | |
| 1660 | + | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
| 1665 | + | |
| 1666 | + | |
| 1667 | + | |
| 1668 | + | |
| 1669 | + | |
| 1670 | + | |
| 1671 | + | |
| 1672 | + | |
| 1673 | + | |
| 1674 | + | |
| 1675 | + | |
| 1676 | + | |
| 1677 | + | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
| 1681 | + | |
| 1682 | + | |
| 1683 | + | |
| 1684 | + | |
| 1685 | + | |
| 1686 | + | |
| 1687 | + | |
| 1688 | + | |
| 1689 | + | |
| 1690 | + | |
| 1691 | + | |
| 1692 | + | |
| 1693 | + | |
| 1694 | + | |
| 1695 | + | |
| 1696 | + | |
| 1697 | + | |
| 1698 | + | |
| 1699 | + | |
| 1700 | + | |
| 1701 | + | |
| 1702 | + | |
| 1703 | + | |
| 1704 | + | |
| 1705 | + | |
| 1706 | + | |
| 1707 | + | |
| 1708 | + | |
| 1709 | + | |
| 1710 | + | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
| 1714 | + | |
| 1715 | + | |
| 1716 | + | |
| 1717 | + | |
| 1718 | + | |
| 1719 | + | |
| 1720 | + | |
| 1721 | + | |
| 1722 | + | |
| 1723 | + | |
| 1724 | + | |
| 1725 | + | |
| 1726 | + | |
| 1727 | + | |
| 1728 | + | |
| 1729 | + | |
| 1730 | + | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
| 1735 | + | |
| 1736 | + | |
| 1737 | + | |
| 1738 | + | |
1562 | 1739 | | |
1563 | 1740 | | |
1564 | 1741 | | |
| |||
0 commit comments