./lib/deviceinfo.lib: line 17: {: syntax error: operand expected (error token is "{") #38

Closed
opened 4 years ago by PLNech · 10 comments
PLNech commented 4 years ago (Migrated from github.com)
Owner

When running ./adebar-cli on my oneplus config (which is barely modified from sample), I get the following error in the middle of the output:

./adebar-cli oneplus  

Adebar running:
Gathering lists of installed apps
Obtaining list of disabled apps
Creating script to enable ALL apps
Creating backup/restore scripts for UserApps
Creating backup/restore scripts for SytemApps
Checking default install-location
Collecting partition details
Collecting device information
./lib/deviceinfo.lib: line 17: {: syntax error: operand expected (error token is "{")
Pulling configuration files
Generating app detail info
PostProcessing and Cleanup
Adebar done.

Any idea what could be the issue here?

(Version: git cloned commit 175a9ee793)
(System: Debian GNU/Linux 9.5 (stretch))

When running `./adebar-cli` on my `oneplus` config (which is barely modified from sample), I get the following error in the middle of the output: ``` ./adebar-cli oneplus Adebar running: Gathering lists of installed apps Obtaining list of disabled apps Creating script to enable ALL apps Creating backup/restore scripts for UserApps Creating backup/restore scripts for SytemApps Checking default install-location Collecting partition details Collecting device information ./lib/deviceinfo.lib: line 17: {: syntax error: operand expected (error token is "{") Pulling configuration files Generating app detail info PostProcessing and Cleanup Adebar done. ``` Any idea what could be the issue here? _(Version: git cloned commit 175a9ee7931d881418330ac0e029ce724f01734d)_ _(System: `Debian GNU/Linux 9.5 (stretch)`)_
Owner

The file this error is reported for hasn't been touched in over a year. Taking a look at the line, I see nothing wrong syntax-wise (and your Bash version should be OK on stretch) – which leaves "device specific" things here. Do you have another device to cross-check whether this error happens? Further, with the oneplus connected, please run

adb shell dumpsys telephony.registry|grep "="

(optionally redirect it to a file) and check whether it contains mServiceState (if not, that would explain the error – though that would be very strange). If you could attach (or pastebin-link) the output, that might be helpful as well.

Another thing you could try for testing is adding a line before the error occurs (i.e. before line 17 in deviceinfo.lib):

echo "mServiceState: '${mradio[mServiceState]}'"

That should tell us clearly whether the variable is set.

The file this error is reported for hasn't been touched in over a year. Taking a look at the line, I see nothing wrong syntax-wise (and your Bash version should be OK on stretch) – which leaves "device specific" things here. Do you have another device to cross-check whether this error happens? Further, with the oneplus connected, please run adb shell dumpsys telephony.registry|grep "=" (optionally redirect it to a file) and check whether it contains `mServiceState` (if not, that would explain the error – though that would be very strange). If you could attach (or pastebin-link) the output, that might be helpful as well. Another thing you could try for testing is adding a line before the error occurs (i.e. before line 17 in `deviceinfo.lib`): echo "mServiceState: '${mradio[mServiceState]}'" That should tell us clearly whether the variable is set.
Catfriend1 commented 4 years ago (Migrated from github.com)
Owner

I have this problem as well, I've cloned into the current repo state.
https://pastebin.com/JGmRrHKN

I have this problem as well, I've cloned into the current repo state. https://pastebin.com/JGmRrHKN
Owner

Thanks for the dump, @Catfriend1 – that got me started! I'm not at my machine so I cannot run the command myself ATM – but looking at a complete dump I made a couple of days ago it seems your devices format the output differently:

mServiceState={mVoiceRegState=0(IN_SERVICE), mDataRegState=0(IN_SERVICE), mVoiceRoamingType=home, mDataRoamingType=home, mVoiceOperatorAlphaLong=congstar, mVoiceOperatorAlphaShort=congstar, mDataOperatorAlphaLong=congstar, mDataOperatorAlphaShort=congstar, isManualNetworkSelection=false(automatic), mRilVoiceRadioTechnology=3(UMTS), mRilDataRadioTechnology=11(HSPA), mCssIndicator=unsupported, mNetworkId=-1, mSystemId=-1, mCdmaRoamingIndicator=-1, mCdmaDefaultRoamingIndicator=-1, mIsEmergencyOnly=false, mIsDataRoamingFromRegistration=false, mIsUsingCarrierAggregation=false, mLteEarfcnRsrpBoost=0}

Now from one of my devices:

mServiceState=1 1 voice home data home null null null null null null  Unknown Unknown CSS not supported -1 -1 RoamInd=-1 DefRoamInd=-1 EmergOnly=true IsDataRoamingFromRegistration=false IsUsingCarrierAggregation=false mRilImsRadioTechnology=0

Now let's take a look at the error message you reported, and be surprised: (error token is "{") – your devices name all variables (the order seems the same; 1 1 in my dump is a device in airplane mode, so no calls and no data – and of course no provider, network etc (null null …)). As a work-around until I can find a fix, please ignore the error or comment out line 17 if it bothers you; you won't have those details in either case, but all else works.

Could you two please specify which device you are using and which ROM and Android version it is running?

Thanks for the dump, @Catfriend1 – that got me started! I'm not at my machine so I cannot run the command myself ATM – but looking at a complete dump I made a couple of days ago it seems your devices format the output differently: mServiceState={mVoiceRegState=0(IN_SERVICE), mDataRegState=0(IN_SERVICE), mVoiceRoamingType=home, mDataRoamingType=home, mVoiceOperatorAlphaLong=congstar, mVoiceOperatorAlphaShort=congstar, mDataOperatorAlphaLong=congstar, mDataOperatorAlphaShort=congstar, isManualNetworkSelection=false(automatic), mRilVoiceRadioTechnology=3(UMTS), mRilDataRadioTechnology=11(HSPA), mCssIndicator=unsupported, mNetworkId=-1, mSystemId=-1, mCdmaRoamingIndicator=-1, mCdmaDefaultRoamingIndicator=-1, mIsEmergencyOnly=false, mIsDataRoamingFromRegistration=false, mIsUsingCarrierAggregation=false, mLteEarfcnRsrpBoost=0} Now from one of my devices: mServiceState=1 1 voice home data home null null null null null null Unknown Unknown CSS not supported -1 -1 RoamInd=-1 DefRoamInd=-1 EmergOnly=true IsDataRoamingFromRegistration=false IsUsingCarrierAggregation=false mRilImsRadioTechnology=0 Now let's take a look at the error message you reported, and be surprised: `(error token is "{")` – your devices name all variables (the order seems the same; `1 1` in my dump is a device in airplane mode, so no calls and no data – and of course no provider, network etc (`null null …`)). As a work-around until I can find a fix, please ignore the error or comment out line 17 if it bothers you; you won't have those details in either case, but all else works. Could you two please specify which device you are using and which ROM and Android version it is running?
Owner

OK folks, could one of you try to replace line 17 by the following, and let me know the outcome (including whether the "Service state" for each SIM has multiple "su-bullet-points")?

    local serv
    if [[ "${mradio[mServiceState]:0:1}" = "{" ]]; then
      mradio["mServiceState"]=${mradio["mServiceState"]:1:-1}   # get rid of the curly braces
      serv=(${mradio["mServiceState"]//,/})                     # remove comma separator
      for i in "${serv[@]}"; do
        echo "    * ${i}" >> "$devicedoc"
      done
    else
      echo "* Service state: ${mradio[mServiceState]:0:1} (${servicestate[${radio[mServiceState]:0:1}]})" >> "$devicedoc"
    fi

I cannot test this myself as none of my devices reports mServiceState that way.

OK folks, could one of you try to replace line 17 by the following, and let me know the outcome (including whether the "Service state" for each SIM has multiple "su-bullet-points")? ``` bash local serv if [[ "${mradio[mServiceState]:0:1}" = "{" ]]; then mradio["mServiceState"]=${mradio["mServiceState"]:1:-1} # get rid of the curly braces serv=(${mradio["mServiceState"]//,/}) # remove comma separator for i in "${serv[@]}"; do echo " * ${i}" >> "$devicedoc" done else echo "* Service state: ${mradio[mServiceState]:0:1} (${servicestate[${radio[mServiceState]:0:1}]})" >> "$devicedoc" fi ``` I cannot test this myself as none of my devices reports `mServiceState` that way.
Catfriend1 commented 4 years ago (Migrated from github.com)
Owner

@IzzySoft After replacing line 17 I got the following
https://pastebin.com/vSgrGMNG

I'm having a new error now:

./lib/partitions.lib: line 221: / 1024: syntax error: operand expected (error token is "/ 1024")

I'm on Xiaomi Mi8 running MIUI 10 (Android 8.1.0 based)

@IzzySoft After replacing line 17 I got the following https://pastebin.com/vSgrGMNG I'm having a new error now: > ./lib/partitions.lib: line 221: / 1024: syntax error: operand expected (error token is "/ 1024") I'm on Xiaomi Mi8 running MIUI 10 (Android 8.1.0 based)
Owner

@Catfriend1 OK, that means my fix for "line 17" works. Just the leading bullet point is missing (adding that). The "RIL:" line might need a cosmetic fix, though (too many line breaks in the Markdown, but that doesn't show when rendered).

Just wanted to add the changes when I saw your PR; what are the other two changes about, removing line breaks? Never noticed any that hurt there.

Hm, looks like you removed the CR and replaced it by a NL. Sure that is what it should be? As it's no PR yet, please let me push the changes I already had commited locally, and let's take care for those line breaks separately (if needed).

Also, could we move the partitions error into a separate issue? Again, it would be helpful to have the Markdown output from that session. Especially I'd need to know what source is mentioned – and then, if possible, the output of the corresponding "collector command". From the error message I can say there is a line that has no size; I'd assume some header, but I cannot tell.

@Catfriend1 OK, that means my fix for "line 17" works. Just the leading bullet point is missing (adding that). The "RIL:" line might need a cosmetic fix, though (too many line breaks in the Markdown, but that doesn't show when rendered). Just wanted to add the changes when I saw your PR; what are the other two changes about, removing line breaks? Never noticed any that hurt there. Hm, looks like you removed the CR and replaced it by a NL. Sure that is what it should be? As it's no PR yet, please let me push the changes I already had commited locally, and let's take care for those line breaks separately (if needed). Also, could we move the partitions error into a separate issue? Again, it would be helpful to have the Markdown output from that session. Especially I'd need to know what source is mentioned – and then, if possible, the output of the corresponding "collector command". From the error message I can say there is a line that has no size; I'd assume some header, but I cannot tell.
Owner

Declaring this issue solved then. Let me know if I'm wrong, so I reopen.

Declaring this issue solved then. Let me know if I'm wrong, so I reopen.
Catfriend1 commented 4 years ago (Migrated from github.com)
Owner

@IzzySoft
I didn't change the CR line break intentionally, I think it came from GitHub Desktop. So your commit is fine only changing what needs to be changed here. :)
Thanks for fixing it 👍

@IzzySoft I didn't change the CR line break intentionally, I think it came from GitHub Desktop. So your commit is fine only changing what needs to be changed here. :) Thanks for fixing it :+1:
Owner

Thanks for your support in fixing it (no tester, no commit 😉) Glad we got it tackled. Now for the next two (partitions and unlock codes). You open a new issue for the partition error with the input requested, and I'll dig in. Looks like I must reject your PR on the keycodes (see background there) – but I already have a solution in mind.

Thanks for your support in fixing it (no tester, no commit :wink:) Glad we got it tackled. Now for the next two (partitions and unlock codes). You open a new issue for the partition error with the input requested, and I'll dig in. Looks like I must reject your PR on the keycodes (see background there) – but I already have a solution in mind.
Catfriend1 commented 4 years ago (Migrated from github.com)
Owner

No problem, thank you too. I'll do so tomorrow...

No problem, thank you too. I'll do so tomorrow...
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: izzy/Adebar#38
Loading…
There is no content yet.