Repository navigation
feat(apple): use .zip for logs - #9536
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
Hmm yeah, zip is one of those things that is "done" so we could probably vendor an implementation here. The last (and most popular) zip library we used here had a security issue which is what prompted me to remove it, and Dependabot still can't update Swift (!!). |
|
Looking at the Sentry report, the issue is in fact no file-size but the "latest" symlink. |
Actually, this works completely fine if the symlink is not there. Maybe I can skip it from being exported? |
That should probably be fine. The current export follows the link which includes the file twice. |
9e4c9fd to
5b667e4
Compare
There was a problem hiding this comment.
@jamilbk I've put the handling of the latest symlink in here because this needs to happen on iOS too and I didn't want to duplicate it on both callsites. I think the more complete / robust approach would be to scan the entire directory for symlinks and move them away before creating the archive.
At this point though, we only have a single symlink so it seems fine to me to take this shortcut.
There was a problem hiding this comment.
This wasn't pointing to the connlib directory but to the parent logs directory.
There was a problem hiding this comment.
This should be reverted because it will skip any Swift logs we make in the Network Extension
There was a problem hiding this comment.
I think this comment is still relevant? Looks like the export doesn't include any Swift logs from the tunnel here.
There was a problem hiding this comment.
Oh, didn't realise that. If we change the path back you need to adjust the path to the sym link.
76edc81 to
4b82da0
Compare
|
@jamilbk Would appreciate if you could test this on an iOS device. |
|
Getting this on iOS: |
jamilbk
left a comment
There was a problem hiding this comment.
Having issues on iOS
- Something is still trying to access the
latestsymlink - Clearing logs and then exporting on iOS causes a crash
I'll see if I can find some time in the coming days to push up fixes for the above
This is the same error I had on macOS. Probably the logic for moving the latest file doesn't work. I am moving it to the parent directory which might not work on iOS? |
I guess this is because on iOS, we zip the entire log directory and therefore the latest symlink is in a subdir. We could skip the creation of the symlink on iOS altogether as I think it won't be useful there anyway? |
dd8af45 to
aec2e32
Compare
|
@jamilbk Could you test on iOS again? I've now disabled the |
aec2e32 to
eaf310b
Compare
|
Seeing this on iOS still. Will look further into it |
eaf310b to
d8fcfdc
Compare
.zip for logs.zip for logs on MacOS
|
@jamilbk I've updated this to only use |
There was a problem hiding this comment.
I actually think the iOS zip export was working - upon further investigation the logs were exported, but the errors shown seem to do with development builds only.
On macOS, we're not getting any tunnel/ logs from the Swift side.
I can push a commit up to fix the above since I can test on iOS.
True, but it's not far behind - I know we have a handful largish customers relying on iOS at the moment. |
Oh okay, yeah feel free to take over from here. Adapting the iOS code shouldn't been too difficult. We just need to delete the symlink again. |
I think I can keep the symlink working, will just do the same thing as macOS by moving it out of the way temporarily. |
jamilbk
left a comment
There was a problem hiding this comment.
Tested:
- iOS: clearing + exporting logs
- macOS: clearing + exporting logs
.zip for logs on MacOS.zip for logs
Signed-off-by: Thomas Eizinger <thomas@eizinger.io>
This PR replaces the use of Apple Archive with an API that allows us to zip the log file contents. This API doesn't handle symlinks well so we move the symlink out of the way before making the zip. The symlink is then moved back after the process is completed. Any errors in this process are ignored as the symlink itself is not a critical component of Firezone.
The zip compression is marginally less efficient than the Apple Archive. Instead of compressing ~2GB of logs to 11.8 MB we now get an archive of 12.4 MB. Considering how much easier zip files are to handle, this seems like a fine trade-off.
Resolves: #7475