Compare commits

..
Author SHA1 Message Date
YXC0915 89ea5866ac 🐛 Restore the wire-2 bundle over a placed bundle link
Exchange the staged driver with the directory entry in GPUBundles so rolling back from a newer runtime replaces the symlink itself. Keep the linked cache intact and use the normal staged-tree cleanup for the displaced link.
2026-12-06 19:15:39 +08:00
8 changed files with 39 additions and 17 deletions

No files matched your search

+1 -1
View File
@@ -34,4 +34,4 @@ Arch = "arm64e"
MinKernel = "23.0.0"
MaxKernel = ""
Comment = "Installs the reims-graphics Metal bundle and admits it"
sha256 = "deb1696453b7d754547abc24e3fa30e5affea059bd19d2d732bee243054a300e"
sha256 = "09853275a5e976bb9c435f76e8f84702f1692b7b98029957404951f626bbebfc"
+5 -5
View File
@@ -3,8 +3,8 @@
# when a source or an output differs from its SHA-256 here (guest/tools/prebuilt.py).
# [built] records the local toolchain; every input is in the tree.
[built]
xcode = "Xcode 27.2 Build version 27B52"
sdk = "MacOSX27.2.sdk"
xcode = "unknown"
sdk = "MacOSX.sdk"
clang = "Apple clang version 21.0.0 (clang-2100.4.1.1)"
[sources]
@@ -445,7 +445,7 @@ clang = "Apple clang version 21.0.0 (clang-2100.4.1.1)"
"guest/rgfxgate/src/RgfxGate.hpp" = "90cf92a9b031fc857dfda215db37a4056ea1919d418289b1d8a2dd056fe9d51c"
"guest/rgfxgate/src/RgfxGateFile.hpp" = "4683d072fe3d0aecc0308eb6e9896bb694a9d2899e44070a17a7859448b10566"
"guest/rgfxgate/src/RgfxGateHooks.cpp" = "3c77cf33042c062ccc41f864801db1759afe145dbaaaa4336e935ddc305d3843"
"guest/rgfxgate/src/RgfxGateInstall.cpp" = "0dd5e94467eb37ad447e638c561148d42bbc5cd2bf0129e290f87e9490d3c9fc"
"guest/rgfxgate/src/RgfxGateInstall.cpp" = "533d7d489d240ef34a065256ad16025dec6f7a1c929db5eae92ed27073a578ef"
"guest/rgfxgate/src/RgfxGatePrefs.cpp" = "19851da9d270161f3c58ae97b35cfc15b2c7484514c287d41cb23f95c83ea3b8"
"guest/rgfxgate/src/RgfxGatePrefs.hpp" = "7a9cbf500b1578ee780470e9b789030dd12c88469fda9d557e65e52cd81b1a07"
"guest/rgfxgate/src/RgfxGateVnop.hpp" = "ca2743778b2c13cfaf48807469f926134bb3813a0963f0dcc3f5346a3e7dd84c"
@@ -466,5 +466,5 @@ clang = "Apple clang version 21.0.0 (clang-2100.4.1.1)"
"ReimsGraphics.kext/Contents/Info.plist" = "9683153587659c4bd4d5c52167eff1f3d2ae51dae575f60c15a27d89240f46c5"
"ReimsGraphics.kext/Contents/MacOS/ReimsGraphics" = "33a086b90fa116b3cf0c6bb826c27f8a55cd83f15522ee794e20186d469bdbc7"
"RgfxGate.kext/Contents/Info.plist" = "7b78d915fab4d36e6cdb3f40aa2a6c1e7224f30158ee879af23451d2e6969992"
"RgfxGate.kext/Contents/MacOS/RgfxGate" = "deb1696453b7d754547abc24e3fa30e5affea059bd19d2d732bee243054a300e"
"set.toml" = "a4da2409f25dd7bf12260de752c38c474b60d4b2d993810a44de0f4b07cb6dfd"
"RgfxGate.kext/Contents/MacOS/RgfxGate" = "09853275a5e976bb9c435f76e8f84702f1692b7b98029957404951f626bbebfc"
"set.toml" = "7b7041b0b0644f18b18ca17f17d7a65eb8d8525f37c8603baf7e81c4519ec066"
Binary file not shown.
+1 -1
View File
@@ -34,4 +34,4 @@ Arch = "x86_64"
MinKernel = "20.0.0"
MaxKernel = ""
Comment = "Installs the reims-graphics Metal bundle and admits it"
sha256 = "90d8327eb2243b820dd90ce29e4be79a80516f3e6341137b76e9b575ea3d10eb"
sha256 = "9801337a4a9b1cd60dc83eaac59f2a64637c123d178dbc63d8247476161810a4"
+5 -5
View File
@@ -3,8 +3,8 @@
# when a source or an output differs from its SHA-256 here (guest/tools/prebuilt.py).
# [built] records the local toolchain; every input is in the tree.
[built]
xcode = "Xcode 27.2 Build version 27B52"
sdk = "MacOSX27.2.sdk"
xcode = "unknown"
sdk = "MacOSX.sdk"
clang = "Apple clang version 21.0.0 (clang-2100.4.1.1)"
[sources]
@@ -445,7 +445,7 @@ clang = "Apple clang version 21.0.0 (clang-2100.4.1.1)"
"guest/rgfxgate/src/RgfxGate.hpp" = "90cf92a9b031fc857dfda215db37a4056ea1919d418289b1d8a2dd056fe9d51c"
"guest/rgfxgate/src/RgfxGateFile.hpp" = "4683d072fe3d0aecc0308eb6e9896bb694a9d2899e44070a17a7859448b10566"
"guest/rgfxgate/src/RgfxGateHooks.cpp" = "3c77cf33042c062ccc41f864801db1759afe145dbaaaa4336e935ddc305d3843"
"guest/rgfxgate/src/RgfxGateInstall.cpp" = "0dd5e94467eb37ad447e638c561148d42bbc5cd2bf0129e290f87e9490d3c9fc"
"guest/rgfxgate/src/RgfxGateInstall.cpp" = "533d7d489d240ef34a065256ad16025dec6f7a1c929db5eae92ed27073a578ef"
"guest/rgfxgate/src/RgfxGatePrefs.cpp" = "19851da9d270161f3c58ae97b35cfc15b2c7484514c287d41cb23f95c83ea3b8"
"guest/rgfxgate/src/RgfxGatePrefs.hpp" = "7a9cbf500b1578ee780470e9b789030dd12c88469fda9d557e65e52cd81b1a07"
"guest/rgfxgate/src/RgfxGateVnop.hpp" = "ca2743778b2c13cfaf48807469f926134bb3813a0963f0dcc3f5346a3e7dd84c"
@@ -466,5 +466,5 @@ clang = "Apple clang version 21.0.0 (clang-2100.4.1.1)"
"ReimsGraphics.kext/Contents/Info.plist" = "ae0dafd3b6c36c24d1c92467d8203d76360eb6e4f6ad5c496167a21033b2c209"
"ReimsGraphics.kext/Contents/MacOS/ReimsGraphics" = "d0277f202173dcecc35bce8aa2ec84cd9d53759a0fd34c26e913bcd65a191d50"
"RgfxGate.kext/Contents/Info.plist" = "7b78d915fab4d36e6cdb3f40aa2a6c1e7224f30158ee879af23451d2e6969992"
"RgfxGate.kext/Contents/MacOS/RgfxGate" = "90d8327eb2243b820dd90ce29e4be79a80516f3e6341137b76e9b575ea3d10eb"
"set.toml" = "49182c19c3d961b251901e19a09016df684f1f102527a0d3274697eaaf3dbab5"
"RgfxGate.kext/Contents/MacOS/RgfxGate" = "9801337a4a9b1cd60dc83eaac59f2a64637c123d178dbc63d8247476161810a4"
"set.toml" = "8947f58f02818cd1ac50e9fad53a77d983f2a424ace8320b5b085a965c1adb6b"
+8 -5
View File
@@ -371,6 +371,8 @@ static void renameIdentity(vnode_t vp, vnode_t olddvp, const char *oldleaf, vnod
// swap (both ends must exist), the two are exchanged atomically
// (VFS_RENAME_SWAP): a reader of `to` always sees one whole tree, never a
// half-swapped one. Without swap, `from` replaces `to`, which need not exist.
// Look up the directory entries themselves: a symlink is exchanged as a link,
// even if dangling, and its target stays where it is.
// Each renamed vnode then takes its new name and parent (renameIdentity), as
// after vn_rename: the installed bundle's vnodes would otherwise keep the
// staging name, reims-graphics.bundle.new.
@@ -378,10 +380,10 @@ static void renameIdentity(vnode_t vp, vnode_t olddvp, const char *oldleaf, vnod
bool rgfxRenameNode(const char *from, const char *to, bool swap,
vfs_context_t ctx) {
vnode_t fvp = nullptr;
if (vnode_lookup(from, 0, &fvp, ctx) != 0)
if (vnode_lookup(from, VNODE_LOOKUP_NOFOLLOW, &fvp, ctx) != 0)
return false; // nothing to rename
vnode_t tvp = nullptr;
if (vnode_lookup(to, 0, &tvp, ctx) != 0)
if (vnode_lookup(to, VNODE_LOOKUP_NOFOLLOW, &tvp, ctx) != 0)
tvp = nullptr; // target absent: a plain rename into a free name
bool ok = false;
if (!(swap && tvp == nullptr)) {
@@ -559,13 +561,14 @@ static bool installBundle(vfs_context_t ctx) {
tagTree(stageRoot, ctx);
if (ok) {
vnode_t live = nullptr;
bool haveLive = vnode_lookup(kBundlePath, 0, &live, ctx) == 0;
// A newer runtime may have placed its bundle behind a symlink.
bool haveLive = vnode_lookup(kBundlePath, VNODE_LOOKUP_NOFOLLOW, &live, ctx) == 0;
if (haveLive)
vnode_put(live);
ok = rgfxRenameNode(stageRoot, kBundlePath, haveLive, ctx);
}
// On a swap the old tree is now at stageRoot; on a move it is gone; on a
// failure the staged tree is still there. One sweep clears whichever remains.
// On a swap the old tree or link is now at stageRoot; on a move it is gone;
// on a failure the staged tree is still there. The sweep never follows links.
removeTree(stageRoot, ctx);
// The container carries the class on every install (it may be freshly made).
tagRootless(kContainerPath, ctx);
+19
View File
@@ -235,6 +235,24 @@ void testLinksAreNotFollowed() {
assert(exists("outside/kept/file"));
}
void testSwappedBundleLinkLeavesItsTarget() {
PosixFs fs;
const char *bundle = "t7/reims-graphics.bundle";
const std::string stage = std::string(bundle) + ".new";
const char *placed = "t7-cache/reims-graphics.bundle";
const char *oldMarker = "t7-cache/reims-graphics.bundle/Contents/Resources/wire-version-3";
mkdirs(std::string(placed) + "/Contents/Resources");
touch(oldMarker);
mkdirs(stage + "/Contents/Resources");
touch(stage + "/Contents/Resources/wire-version-2");
assert(symlink(at(placed).c_str(), at(bundle).c_str()) == 0);
assert(renamex_np(at(stage).c_str(), at(bundle).c_str(), RENAME_SWAP) == 0);
assert(removeTree(stage, fs));
assert(!exists(stage));
assert(exists(std::string(bundle) + "/Contents/Resources/wire-version-2"));
assert(exists(oldMarker));
}
// A tree deeper than the walk descends stops it, and the walk says so; what
// lies outside the tree is untouched.
void testTooDeep() {
@@ -296,6 +314,7 @@ int main() {
testLeftoverOfAnOlderBuild();
testShapes();
testLinksAreNotFollowed();
testSwappedBundleLinkLeavesItsTarget();
testTooDeep();
testStuck();
testPathTooLong();