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

F-Droid can't build - not RB #51

Closed
licaon-kter opened this issue Mar 23, 2023 · 67 comments
Closed

F-Droid can't build - not RB #51

licaon-kter opened this issue Mar 23, 2023 · 67 comments

Comments

@licaon-kter
Copy link

licaon-kter commented Mar 23, 2023

ref: https://monitor.f-droid.org/builds/log/com.starry.myne/9#site-footer

/LE: fyi https://gitlab.com/fdroid/fdroiddata/-/commit/de76cb1a0c45616ec0afcea093ced38f5f1a9c4d

@licaon-kter
Copy link
Author

Also 11 https://gitlab.com/fdroid/fdroiddata/-/commit/ef553af3b3a7c7102f9ee63cdc444dab93d5df7b

verification of APK with copied signature failed
Comparing reference APK to APK with copied signature...
Unexpected diff output:
Binary files /tmp/tmp9ao0125l/unsigned_binaries_com.starry.myne_11.binary/content/assets/dexopt/baseline.prof and /tmp/tmp9ao0125l/_tmp_tmp9ao0125l_sigcp_com.starry.myne_11/content/assets/dexopt/baseline.prof differ
Binary files /tmp/tmp9ao0125l/unsigned_binaries_com.starry.myne_11.binary/content/classes.dex and /tmp/tmp9ao0125l/_tmp_tmp9ao0125l_sigcp_com.starry.myne_11/content/classes.dex differ
diff -r /tmp/tmp9ao0125l/unsigned_binaries_com.starry.myne_11.binary/content/res/GM.json /tmp/tmp9ao0125l/_tmp_tmp9ao0125l_sigcp_com.starry.myne_11/content/res/GM.json
1,3362c1,3362
< {
<   "v": "5.7.8",
<   "fr": 24,
<   "ip": 0,
<   "op": 151,
<   "w": 1080,
<   "h": 1080,
<   "nm": "EMOJI_CORACAO",
...

@starry-shivam
Copy link
Member

Thanks for notifying,

Also 11 https://gitlab.com/fdroid/fdroiddata/-/commit/ef553af3b3a7c7102f9ee63cdc444dab93d5df7b

verification of APK with copied signature failed
Comparing reference APK to APK with copied signature...
Unexpected diff output:
Binary files /tmp/tmp9ao0125l/unsigned_binaries_com.starry.myne_11.binary/content/assets/dexopt/baseline.prof and /tmp/tmp9ao0125l/_tmp_tmp9ao0125l_sigcp_com.starry.myne_11/content/assets/dexopt/baseline.prof differ
Binary files /tmp/tmp9ao0125l/unsigned_binaries_com.starry.myne_11.binary/content/classes.dex and /tmp/tmp9ao0125l/_tmp_tmp9ao0125l_sigcp_com.starry.myne_11/content/classes.dex differ
diff -r /tmp/tmp9ao0125l/unsigned_binaries_com.starry.myne_11.binary/content/res/GM.json /tmp/tmp9ao0125l/_tmp_tmp9ao0125l_sigcp_com.starry.myne_11/content/res/GM.json
1,3362c1,3362
< {
<   "v": "5.7.8",
<   "fr": 24,
<   "ip": 0,
<   "op": 151,
<   "w": 1080,
<   "h": 1080,
<   "nm": "EMOJI_CORACAO",
...

This looks like json file for some Lottie animation, I'll have to check mappings.txt file of the last build to confirm though, but I'm not sure why this would cause issues 🤔

@licaon-kter
Copy link
Author

.json aside for 11 classes.dex and baseline differ, will need to diff them locally next

ref: https://f-droid.org/docs/Reproducible_Builds/#potential-sources-of-unreproducible-builds

@starry-shivam
Copy link
Member

.json aside for 11 classes.dex and baseline differ, will need to diff them locally next

Thanks, please update me if you find something which i could change to fix it, as i don't really havs much knowledge/experience of reproducible builds 😅

@licaon-kter
Copy link
Author

licaon-kter commented Mar 24, 2023

Here's the diff log:
my.zip

@starry-shivam
Copy link
Member

Here's the diff log: my.zip

Thanks, but unfortunately I've no idea how to read/understand what went wrong using these logs, as i don't really know anything about reproducible builds. Can you link me some guide which i can read to check reproducibility of builds myself using whatever tool used by f-droid to ensure reproducibility.

@licaon-kter
Copy link
Author

As linked the base prof thing can be seen here: https://f-droid.org/docs/Reproducible_Builds/#potential-sources-of-unreproducible-builds

@linsui is the rest of the diff log a know type already?

@linsui
Copy link

linsui commented Mar 27, 2023

Looks like only the java part is different.

@starry-shivam
Copy link
Member

starry-shivam commented Mar 27, 2023

@licaon-kter I've read your linked article but wasn't able to figure out what exactly was causing it, I'm using gradle 7.4.x so gradle issue as linked in that article shouldn't be a culprit, same goes for coreLibraryDesugaring as app doesn't uses core library desugaring, about windows newlines, we've talked about and fixed it in app's yml file in f-droid data repository when i opened a RFP issue for the listing and timestamp related issue was also resolved around same time in the merge request. And other reasons about NDK and build paths etc aren't related here as far as i can understand.

@licaon-kter
Copy link
Author

@licaon-kter
Copy link
Author

@starry-shivam can you build an APK from commit: 6f9af6d with these two as false? https://github.com/Pool-Of-Tears/Myne/blob/main/app/build.gradle#L37-L38

@starry-shivam
Copy link
Member

@starry-shivam can you build an APK from commit: 6f9af6d with these two as false? https://github.com/Pool-Of-Tears/Myne/blob/main/app/build.gradle#L37-L38

Sure, will do in the evening.

@starry-shivam
Copy link
Member

@licaon-kter here you go, I've uploaded it on mediafire as i couldn't find any ways to upload it here directly.

@starry-shivam
Copy link
Member

Hello, any updates on this?

@licaon-kter
Copy link
Author

licaon-kter commented Apr 5, 2023

Better ;)

The baseline issue might be fixed as explained here: https://f-droid.org/docs/Reproducible_Builds/#potential-sources-of-unreproducible-builds

The rest is still in lottie.json: myne1.log

@starry-shivam
Copy link
Member

The baseline issue might be fixed

Cool!

The rest is still in lottie.json: myne1.log

Any idea what can i do to solve this? I'm not sure why it'll cause the issue..

@linsui
Copy link

linsui commented Apr 5, 2023

Maybe you can sort it before it's packaged?

@starry-shivam
Copy link
Member

Maybe you can sort it before it's packaged?

Sort it like? It's basically a json file stored in the raw resource directory.

@linsui
Copy link

linsui commented Apr 5, 2023

Oh, sorry, it's not a order problem. Maybe it's about the line end. Then we can fix it on our side.

@starry-shivam
Copy link
Member

Oh, sorry, it's not a order problem. Maybe it's about the line end. Then we can fix it on our side.

Nice! Btw since we're here, can anyone check why the screenshots for both of my apps this and GreenStash are kinda mixed up with old screenshots (which I've already deleted from fastlane directory long ago) Idk why it happens but it looks pretty weird..

@linsui
Copy link

linsui commented Apr 6, 2023

I thought it's a known issue. But I don't know how to fix it.

@licaon-kter
Copy link
Author

We do know but not yet fixed :)

@starry-shivam
Copy link
Member

alright, not a big deal.

@licaon-kter
Copy link
Author

Trying 2.3.0

diff log: myne230.log

local APK (Java17): com.starry.myne_17.apk.zip (remove .ZIP extenstion)

upstream APK: https://github.com/Pool-Of-Tears/Myne/releases/tag/v2.3.0

@linsui @obfusk

@obfusk
Copy link

obfusk commented Aug 10, 2023

Looks like broken resources: https://issuetracker.google.com/issues/287967713
Also one annotation in classes.dex, and newlines in META-INF/services/.

@licaon-kter the broken resources are on your end this time, and so are the windows newlines in META-INF/services/; that's really weird. Anything change in your setup?

@licaon-kter
Copy link
Author

@obfusk

Anything change in your setup?

Not that I know, and doesn't affect any other apps either. 🤷

@licaon-kter
Copy link
Author

licaon-kter commented Aug 16, 2023

I've rebuilt in another instance and my builds are repro between them

VM images rebuilt April 20 and June 30, fyi

@obfusk
Copy link

obfusk commented Aug 16, 2023

Ive rebuilt in another instance and my builds are repro between them

That's good to know. I see Google increased the priority and severity of the bug. Hopefully they'll fix it or at least give us some idea of what's going on. I don't really know how to debug this.

@starry-shivam
Copy link
Member

Any updates on this?

@licaon-kter
Copy link
Author

2.6.0 is fine https://gitlab.com/fdroid/fdroiddata/-/commit/8dbf581aae28376a5ab70e7ad5ad51cb5877c739 :)

@linsui
Copy link

linsui commented Jul 1, 2024

https://monitor.f-droid.org/builds/log/com.starry.myne/391#site-footer

Only the zip metadata is different.

@starry-shivam starry-shivam reopened this Jul 1, 2024
@starry-shivam
Copy link
Member

https://monitor.f-droid.org/builds/log/com.starry.myne/391#site-footer

Only the zip metadata is different.

Weird, I didn't even make many changes in the latest release. You can check for changes here: v3.9.0...v3.9.1

@linsui
Copy link

linsui commented Jul 1, 2024

Please test if you can still reproduce 3.9.0 apk.

@starry-shivam
Copy link
Member

starry-shivam commented Jul 1, 2024

Please test if you can still reproduce 3.9.0 apk.

How can i test it? Should i build an apk from v3.9.0 tag and send it here?

@linsui
Copy link

linsui commented Jul 1, 2024

You can build and sign it and compare it with the apk in release with diff.

@starry-shivam
Copy link
Member

You can build and sign it and compare it with the apk in release with diff.

I don't know which tool you use to compare apks. Should I just try to compare the SHA-256 hashes of both files or something like that?

@linsui
Copy link

linsui commented Jul 1, 2024

Yes, the hash should be the same. If the hash is different, please also check the content of the apk with diff -r. You can use diffoscope to inspect it.

@starry-shivam
Copy link
Member

Screenshot (5)

@linsui The hashes are different, but I think it is most likely because the GitHub build is compiled in a Linux environment with gradle directly, while the one I built is compiled with Android Studio on Windows 11. There must be different line endings (CRLF?), and Android Studio itself might do some extra stuff when archiving the APK file, though I'm not sure about that. However, diff -r didn't show anything useful, like what exactly are the differences, other than just indicating they are different.

@linsui
Copy link

linsui commented Jul 2, 2024

Please unzip them then run diff -r. :) If you want to check the apk directly you can use diffoscope but I thought it's not available on Windows.

@starry-shivam
Copy link
Member

Screenshot (6)

I checked the diff with Meld and it shows these three files which are present in the GitHub build of v3.9.0 but missing in the build I compiled just now with Android Studio. They seem to be some signing-related keys, though I’ve signed this build with the same signature that I use for the GitHub builds.

@linsui
Copy link

linsui commented Jul 2, 2024

They are signature files. Hmmm, that shouldn't affect our reproducible build. Can you upload the unsigned apk here?

@starry-shivam
Copy link
Member

They are signature files. Hmmm, that shouldn't affect our reproducible build. Can you upload the unsigned apk here?

Sure, but it seems GitHub doesn't support uploading APK files in comments. I'll upload it somewhere else and share the link in a moment.

@linsui
Copy link

linsui commented Jul 3, 2024

You can zip it.

@starry-shivam
Copy link
Member

You can zip it.

Oh, good idea. Here you go
Myne-v3.9.0.zip

@linsui
Copy link

linsui commented Jul 3, 2024

Your build has other difference. I thought they are mainly caused by CRLF.

@starry-shivam
Copy link
Member

Your build has other difference. I thought they are mainly caused by CRLF.

Hmm, maybe. Still, I'm not really sure what exactly caused v3.9.1 to become unreproducible, especially considering I didn't even make any major changes between v3.9.0 and v3.9.1 like I usually do with other releases.

@linsui
Copy link

linsui commented Jul 3, 2024

Yep, we also see this problem on other apps. It seems a toolchain is changed but we don't know what it is yet.

@licaon-kter
Copy link
Author

@starry-shivam
Copy link
Member

you are using some other external actions so not sure how to inject that in https://github.com/r0adkll/sign-android-release/blob/f30bdd30588842ac76044ecdbd4b6d0e3e813478/lib/signing.js#L66 )

Looking at the code, I don't think the GitHub Actions plugin allows users to pass additional arguments. I think I'll have to run APK signer manually. I'll try and see how it goes.

@starry-shivam
Copy link
Member

I've been trying to manually sign (#192), but I keep getting a "command not found" error. The error message isn't helpful because it doesn't specify which command has failed or the correct line number in the workflow file. I suspect it doesn't find the apksigner command, but the ANDROID_HOME environment variable seems to point to the correct path: /usr/local/lib/android/sdk. It would be great if someone could look at this and see if I'm doing something wrong. I'm not particularly good with GitHub Actions, which is why I was using a third-party plugin to get the job done.

@linsui
Copy link

linsui commented Jul 8, 2024

ls: cannot access 'app/build/outputs/apk/release/app-release-unsigned.apk': No such file or directory

@licaon-kter
Copy link
Author

so #192 can be closed

@starry-shivam
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants