@@ -22,11 +22,12 @@ import Foundation
2222 . appendingPathComponent ( " logs " )
2323 . appendingPathComponent ( " ios.log " ) . path
2424
25+ let logDirURL = oldLogURL. appendingPathComponent ( " logs " )
2526 if !skipLogFile {
26- // cleanup old log files
27+ // cleanup old log files (they live in the logs/ subdir, not directly under oldLogURL)
2728 let fm = FileManager . default
2829 [ " ios.log " , " ios.log.ek " ] . forEach {
29- try ? fm. removeItem ( at: oldLogURL . appendingPathComponent ( $0) )
30+ try ? fm. removeItem ( at: logDirURL . appendingPathComponent ( $0) )
3031 }
3132 }
3233 // Create LevelDB and log directories with a slightly lower data protection
@@ -45,11 +46,15 @@ import Foundation
4546 " kbfs_sync_cache " ,
4647 " kbfs_settings " ,
4748 " synced_tlf_config " ,
48- " logs "
4949 ] . forEach {
5050 createBackgroundReadableDirectory ( path: appKeybaseURL. appendingPathComponent ( $0) . path, setAllFiles: true )
5151 }
52- // Mark avatars, which are in the caches dir
52+ // Log and avatar dirs live under the caches dir, not Application Support.
53+ // This must run after the cleanup above so that any surviving ios.log from a
54+ // previous session (created by Go with default FileProtectionComplete) has its
55+ // protection downgraded to completeUntilFirstUserAuthentication before
56+ // KeybaseInit tries to open it on a locked device.
57+ createBackgroundReadableDirectory ( path: logDirURL. path, setAllFiles: true )
5358 createBackgroundReadableDirectory ( path: oldLogURL. appendingPathComponent ( " avatars " ) . path, setAllFiles: true )
5459
5560 let setupFsElapsed = CFAbsoluteTimeGetCurrent ( ) - setupFsStartTime
0 commit comments