mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
ca2eb275de
Closes #10782 In some cases, during the auto-update process, the update can fail and leave a dangling disk image in macOS. If the auto-update fails again, a new dangling mounted volume will be left behind. To avoid polluting the system with these dangling mounted disk images, implement [the `Drop` trait](https://doc.rust-lang.org/std/ops/trait.Drop.html) for the `MacOSUnmounter` struct. This will ensure that the disk image is unmounted when the `install_release_macos` function exits regardless of its result. ## How to test this locally Unfortunately, I was a bit too lazy to find a smarter way to test this, so I simply commented out a bunch of lines to emulate the auto-update process. To replicate the linked issue (#10782), you can apply the attached patch. Build the Zed binary and run it. The auto-update should fail, leaving the dangling mounted disk image in the system: ```shell >diskutil list /dev/disk5 (synthesized): #: TYPE NAME SIZE IDENTIFIER 0: APFS Container Scheme - +220.6 MB disk5 Physical Store disk4s1 1: APFS Volume Zed 190.6 MB disk5s1 ``` Run the Zed binary again to create another mounted disk image: ```shell >diskutil list /dev/disk5 (synthesized): #: TYPE NAME SIZE IDENTIFIER 0: APFS Container Scheme - +220.6 MB disk5 Physical Store disk4s1 1: APFS Volume Zed 190.6 MB disk5s1 /dev/disk7 (synthesized): #: TYPE NAME SIZE IDENTIFIER 0: APFS Container Scheme - +220.6 MB disk7 Physical Store disk6s1 1: APFS Volume Zed 190.6 MB disk7s1 ``` [simulate_zed_autoupdate.patch](https://github.com/user-attachments/files/16787955/simulate_zed_autoupdate.patch) Please let me know if the fix is good; otherwise, I am happy to implement it differently. Thanks! Release Notes: - Fixed #10782 |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
LICENSE-GPL |