Skip to content

fix: require a complete files segment when finding Android app folders - #621

Merged
gaborbernat merged 4 commits into
tox-dev:mainfrom
shoaibulhaque:fix/android-files-boundary
Oct 17, 2026
Merged

gaborbernat merged 4 commits into
tox-dev:mainfrom
shoaibulhaque:fix/android-files-boundary

Conversation

@shoaibulhaque

Copy link
Copy Markdown
Contributor

Problem

The Android fallback searches sys.path for an app's files directory. Both path patterns stop at /files without checking the end of that segment. They also match paths under filesystem or files-backup, so an unrelated entry can select the wrong app directory before a valid entry is considered.

Fix

Require a slash or the end of the path immediately after files. Apply the same check to internal and adopted storage, using the existing regular-expression patterns.

Tests

  • Add public-API regressions for files-prefixed directories in internal, secondary-user and adopted storage.
  • All three cases fail on the original implementation.
  • The full suite passes: 2236 passed, 125 skipped on Linux with Python 3.12. Host-specific XDG_DATA_DIRS and XDG_CONFIG_DIRS were unset for this run.
  • Existing tests still cover exact files paths, children under files, package names starting with files, and nested files directories.
  • Ruff lint, Ruff format, type and whitespace checks pass.

The sys.path fallback matches the start of /files without checking
the end of the segment. Paths under filesystem or files-backup are
therefore mistaken for the Android app's files directory.

Require a slash or the end of the path after files in both storage
patterns. Add public-API regressions for internal, secondary-user,
and adopted-storage paths. Existing valid path cases still pass.

Validation: 2236 tests pass and 125 are skipped with host XDG list
variables unset. Ruff, type and whitespace checks pass.
@gaborbernat
gaborbernat merged commit da72995 into tox-dev:main Oct 17, 2026
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants