"/system/bin/sh: no closing quote" #65

Closed
opened 3 months ago by GfE · 3 comments
GfE commented 3 months ago

Describe the bug

A clear and concise description of what the bug is.

To Reproduce

Steps to reproduce the behavior:

  1. Set up config/ and therein, some config files based on doc/config.sample with only minor changes (see below)
  2. connect one of the corresponding devices
  3. $ ./adebar-cli -a

Precise error message (if any):

"/system/bin/sh: no closing quote", which sounds fishy.
Moreover, there is no /system/bin/sh at my system.

Here is the terminal printout (serial obfuscated):

Adebar running:
Gathering lists of installed apps
Creating script to disable apps currently disabled
Creating script to enable ALL apps
Checking default install-location
Collecting partition details
Generating script to create partition images
Collecting device information
/downloads/adebar/lib/dummydevs.lib: line 47: adb -s XXXXXXXXXXXXXXXX shell dumpsys device_policy: command not found
  ! Skipping device policy (could not obtain data)
Pulling configuration files
/system/bin/sh: no closing quote
Generating app detail info
Creating backup/restore scripts for UserApps
Creating backup/restore scripts for SytemApps
PostProcessing and Cleanup
Adebar done.

Expected behavior

The command should succeed without error.

Desktop (please complete the following information):

  • OS: LXLE 18.4.3
  • Bash Version: 4.4.20
  • Adebar Version:
    master.tar.gz, fetched Feb 25, 2022
  • Configuration settings made (aside from serial and name):
    @@ -84 +84 @@
    +MK_SYSAPPS=0
    -MK_SYSAPPS=1
    @@ -99 +99 @@
    +MK_DEVICEINFO_DEVICEPOLICY=0
    -MK_DEVICEINFO_DEVICEPOLICY=1
    @@ -104 +104 @@
    +MK_PARTBACKUP=0
    -MK_PARTBACKUP=1

Smartphone (please complete the following information):

  • Device: Samsung J3 (J330FN)
  • OS Version: Android 9
  • ROM stock

Additional context

All those lines are sent to stdout, with the exception of these two stderr messages:

/downloads/adebar/lib/dummydevs.lib: line 47: adb -s XXXXXXXXXXXXXXXX shell dumpsys device_policy: command not found
/system/bin/sh: no closing quote

Therefore, their timing (i. e. order) in the mixed printout may be a bit off, i. e. the "no closing quote" warning is not necessarily triggered by "Pulling configuration files" but possibly by one of the other steps.

**Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior: 1. Set up config/ and therein, some config files based on doc/config.sample with only minor changes (see below) 2. connect one of the corresponding devices 3. $ ./adebar-cli -a **Precise error message (if any):** "/system/bin/sh: no closing quote", which sounds fishy. Moreover, there is no /system/bin/sh at my system. Here is the terminal printout (serial obfuscated): ``` Adebar running: Gathering lists of installed apps Creating script to disable apps currently disabled Creating script to enable ALL apps Checking default install-location Collecting partition details Generating script to create partition images Collecting device information /downloads/adebar/lib/dummydevs.lib: line 47: adb -s XXXXXXXXXXXXXXXX shell dumpsys device_policy: command not found ! Skipping device policy (could not obtain data) Pulling configuration files /system/bin/sh: no closing quote Generating app detail info Creating backup/restore scripts for UserApps Creating backup/restore scripts for SytemApps PostProcessing and Cleanup Adebar done. ``` **Expected behavior** The command should succeed without error. **Desktop (please complete the following information):** - OS: LXLE 18.4.3 - Bash Version: 4.4.20 - Adebar Version: master.tar.gz, fetched Feb 25, 2022 - Configuration settings made (aside from serial and name): @@ -84 +84 @@ +MK_SYSAPPS=0 -MK_SYSAPPS=1 @@ -99 +99 @@ +MK_DEVICEINFO_DEVICEPOLICY=0 -MK_DEVICEINFO_DEVICEPOLICY=1 @@ -104 +104 @@ +MK_PARTBACKUP=0 -MK_PARTBACKUP=1 **Smartphone (please complete the following information):** - Device: Samsung J3 (J330FN) - OS Version: Android 9 - ROM stock **Additional context** All those lines are sent to stdout, with the exception of these two stderr messages: ``` /downloads/adebar/lib/dummydevs.lib: line 47: adb -s XXXXXXXXXXXXXXXX shell dumpsys device_policy: command not found /system/bin/sh: no closing quote ``` Therefore, their timing (i. e. order) in the mixed printout may be a bit off, i. e. the "no closing quote" warning is not necessarily triggered by "Pulling configuration files" but possibly by one of the other steps.
Owner

there is no /system/bin/sh at my system.

That error message comes from your Android device. Thanks to the output you provided, we can pin-point it to "pulling configuration files". I assume your device is not rooted (at least you run Adebar in no-root mode). Yupp, I think I found the culprit. In lib/pull_config.lib, can you change line 47

      adb ${ADBOPTS} shell "ls /data/misc/apexdata/com.android.wifi/WifiConfigStore.xml' >/dev/null 2>&1"

and remove the single-quote after .xml, then run Adebar again to see if the error is gone? I expect it to, so the first part would be solved.


The second one (funnily the same line number) is a dynamic execution, so the real "error" is located at a different place. The caller is in line 616 of lib/deviceinfo.lib – and is the same whether root-mode or not. I cannot reproduce that error here and have no idea why it happens or which command is not found: adb on the PC? Then all else wouldn't work either. dumpsys on the device? Makes no sense, as Adebar uses that in other places too. The entire string being interpreted as a single command? Again makes no sense as the same syntax is used all over in Adebar's libs.

To narrow things down: Can you execute that command (adb -s XXX shell dumpsys device_policy) directly at the shell of your PC? If that also results in an error, run dumpsys device_policy on the Android device's shell. The only thing I could think of is device_policy being "blocked" somehow, though I'd expect a different error message then.

> there is no /system/bin/sh at my system. That error message comes from your Android device. Thanks to the output you provided, we can pin-point it to "pulling configuration files". I assume your device is not rooted (at least you run Adebar in no-root mode). Yupp, I think I found the culprit. In `lib/pull_config.lib`, can you change line 47 ```bash adb ${ADBOPTS} shell "ls /data/misc/apexdata/com.android.wifi/WifiConfigStore.xml' >/dev/null 2>&1" ``` and remove the single-quote after `.xml`, then run Adebar again to see if the error is gone? I expect it to, so the first part would be solved. ---- The second one (funnily the same line number) is a dynamic execution, so the real "error" is located at a different place. The caller is in line 616 of `lib/deviceinfo.lib` – and is the same whether root-mode or not. I cannot reproduce that error here and have no idea why it happens or *which* command is not found: `adb` on the PC? Then all else wouldn't work either. `dumpsys` on the device? Makes no sense, as Adebar uses that in other places too. The entire string being interpreted as a single command? Again makes no sense as the same syntax is used all over in Adebar's libs. To narrow things down: Can you execute that command (`adb -s XXX shell dumpsys device_policy`) directly at the shell of your PC? If that also results in an error, run `dumpsys device_policy` on the Android device's shell. The only thing I could think of is `device_policy` being "blocked" somehow, though I'd expect a different error message then.
Owner

Did you have a chance to test, @GfE?

Did you have a chance to test, @GfE?
izzy referenced this issue from a commit 2 months ago
Owner

OK, as there was no response, I double-checked (yupp, must have been a copy-pasta error), adjusted and pushed. Closing this issue now as fixed. Should it not have solved your problem, just leave another comment (or open another issue). Thanks for reporting!

OK, as there was no response, I double-checked (yupp, must have been a copy-pasta error), adjusted and pushed. Closing this issue now as fixed. Should it not have solved your problem, just leave another comment (or open another issue). Thanks for reporting!
izzy closed this issue 2 months ago
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.