-
Notifications
You must be signed in to change notification settings - Fork 263
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
ndk-stack.py fails to symbolise on windows #1587
Comments
r23 was released a little while ago, but I don't think ndk-stack has changed since r22. The tools it calls certainly did though, so it's probably worth checking if this is already fixed there. |
Hi Dan. Thanks for the quick reply! I just tried out |
that code in ndk-stack.py hasn't changed though (not since 2019-06), so if anything's changed it seems like it's the zip file on Windows? did you also rebuild, and now your apk is sorted? (if so, i'll see if i can find out why that changed, and whether there's a test to prevent that from becoming unsorted again. if not, we should probably take your change to use |
Hi @enh-google / @DanAlbert - I'm no-more able to reproduce this issue (tried again with ndk 22, but this time I'm able to symbolise the crash stack) without using I haven't updated Android Studio since I last observed this issue, so not sure if a clean build may have changed anything. @enh-google - I agree with your suggestion - If the zip file format "changes/can change", then it's probably the responsibility of |
but you didn't come on the idea of using sorted() by accident, right? you worked that out from looking at your apks? and if you look at your current apks, they seem to already be sorted now? |
To answer the original question, the code does expect that the info objects are "sorted", or, more specifically, that the entries are returned in the order in which each file exists in the archive. According to the python documentation for the infolist function: Return a list containing a ZipInfo object for each member of the archive. The objects are in the same order as their entries in the actual ZIP file on disk if an existing archive was opened. Given this, I don't know how you could have created a zip file that does not return this list in this order. Maybe there is some bug in python that doesn't obey the documentation. The way zips work, I can't even imagine how you could create a zip file that would not have the archive entries in order. If you can replicate the zip file that doesn't seem to follow the python documentation, it would be great to attach and see what might be going on. |
@enh-google / @cferris1000 / @DanAlbert - Okay, so here's the good and bad part -
Anyway, the But I'm a bit concerned about sharing the apk file here (I work for a company, and the apk is basically a test app for an internal library. Plus, it's a debug-configuration-built app). So, I'll need to check with my team if it's safe to share with NDK team. Alternatively (and I'm not sure if this is usually done) - Can we have a video conference where I can instead reproduce (and perform any steps you'd want me to?). If this isn't acceptable, I'll check with my team (on Monday) and get back. |
it's likely just the zipinfo output for the directory would be sufficient and not leak anything (unless the names of files in your zip would say too much)? what created the zip file? was it custom tooling, or just Android Studio? |
Hi @enh-google - Very sorry for the delayed response.
|
Using zipinfo -v should dump all of the relevant information. If you don't want to show all of this information, the three parts of information that would be useful are:
Dumping just that would tell me if something is weird about the apk. Specifically, if the offset is not always increasing, that would be odd and unexpected. |
Hi @cferris1000 - Thanks for the command! PFA the output of The C++ library is |
Okay, that definitely shows that the zip file is not in always increasing order. So, we'll definitely have to do the sort before the comparison. It probably worked for you because it depends on the ordering of the offsets. It looks like you got lucky sometimes so it make the problem appear and disappear. Thanks for persevering through our requests for data, and we'll get a fiz in. |
Just a quick note -
Below is the exception -
|
I fixed this with a similar change to what was original proposed. The fix is: https://android-review.googlesource.com/c/platform/ndk/+/1866134 I don't know what ndk version this will wind up in, but let us know if this doesn't work for you. Thanks again for finding this. |
Thanks for the fix @cferris1000 👍 Reopening just in case we need to cherry-pick, but will probably end up merging from master again. We'll get it into r24 either way (too late for beta 1, but will be in beta 2). |
Description
I was learning about how to symbolise crash stacks on android (tombstone file). So, I induced a crash (nullptr-dereference) and it indeed produced a crash and generated a tombstone.txt file. When symbolising the crash stack via ndk-stack.py, I noticed that -
I debugged further and found that the below snippet in
ndk-stack.py
file -It looks like (correct me If I'm wrong) the above snippet expects
infos
to be sorted based onheader_offset
(this is true for apk built on macOS, but not on windows). To test out my hypothesis, I added a line to sort it -and sure enough - the symbolise started working for me perfectly. Hence, thought I'd check with ndk team - do you see a need to introduce the above sort line? (I'm unsure why it's not sorted on windows. Is this due to apk not generated in proper format on windows for some reason?)
Environment Details
Not all of these will be relevant to every bug, but please provide as much
information as you can.
Let me know, if any more details are required!
The text was updated successfully, but these errors were encountered: