Skip to content
This repository has been archived by the owner on Oct 1, 2018. It is now read-only.

Hash doesn't match for certain files. #96

Closed
dwhitmore opened this issue Jan 27, 2016 · 11 comments
Closed

Hash doesn't match for certain files. #96

dwhitmore opened this issue Jan 27, 2016 · 11 comments
Labels

Comments

@dwhitmore
Copy link

I've done well over 100 updates while testing and every once in a while I'll get this error. Seems to only happen when I have a new css file updated, which doesn't make sense. I'm generating the manifest on a windows machine and confirmed the hashs are the same locally and on the server. I was starting to wonder if the code generates a different hash than the machine as I've seen that in the past with Java. Has anyone else come across this?

@Manduro
Copy link
Contributor

Manduro commented Jan 27, 2016

Do you use the chcp cli tool to generate the manifest? I've haven't run into this issue using it, but I did using the gulp implementation mentioned here: #54. Somehow it generates different MD5 hashes.

@dwhitmore
Copy link
Author

Yes, I'm using the chcp cli tool. It just happened again on my config.js
file. Starting to think it's with generated files somehow. My css file is
generated from a preprocessor and some gulp tasks updated the config file.
The other 20 some odd files that I manually updated match. It's almost as
if generated files from windows get a different hash from the objective c
function. I've verified all files from the server match the hash in the manifest.

@nikDemyankov
Copy link
Member

@dwhitmore Are you getting this error for iOS only, or also for Android?

Have you tried to regenerate hashes when you hit this issue without updating files? Then compare old and new manifest files. And then run mobile app again, to check if it will load files from the server.

Don't have a windows machine at the moment to test that. But it's either wrong hashes in the manifest file on the server, or wrong hash generation on one of the sides (mobile or web). Just trying to understand on which one...

Also, if it works fine for android, but breaks for iOS - that will narrow it down.

I was capturing that problem, when I used local development add-on and was updating some file very quickly in a short period of time. That lead to the situation, when app loaded old manifest file, but downloaded file, that was updated after the manifest generation. But if you are not doing it like that - then this isn't your case.

@dwhitmore
Copy link
Author

It seems to be wrong hash generation on the mobile side when it checks the downloaded files validity. I'm only using IOS at the moment, haven't looked at android. Also, can't reproduce on a steady basis, just seemed to have narrowed it down to generated files for some reason. But I have seen this in the past when comparing Java MD5 hashs vs system MD5 hashes.

@nikDemyankov
Copy link
Member

How I love those kind of bugs... So it's objective-c hash vs windows hash. Thanks for the info, will see what I can do with that...

@davidovich
Copy link
Contributor

@dwhitmore since it is on windows, check to see if you are generating hashes when files have CRLF line endings. Git is configured by default to translate line endings.

@dwhitmore
Copy link
Author

@davidovich Not using Git but I had that same feeling about the css preprocessor. However, by opening up the generated style.css and adding some spaces and saving I would still get the same result. That just confused me more.

@davidovich
Copy link
Contributor

@dwhitmore I still feel this is a line ending issue. Can your editor show the whitespace in your file? You can also use a diff program to show the whitespace difference.

@ventr1x
Copy link

ventr1x commented Sep 20, 2016

It doesn't even have to be an error locally or on mobile itself.
I just ran into this issue and it was the transfer mode from the ftp client, which uploaded about 50% of the files in ASCII instead of binary (was set to auto).

Interestingly I haven't had that issue on another project (ionic 1) and same ftp, but on my current one (ionic 2, Typescript).
Maybe because I'm using my own minify-script in the first project, stripping comments, newlines and so on and relying on ionics tasks in ionic 2 (which does not do that, they just concat files).

Just to get that out there as it can be a very hard error to spot, you don't run into ftp issues that often.

@nikDemyankov
Copy link
Member

@ventr1x that's an interesting note, thanks for sharing :) Really tricky to spot, indeed.

@nordnet-deprecation-bot
Copy link
Contributor

👋 Hi! Thank you for your interest in this repo.

😢 We are not using nordnet/cordova-hot-code-push anymore, and we lack the manpower and the experience needed to maintain it. We are aware of the inconveniece that this may cause you. Feel free to use it as is, or create your own fork.

🔒 This will now be closed & locked.

ℹ️ Please see #371 for more information.

@nordnet nordnet locked and limited conversation to collaborators Sep 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants