macOS Mojave cannot find /var/db/DetachedSignatures with Swift 4

扶醉桌前 提交于 2020-01-24 02:24:27

问题


I had no such error with High Sierra, now with Mojave my application done with Swift 4 is issuing this error. It will happen when I try to get software information by call: /usr/sbin/system_profiler SPApplicationsDataType

My application wont fail and works but I notice that it will expose this error when running:

system_profiler[2052:52918] [logging-persist] os_unix.c:42249: (0) open(/var/db/DetachedSignatures) - Undefined error: 0

I guess it is related to code signatures but I don't know how to handle that, maybe a bug as there isn't any file called DetachedSignatures inside /var/db


回答1:


I encountered the same problem, and I copied the DetachedSignatures file from some other guy's MacBook and put it under /var/db path on my iMac. It solved the problem. Don't know why some mac just don't have this DetachedSignatures file. Not very many useful explanations on the Internet.




回答2:


os_unix.c:37227: (21) seekAndRead(/var/db/DetachedSignatures) - Is a directory

sudo touch /var/db/DetachedSignatures

This fixed the issue on my machine.




回答3:


I asked someone for their file as @lzl said but they told me the file was 0 bytes. I touched a file at that path and my warnings went away.




回答4:


This appears to be logged by the Security framework during some operations; I always see it when my app calls SecKeyGeneratePair. Since everything works correctly I assume this is just noise. (There are other examples of this; the Security engineers at Apple seem to be bad about leaving noisy but harmless log messages in their production code.)

I wouldn't recommend trying to create the DetachedSignatures file! It's clearly used for something by the OS, and just shoving an empty file there, or one copied from elsewhere, could cause problems later on.



来源:https://stackoverflow.com/questions/52523505/macos-mojave-cannot-find-var-db-detachedsignatures-with-swift-4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!