mobile_image_mounter: survive the CopyDevices hangup on legacy devices - #1898
Merged
Conversation
doronz88
force-pushed
the
bugfix/legacy-copy-devices-hangup
branch
from
September 1, 2026 20:25
4129fcf to
0a9b3a8
Compare
2 tasks
The is_image_mounted() CopyDevices fallback (added for the iOS 27.0
empty-ImageSignature quirk) broke mounting on legacy devices: their
mobile_storage_proxy (observed on iOS 12.5.7) answers the unknown
command with UnknownCommand and then hangs up the connection, so the
next command - upload_image()'s ReceiveBytes - failed with
ConnectionResetError('Connection lost').
When CopyDevices turns out unsupported, drop the hung-up connection so
the next command transparently reconnects, and remember the command is
unsupported so later mounted-checks in the same flow do not provoke the
hangup again.
Fixes #1897
doronz88
force-pushed
the
bugfix/legacy-copy-devices-hangup
branch
from
September 1, 2026 21:08
0a9b3a8 to
624aec0
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #1897.
The
is_image_mounted()CopyDevices fallback (introduced in 9a09145 for the iOS 27.0 empty-ImageSignaturequirk, first shipped in v10.10.0) broke Developer image mounting on legacy devices. Theirmobile_storage_proxy(observed on iOS 12.5.7) answers the unknownCopyDevicescommand withUnknownCommandand then hangs up the connection. The fallback swallowed that as "not supported", but left the mounter on the dead socket, so the next command —upload_image()'sReceiveBytes— failed withConnectionResetError('Connection lost'). (The reported traceback pins this down: bothLookupImageandCopyDevicescompleted full round trips, and the transport was already marked lost whenReceiveByteswas sent.)The fix: when
CopyDevicesturns out unsupported, drop the hung-up connection (close()) so the lazy service proxy transparently reconnects for the next command, and memoize that the command is unsupported so the second mounted-check insidemount_image()does not provoke the hangup again.Verified:
UnknownCommand, then hangs up): fails withConnectionResetError: Connection lostbefore the fix, passes after.test_is_image_mounted_agrees_with_copy_devicespasses against an iPhone 11 on iOS 27.0, confirming the iOS 27 fallback behavior is unchanged whereCopyDevicesis supported.ruff checkandpyright@1.1.411 --venvpath .clean.