Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restarting php7.3-fpm using dietpi-services gives an error #3059

Closed
maartenlangeveld opened this issue Aug 16, 2019 · 5 comments
Closed

Restarting php7.3-fpm using dietpi-services gives an error #3059

maartenlangeveld opened this issue Aug 16, 2019 · 5 comments
Labels
Bug 🐞 Solution available 🥂 Definite solution has been done
Milestone

Comments

@maartenlangeveld
Copy link

Restarting php7.3-fpm using dietpi-services gives an error:

root@DietPi:/# dietpi-services restart php7.3-fpm

[  OK  ] DietPi-Services | Root access verified.

 DietPi-Services
─────────────────────────────────────────────────────
 Mode: restart php7.3-fpm

/DietPi/dietpi/dietpi-services: line 408: php7.3-fpm: syntax error: invalid arithmetic operator (error token is ".3-fpm")

However

root@DietPi:/# service php7.3-fpm restart

works fine

@maartenlangeveld maartenlangeveld changed the title Restarting php7.3-fpm using dietpi-services gives an error: Restarting php7.3-fpm using dietpi-services gives an error Aug 16, 2019
@MichaIng
Copy link
Owner

MichaIng commented Aug 16, 2019

@maartenlangeveld
Many thanks for your report. Which DietPi version is this?
And please paste: sed -n 408p /DietPi/dietpi/dietpi-services

I am a bid confused since there is no arithmetic check on this line, neither in current master code nor before last change on v6.23 (empty line there) 🤔.

@maartenlangeveld
Copy link
Author

maartenlangeveld commented Aug 17, 2019

@MichaIng
DietPi v6.25.3

root@DietPi:~# sed -n 408p /DietPi/dietpi/dietpi-services

                        [[ ${aSERVICE_MODE[$i]} == 'masked' ]] && { G_DIETPI-NOTIFY 2 "skip : ${aSERVICE_NAME[$i]} (due to mask)"; continue; }

@MichaIng MichaIng added Bug 🐞 Solution available 🥂 Definite solution has been done and removed Investigating 🤔 labels Aug 19, 2019
@MichaIng MichaIng added this to the v6.26 milestone Aug 19, 2019
@MichaIng
Copy link
Owner

MichaIng commented Aug 19, 2019

@maartenlangeveld
Found the issue, indeed a coding bug.
Resolved with: b4cb351
Changelog: 52bb2a6

To apply fix now:

sed -i 's/Apply_Service_State $INPUT_CMD $INPUT_SERVICE/Apply_Service_State $INPUT_CMD ${INPUT_SERVICE+0}/' /DietPi/dietpi/dietpi-services

This passed testing since when you add any non-integer value as array index, (echo ${array[test]}) it will be converted/interpreted as 0, which is correct when dietpi-services is called with single service input. But with certain character types, like dots (in your case), this does not work and the error is thrown instead:

root@VM-Stretch:~# aTEST[0]=success
root@VM-Stretch:~# echo ${aTEST[0]}
success
root@VM-Stretch:~# echo ${aTEST[test]}
success
root@VM-Stretch:~# echo ${aTEST[test.oops]}
-bash: test.oops: syntax error: invalid arithmetic operator (error token is ".oops")

@maartenlangeveld
Copy link
Author

maartenlangeveld commented Aug 23, 2019

@MichaIng
Thanks, but unfortunately the fix did not help.... actually made things worse.

@MichaIng
Copy link
Owner

@maartenlangeveld
Ay jep, I've overseen something. Fixed with: 2738685

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🐞 Solution available 🥂 Definite solution has been done
Projects
None yet
Development

No branches or pull requests

2 participants