Skip to content

Fix for OTA updates w/ zsync#12120

Merged
Frenzie merged 1 commit into
koreader:masterfrom
pazos:ota-fix
Jun 29, 2024
Merged

Fix for OTA updates w/ zsync#12120
Frenzie merged 1 commit into
koreader:masterfrom
pazos:ota-fix

Conversation

@pazos

@pazos pazos commented Jun 28, 2024

Copy link
Copy Markdown
Member

Fixes #12115

Kobos, Kindles, Remarkables, Cervantes and Pocketbooks that updated to latest (couple of?) nightlies need to perform a manual update.

Sorry :/


This change is Reviewable

@Frenzie

Frenzie commented Jun 28, 2024

Copy link
Copy Markdown
Member

Ultimately it's what they're there for. ^_^

Btw,

    frontend/ui/otamanager.lua:77:39: accessing undefined variable model
    frontend/ui/otamanager.lua:77:46: accessing undefined variable channel

@Frenzie Frenzie added this to the 2024.06 milestone Jun 28, 2024
@Frenzie Frenzie added the bug label Jun 28, 2024
Comment thread frontend/ui/otamanager.lua Outdated
end

function OTAManager:getZsyncFilename()
return self.zsync_template:format(model, channel)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably best to use it as it was?

Suggested change
return self.zsync_template:format(model, channel)
return self.zsync_template:format(self:getOTAModel(), self:getOTAChannel())

@mergen3107

Copy link
Copy Markdown
Contributor

that updated to latest (couple of?) nightlies

It is precisely -209 and -213:

![image](https://github.com/koreader/koreader/assets/6279855/ef1db8ef-bba7-4463-8301-a8d5ad3302fd)

By the way, -212 only has android stuff. @Frenzie did the build fail or something?

![image](https://github.com/koreader/koreader/assets/6279855/f5bbb545-07cf-493a-b3ac-ae4eecdc68fa)

Comment thread frontend/ui/otamanager.lua Outdated
G_reader_settings:saveSetting("ota_channel", channel)
end


Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pssht :-P

Suggested change

@Frenzie

Frenzie commented Jun 28, 2024

Copy link
Copy Markdown
Member

By the way, -212 only has android stuff. @Frenzie did the build fail or something?

Yes, lua-Spore was down.

@mergen3107

Copy link
Copy Markdown
Contributor

So with current diff tapping on Check for updates got KOReader stuck, and it doesn't time out. I only see info message with the hour glass icon.

Diff:

diff --git a/frontend/ui/otamanager.lua b/frontend/ui/otamanager.lua
index be2f2c210bbf..ebbb9bdafb69 100644
--- a/frontend/ui/otamanager.lua
+++ b/frontend/ui/otamanager.lua
@@ -73,17 +73,22 @@ function OTAManager:setOTAChannel(channel)
     G_reader_settings:saveSetting("ota_channel", channel)
 end
 
+
 function OTAManager:getFilename(kind)
     if type(kind) ~= "string" then return end
     local model = Device:otaModel()
     local channel = self:getOTAChannel()
     if kind == "ota" then
-        return self.zsync_template:format(model, channel)
+        return self:getZsyncFilename()
     elseif kind == "link" then
         return self.link_template:format(model, channel)
     end
 end
 
+function OTAManager:getZsyncFilename()
+    return self:getFilename("ota")
+end
+
 function OTAManager:checkUpdate()
     if Device:isDeprecated() then return -1 end
     local http = require("socket.http")

@mergen3107

Copy link
Copy Markdown
Contributor

Crash.log didn't update neither, so I don't know what's going on

@mergen3107

Copy link
Copy Markdown
Contributor

This is probably because these two functions are now in an infinite loop once getZsyncFilename() is called:

function OTAManager:getFilename(kind)
    if type(kind) ~= "string" then return end
    local model = Device:otaModel()
    local channel = self:getOTAChannel()
    if kind == "ota" then
        return self:getZsyncFilename()
    elseif kind == "link" then
        return self.link_template:format(model, channel)
    end
end

function OTAManager:getZsyncFilename()
    return self:getFilename("ota")
end

@mergen3107

Copy link
Copy Markdown
Contributor

I think I fixed it by replacing

if kind == "ota" then
        return self:getZsyncFilename()

by

if kind == "ota" then
        return self.zsync_template:format(model, channel)

I was able to check back stable and it reported correctly.

@pazos

pazos commented Jun 28, 2024

Copy link
Copy Markdown
Member Author

Thanks @mergen3107, the fix was worse than the bug :p

@Frenzie Frenzie merged commit 0faccff into koreader:master Jun 29, 2024
Commodore64user pushed a commit to Commodore64user/KOReader_fork that referenced this pull request Aug 2, 2024
0xstillb pushed a commit to 0xstillb/koreader-thai that referenced this pull request May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OTA manager crash: getZsyncFilename

3 participants