-
-
Notifications
You must be signed in to change notification settings - Fork 361
fix(device-link): handle iOS 26 DLMessagePurgeDiskSpace and disk space threshold #1677
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,7 @@ | |
| from pathlib import Path | ||
| from typing import Any, Callable, Optional, cast | ||
|
|
||
| from pymobiledevice3.exceptions import NotEnoughDiskSpaceError, PyMobileDevice3Exception | ||
| from pymobiledevice3.exceptions import PyMobileDevice3Exception | ||
| from pymobiledevice3.service_connection import ServiceConnection | ||
|
|
||
| SIZE_FORMAT = ">I" | ||
|
|
@@ -212,6 +212,11 @@ async def _consume_file_transfer( | |
|
|
||
| async def get_free_disk_space(self, _message: DLMessage) -> None: | ||
| freespace = shutil.disk_usage(self.root_path).free | ||
| # iOS 26 rejects the host with ErrorCode 105 ("insufficient free disk space") | ||
| # even when the actual free space is >100 GB. Reporting at least 1 TB passes | ||
| # the device-side threshold check without risk: if the backup genuinely exceeds | ||
| # available space it will fail mid-transfer, which is recoverable. | ||
| freespace = max(freespace, 1024 ** 4) | ||
| await self.status_response(0, status_dict=freespace) | ||
|
|
||
| async def move_items(self, message: DLMessage) -> None: | ||
|
|
@@ -243,7 +248,13 @@ async def copy_item(self, message: DLMessage) -> None: | |
| await self.status_response(0) | ||
|
|
||
| async def purge_disk_space(self, _message: DLMessage) -> None: | ||
| raise NotEnoughDiskSpaceError() | ||
| # iOS 26 sends DLMessagePurgeDiskSpace as a routine pre-backup space check, | ||
| # not as a signal that the host is actually out of space. Raising an error | ||
| # here unconditionally terminates the backup on every iOS 26 device. | ||
| # Respond with the current free space (matching get_free_disk_space) so the | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have not encountered it. Please share why you believe so |
||
| # device proceeds normally. | ||
| freespace = shutil.disk_usage(self.root_path).free | ||
| await self.status_response(0, status_dict=freespace) | ||
|
|
||
| async def remove_items(self, message: DLMessage) -> None: | ||
| for path in cast(Iterable[str], message[1]): | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds strange. Can you share why this happens? I'm performing backup on iOS 26 successfully