Skip to content

Conversation

@ricnava00
Copy link
Contributor

I have no idea why, but `su -h` hanged. Using `which su` should have the same effect without locking
Without waiting, all commands are executed simultaneously which, for me, resulted in the pushed apk having the contents of the script
@ricnava00 ricnava00 changed the title --mount fixes fix: --mount fixes Oct 9, 2023
@oSumAtrIX
Copy link
Member

Please explain the change, I do not see why these changes make a difference or how they change behaviour.

@ricnava00
Copy link
Contributor Author

ricnava00 commented Oct 9, 2023

As written in the issue, patching with --mount freezes instantly. It seems that using su -h is the culprit, but I don't know why. Replacing it with which su has the same function, it gives a non-0 exit code if su is not found. For some reason this command seems to be unaffected by the hanging issue. I can confirm this works on my device.

The second commit, as I wrote in its description, solves an out-of-order problem. All the commands were run concurrently, without waiting for the previous ones to finish.
So, for example, instead of:

  • Push the APK to the temp file
  • Move it to the APK's final directory
  • Write the mounting script to the temp file
  • Move it to the script's final directory
  • Execute it
  • Open the target app

You could have runs like (as in my case):

  • Push the APK to the temp file
  • Write the mounting script to the temp file
  • Move the temp file, now containing the script, to the APK's final directory
  • ...

Which is not the intended result.
Adding waitFor after running each command ensures that it has completed before running the next one

Also, I was imprecise. I meant that this should solve ReVanced/revanced-cli#267, and combined with ReVanced/revanced-cli#278 all problems with --mount should be solved. This PR has no direct dependency on ReVanced/revanced-cli#278

@oSumAtrIX oSumAtrIX changed the base branch from main to dev October 9, 2023 23:22
@oSumAtrIX oSumAtrIX changed the title fix: --mount fixes fix: Execute ADB commands sequentially to fix mounting issues Oct 9, 2023
@oSumAtrIX oSumAtrIX merged commit fda3eca into ReVanced:dev Oct 9, 2023
@welcome
Copy link

welcome bot commented Oct 9, 2023

Thank you for contributing to ReVanced. Join us on Discord if you want to receive a contributor role.

ReVancedBot pushed a commit that referenced this pull request Oct 9, 2023
## [1.1.4-dev.1](v1.1.3...v1.1.4-dev.1) (2023-10-09)

### Bug Fixes

* Execute ADB commands sequentially to fix mounting issues ([#12](#12)) ([fda3eca](fda3eca))
@PalmDevs
Copy link
Member

@ricnava00 which su does not return a non-zero exit code when superuser is disallowed for Shell. Any other commands you'd like to suggest? su -h freezes for me too only with CLI it seems, not in normal adb shell.

@PalmDevs
Copy link
Member

Okay, so doing the following seems to work for me. Can you confirm with your device too?

this.startCommand("su -c \"echo test\"", false).waitFor == 0

With superuser enabled
image

With superuser disabled
image

@PalmDevs
Copy link
Member

Putting comments inside instead of a command works too:

this.startCommand("su -c \"# hello world\"", false).waitFor() == 0

@ricnava00
Copy link
Contributor Author

Yes, I can confirm this works on my device too

ReVancedBot pushed a commit that referenced this pull request Oct 12, 2023
## [1.1.4](v1.1.3...v1.1.4) (2023-10-12)

### Bug Fixes

* Ask for root permissions before trying to use them ([aea1d69](aea1d69))
* Execute ADB commands sequentially to fix mounting issues ([#12](#12)) ([fda3eca](fda3eca))
github-actions bot pushed a commit to inotia00/revanced-library that referenced this pull request Dec 7, 2024
# 1.0.0 (2024-12-07)

### Bug Fixes

* Add missing log when calling `UserAdbManager#install` ([90b612b](90b612b))
* Ask for root permissions before trying to use them ([aea1d69](aea1d69))
* Catch exceptions when serializing invalid patch options ([cd73bd3](cd73bd3))
* Check if file exists before trying to open it ([8ddc6e9](8ddc6e9))
* Delete mount script ([4fe0fb0](4fe0fb0))
* Detect if app is installed by fixing inversion ([649f06b](649f06b))
* Differentiate no package compatibility to any version compatibility ([762b7e3](762b7e3))
* Do not specify a provider to automatically select an available one ([249372c](249372c))
* Execute ADB commands sequentially to fix mounting issues ([ReVanced#12](https://github.com/inotia00/revanced-library/issues/12)) ([fda3eca](fda3eca))
* Make functions internal which are supposed to be internal ([893d22d](893d22d))
* Make property private ([51109c4](51109c4))
* Map dependencies from `KClass` into `String` to fix serialization ([57e36ab](57e36ab))
* Only load the keystore once per instantiation ([5993f7e](5993f7e))
* Serialize compatible packages as a map instead of a set of pairs. ([737e272](737e272))
* Sign APKs using `apksig` ([f59ecbc](f59ecbc))
* Sort the version maps by the most common version ([e4be6db](e4be6db))
* Support mounting even when Magisk is not installed ([2a30845](2a30845))
* Use `BKS` instead of default signing provider to fix backwards compatibility ([41805fc](41805fc))
* Use correct function name casing ([ef38d8b](ef38d8b))
* Use the JVM name instead of the value from `KClass#toString` ([d18e436](d18e436))

### Build System

* Refactor to DSL to bump ReVanced Patcher ([7f5d6da](7f5d6da))

### Features

* Add `PatchUtils#getMostCommonCompatibleVersions` utility function ([c5f3536](c5f3536))
* add `rip-libs` ([23df153](23df153))
* add compatibility with keystores generated in CLI v3.0 ([907124a](907124a))
* Add initial project structure ([833291d](833291d))
* Add JSON de- and serialization of patches ([ecff6fe](ecff6fe))
* Add local Android installer ([ReVanced#25](https://github.com/inotia00/revanced-library/issues/25)) ([43d655a](43d655a))
* Add utility function around key certificate pairs ([2df3484](2df3484))
* Allow getting most common compatible versions for all packages ([96845ba](96845ba))
* Improve exception message ([b15efa4](b15efa4))
* Improve mount reliability by unmounting existing mounts and killing running apps ([9fda407](9fda407))
* Increase certainty of the possibility to mount ([10f8cd1](10f8cd1))
* Increase default expiration date of certificate ([f2bd3f5](f2bd3f5))
* Increase the key size to 4096 ([892e083](892e083))
* Log warnings when compiling resources ([1dc8e2e](1dc8e2e))
* Mention APK file name when logging aligning ([244ebc2](244ebc2))
* Remove deprecated functions ([b9bf3bc](b9bf3bc))
* revert Options object ([99d81d1](99d81d1))
* Select first Adb device, if none supplied automatically ([1a5f868](1a5f868))
* Simplify signing utility API ([4c6a636](4c6a636))
* Use `apkzlib` instead of own implementations and bump ReVanced Patcher ([3aa6dc2](3aa6dc2))
* Use better log messages when handling exceptions ([5896968](5896968))
* Warn when option could not be set because the option does not exist ([7ec6504](7ec6504))

### Performance Improvements

* Use maps to set options ([13823b7](13823b7))

### BREAKING CHANGES

* Some functions have been removed.
* Some functions are not available anymore.
* The signature of some functions has changed.
* This commit removes deprecated APIs and bumps ReVanced Patcher. Because of it's changes, `apkzlib` is now used instead of own implementations of `ZipFile`
github-actions bot pushed a commit to brosssh/revanced-library that referenced this pull request Nov 28, 2025
# 1.0.0-dev.1 (2025-11-28)

### Bug Fixes

* Add missing log when calling `UserAdbManager#install` ([90b612b](90b612b))
* Add my repo to maven ([3c575a6](3c575a6))
* Ask for root permissions before trying to use them ([aea1d69](aea1d69))
* Catch exceptions when serializing invalid patch options ([cd73bd3](cd73bd3))
* Check if file exists before trying to open it ([8ddc6e9](8ddc6e9))
* Delete mount script ([4fe0fb0](4fe0fb0))
* Detect if app is installed by fixing inversion ([649f06b](649f06b))
* Differentiate no package compatibility to any version compatibility ([762b7e3](762b7e3))
* Do not specify a provider to automatically select an available one ([249372c](249372c))
* Execute ADB commands sequentially to fix mounting issues ([ReVanced#12](https://github.com/brosssh/revanced-library/issues/12)) ([fda3eca](fda3eca))
* Make functions internal which are supposed to be internal ([893d22d](893d22d))
* Make property private ([51109c4](51109c4))
* Map dependencies from `KClass` into `String` to fix serialization ([57e36ab](57e36ab))
* Only load the keystore once per instantiation ([5993f7e](5993f7e))
* Serialize compatible packages as a map instead of a set of pairs. ([737e272](737e272))
* Sign APKs using `apksig` ([f59ecbc](f59ecbc))
* Sort the version maps by the most common version ([e4be6db](e4be6db))
* Support mounting even when Magisk is not installed ([2a30845](2a30845))
* Use `BKS` instead of default signing provider to fix backwards compatibility ([41805fc](41805fc))
* Use correct function name casing ([ef38d8b](ef38d8b))
* Use the JVM name instead of the value from `KClass#toString` ([d18e436](d18e436))

### Build System

* Refactor to DSL to bump ReVanced Patcher ([7f5d6da](7f5d6da))

### Features

* Add `PatchUtils#getMostCommonCompatibleVersions` utility function ([c5f3536](c5f3536))
* Add initial project structure ([833291d](833291d))
* Add JSON de- and serialization of patches ([ecff6fe](ecff6fe))
* Add local Android installer ([ReVanced#25](https://github.com/brosssh/revanced-library/issues/25)) ([43d655a](43d655a))
* Add utility function around key certificate pairs ([2df3484](2df3484))
* Allow getting most common compatible versions for all packages ([96845ba](96845ba))
* Improve exception message ([b15efa4](b15efa4))
* Improve mount reliability by unmounting existing mounts and killing running apps ([9fda407](9fda407))
* Increase certainty of the possibility to mount ([10f8cd1](10f8cd1))
* Increase default expiration date of certificate ([f2bd3f5](f2bd3f5))
* Increase the key size to 4096 ([892e083](892e083))
* Installing app with ownership enforcement ([bfabb7f](bfabb7f))
* Log warnings when compiling resources ([1dc8e2e](1dc8e2e))
* Mention APK file name when logging aligning ([244ebc2](244ebc2))
* Remove deprecated functions ([b9bf3bc](b9bf3bc))
* Select first Adb device, if none supplied automatically ([1a5f868](1a5f868))
* Simplify signing utility API ([4c6a636](4c6a636))
* Use `apkzlib` instead of own implementations and bump ReVanced Patcher ([3aa6dc2](3aa6dc2))
* Use better log messages when handling exceptions ([5896968](5896968))
* Warn when option could not be set because the option does not exist ([7ec6504](7ec6504))

### Performance Improvements

* Use maps to set options ([13823b7](13823b7))

### BREAKING CHANGES

* Some functions have been removed.
* Some functions are not available anymore.
* The signature of some functions has changed.
* This commit removes deprecated APIs and bumps ReVanced Patcher. Because of it's changes, `apkzlib` is now used instead of own implementations of `ZipFile`
github-actions bot pushed a commit to brosssh/revanced-library that referenced this pull request Nov 28, 2025
# 1.0.0 (2025-11-28)

### Bug Fixes

* Add missing log when calling `UserAdbManager#install` ([90b612b](90b612b))
* Add my repo to maven ([3c575a6](3c575a6))
* Ask for root permissions before trying to use them ([aea1d69](aea1d69))
* Catch exceptions when serializing invalid patch options ([cd73bd3](cd73bd3))
* Check if file exists before trying to open it ([8ddc6e9](8ddc6e9))
* Delete mount script ([4fe0fb0](4fe0fb0))
* Detect if app is installed by fixing inversion ([649f06b](649f06b))
* Differentiate no package compatibility to any version compatibility ([762b7e3](762b7e3))
* Do not specify a provider to automatically select an available one ([249372c](249372c))
* Execute ADB commands sequentially to fix mounting issues ([ReVanced#12](https://github.com/brosssh/revanced-library/issues/12)) ([fda3eca](fda3eca))
* Make functions internal which are supposed to be internal ([893d22d](893d22d))
* Make property private ([51109c4](51109c4))
* Map dependencies from `KClass` into `String` to fix serialization ([57e36ab](57e36ab))
* Only load the keystore once per instantiation ([5993f7e](5993f7e))
* Serialize compatible packages as a map instead of a set of pairs. ([737e272](737e272))
* Sign APKs using `apksig` ([f59ecbc](f59ecbc))
* Sort the version maps by the most common version ([e4be6db](e4be6db))
* Support mounting even when Magisk is not installed ([2a30845](2a30845))
* Use `BKS` instead of default signing provider to fix backwards compatibility ([41805fc](41805fc))
* Use correct function name casing ([ef38d8b](ef38d8b))
* Use the JVM name instead of the value from `KClass#toString` ([d18e436](d18e436))

### Build System

* Refactor to DSL to bump ReVanced Patcher ([7f5d6da](7f5d6da))

### Features

* Add `PatchUtils#getMostCommonCompatibleVersions` utility function ([c5f3536](c5f3536))
* Add initial project structure ([833291d](833291d))
* Add JSON de- and serialization of patches ([ecff6fe](ecff6fe))
* Add local Android installer ([ReVanced#25](https://github.com/brosssh/revanced-library/issues/25)) ([43d655a](43d655a))
* Add utility function around key certificate pairs ([2df3484](2df3484))
* Allow getting most common compatible versions for all packages ([96845ba](96845ba))
* Improve exception message ([b15efa4](b15efa4))
* Improve mount reliability by unmounting existing mounts and killing running apps ([9fda407](9fda407))
* Increase certainty of the possibility to mount ([10f8cd1](10f8cd1))
* Increase default expiration date of certificate ([f2bd3f5](f2bd3f5))
* Increase the key size to 4096 ([892e083](892e083))
* Installing app with ownership enforcement ([bfabb7f](bfabb7f))
* Log warnings when compiling resources ([1dc8e2e](1dc8e2e))
* Mention APK file name when logging aligning ([244ebc2](244ebc2))
* Remove deprecated functions ([b9bf3bc](b9bf3bc))
* Select first Adb device, if none supplied automatically ([1a5f868](1a5f868))
* Simplify signing utility API ([4c6a636](4c6a636))
* Use `apkzlib` instead of own implementations and bump ReVanced Patcher ([3aa6dc2](3aa6dc2))
* Use better log messages when handling exceptions ([5896968](5896968))
* Warn when option could not be set because the option does not exist ([7ec6504](7ec6504))

### Performance Improvements

* Use maps to set options ([13823b7](13823b7))

### BREAKING CHANGES

* Some functions have been removed.
* Some functions are not available anymore.
* The signature of some functions has changed.
* This commit removes deprecated APIs and bumps ReVanced Patcher. Because of it's changes, `apkzlib` is now used instead of own implementations of `ZipFile`
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.

3 participants