Skip to content

check_update.sh infinitely attempts to check for a new version if the github url isnt resolvable #407

@maki43

Description

@maki43

Describe the bug
I have a firewall rule on my router for my yi cameras which prevents any internet access in or out to ensure unintended connections are not possible. The intent of the code in check_update.sh is to check to see if a new version is available via a wget from git and, if unsuccessful following 10 failures, make no further attempts.

I run a private DNS server and i noticed a lot of requests from my yi cameras trying to get the IP for git. The attempts would be every few seconds and happen continuously throughout the day. As my private DNS server is on my LAN the cameras can access it, so while they can request the IP they are unable to download the file. It appears that if the file cant be downloaded it retries forever.

To Reproduce
Steps to reproduce the behaviour:

  1. make sure updates are set to on
  2. Allow the DNS to resolve (unsure if this is the cause, it just allowed me to see the problem)
  3. block internet connections for the cameras ip
  4. restart the camera
  5. monitor the DNS requests and you'll see continuous attempts

Obviously the above would occur if they have no internet connection or git it down etc...

Expected behaviour
Once check_updates.sh is triggered by cron, it should stop any further attempts after 10 failures as the code intended.

Technical Details
I believe its bcause the N_RETRY variable to store the number of attempts is not being set correctly. It uses the following to increment the number of tries:

((N_RETRY++))

While this will work on some shells, it wont work on all of them. I tried this on my CentOS machine and it will increment the variable. I SSHd into the camera and attempted the same and it errored.

I believe the code should do the following instead:

N_RETRY=$(( N_RETRY+1 ))

My current work around is to set the updates to off which is the default anyway.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingenhancementNew feature, improvement, or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions