Skip to content

ADB.push() misresolves file/directory by extension, breaking minicap install #1321

Description

@dlstjd0237

Remove any following parts if does not have details about

Describe the bug
A clear and concise description of what the bug is. Or paste traceback below.

ADB.push(local, remote) decides file vs. directory by extension, causing wrong path resolution.

To Reproduce
Case 1. Pushing a file with no extension (e.g. executable binary)
remote has no extension → misinterpreted as a directory → file copied to wrong location.

Case 2. Directory name contains . (e.g. /sdcard/com.test.app/files)
Treated as if it had an extension → directory misinterpreted as a file → push fails.

Case 3. Local is a directory but remote has an extension (e.g. push("./logs", "/sdcard/backup.zip"))
Misinterpreted as a file → internal rm / mv target paths get tangled.

Case 4. Directory contents not copied after push
Shell glob (*) used when moving from tmp to final path doesn't expand as intended → files reach tmp but nothing arrives at the final destination.

Expected behavior
Target type determined by actual path state, not extension.
Files and directories end up intact at the specified remote path.

python version: python3.9

airtest version: 1.4.3

Additional context
Related PR: The same issue was previously reported and fixed in AirtestProject/Airtest#1288 — "Fix adb.push fail to push no extension file (cause minicap installation failure)". That PR separated the previously tangled file / folder handling logic.
Suspected regression point: Commit a9722c4 ("fix: push bug") appears to have effectively reverted PR #1288. It changes os.path.isfile(local) to os.path.isfile(remote), but remote is an Android device path (e.g. /sdcard/...) that does not exist on the local filesystem, so the check always evaluates to False. As a result, the fix from #1288 is bypassed and the original extensionless-file handling bug is back.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions