PlistBuddy 悄无声息地失败了——bug?
PlistBuddy fails silently -- bug?
如果我使用 PlistBuddy 修改 root 拥有的 plist,该命令将以退出代码 0 完成。但是,plist 不会被修改。当我用 sudo 重新 运行 命令时,plist 被按预期修改。
这是 PlistBuddy 中的错误吗? Appium configuration script.
给我带来了一些麻烦
我正在使用这个命令:
/usr/libexec/PlistBuddy -c "Add :TestTestTest dict" "$SOME_PLIST_PATH" || echo "failed"
这是一个完整的会话:
tba $ echo "$SOME_PLIST_PATH"
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/Developer/Library/LaunchDaemons/com.apple.instruments.deviceservice.plist
tba $ ll "$SOME_PLIST_PATH"
-rw-r--r-- 1 root wheel 1.1K Jan 1 15:51 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/Developer/Library/LaunchDaemons/com.apple.instruments.deviceservice.plist
tba $ plutil -p "$SOME_PLIST_PATH"
{
"Program" => "/Developer/Library/PrivateFrameworks/DVTInstrumentsFoundation.framework/DTServiceHub"
"EnvironmentVariables" => {
"LIB_PATH" => "/usr/local/lib/node_modules/appium//node_modules/appium-instruments/thirdparty/iwd7/"
"DYLD_INSERT_LIBRARIES" => "/usr/local/lib/node_modules/appium//node_modules/appium-instruments/thirdparty/iwd7/DTMobileISShim.dylib"
}
"JetsamProperties" => {
"JetsamMemoryLimit" => 0
}
"POSIXSpawnType" => "Adaptive"
"MachServices" => {
"com.apple.instruments.deviceservice.xpc" => 1
"com.apple.instruments.deviceservice.lockdown" => 1
}
"EnableTransactions" => 1
"Label" => "com.apple.instruments.deviceservice"
}
tba $ /usr/libexec/PlistBuddy -c "Add :TestTestTest dict" "$SOME_PLIST_PATH" || echo "failed"
tba $ plutil -p "$SOME_PLIST_PATH"
{
"Program" => "/Developer/Library/PrivateFrameworks/DVTInstrumentsFoundation.framework/DTServiceHub"
"EnvironmentVariables" => {
"LIB_PATH" => "/usr/local/lib/node_modules/appium//node_modules/appium-instruments/thirdparty/iwd7/"
"DYLD_INSERT_LIBRARIES" => "/usr/local/lib/node_modules/appium//node_modules/appium-instruments/thirdparty/iwd7/DTMobileISShim.dylib"
}
"JetsamProperties" => {
"JetsamMemoryLimit" => 0
}
"POSIXSpawnType" => "Adaptive"
"MachServices" => {
"com.apple.instruments.deviceservice.xpc" => 1
"com.apple.instruments.deviceservice.lockdown" => 1
}
"EnableTransactions" => 1
"Label" => "com.apple.instruments.deviceservice"
}
tba $ sudo /usr/libexec/PlistBuddy -c "Add :TestTestTest dict" "$SOME_PLIST_PATH" || echo "failed"
Password:
tba $ plutil -p "$SOME_PLIST_PATH"
{
"Program" => "/Developer/Library/PrivateFrameworks/DVTInstrumentsFoundation.framework/DTServiceHub"
"EnvironmentVariables" => {
"LIB_PATH" => "/usr/local/lib/node_modules/appium//node_modules/appium-instruments/thirdparty/iwd7/"
"DYLD_INSERT_LIBRARIES" => "/usr/local/lib/node_modules/appium//node_modules/appium-instruments/thirdparty/iwd7/DTMobileISShim.dylib"
}
"JetsamProperties" => {
"JetsamMemoryLimit" => 0
}
"POSIXSpawnType" => "Adaptive"
"TestTestTest" => {
}
"MachServices" => {
"com.apple.instruments.deviceservice.xpc" => 1
"com.apple.instruments.deviceservice.lockdown" => 1
}
"EnableTransactions" => 1
"Label" => "com.apple.instruments.deviceservice"
}
PlistBuddy 没有很好的文档记录(我在 developer.apple.com 上找不到它的手册页)所以 Apple 很可能希望使用它的高级用户(和开发人员)简单地知道在弄乱 root-owned plist 文件时需要调用 sudo
。
我建议在 bugreporter.apple.com 提交增强请求,并建议他们向 PlistBuddy 添加“-v
”(用于 Verbose)选项以打印出添加或删除的结果。
目前,您所能做的就是打印出您尝试设置的设置,如果它不起作用,则设置失败。
我的 plistbuddy 也悄无声息地失败了,直到我发现我没有对我的 entitlements.plist
的写入权限,所以请确保您始终对您正在编辑的 .plist 具有写入权限。
另一种选择是使用 plutil
,它不会静默失败。
如果我使用 PlistBuddy 修改 root 拥有的 plist,该命令将以退出代码 0 完成。但是,plist 不会被修改。当我用 sudo 重新 运行 命令时,plist 被按预期修改。
这是 PlistBuddy 中的错误吗? Appium configuration script.
给我带来了一些麻烦我正在使用这个命令:
/usr/libexec/PlistBuddy -c "Add :TestTestTest dict" "$SOME_PLIST_PATH" || echo "failed"
这是一个完整的会话:
tba $ echo "$SOME_PLIST_PATH"
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/Developer/Library/LaunchDaemons/com.apple.instruments.deviceservice.plist
tba $ ll "$SOME_PLIST_PATH"
-rw-r--r-- 1 root wheel 1.1K Jan 1 15:51 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/Developer/Library/LaunchDaemons/com.apple.instruments.deviceservice.plist
tba $ plutil -p "$SOME_PLIST_PATH"
{
"Program" => "/Developer/Library/PrivateFrameworks/DVTInstrumentsFoundation.framework/DTServiceHub"
"EnvironmentVariables" => {
"LIB_PATH" => "/usr/local/lib/node_modules/appium//node_modules/appium-instruments/thirdparty/iwd7/"
"DYLD_INSERT_LIBRARIES" => "/usr/local/lib/node_modules/appium//node_modules/appium-instruments/thirdparty/iwd7/DTMobileISShim.dylib"
}
"JetsamProperties" => {
"JetsamMemoryLimit" => 0
}
"POSIXSpawnType" => "Adaptive"
"MachServices" => {
"com.apple.instruments.deviceservice.xpc" => 1
"com.apple.instruments.deviceservice.lockdown" => 1
}
"EnableTransactions" => 1
"Label" => "com.apple.instruments.deviceservice"
}
tba $ /usr/libexec/PlistBuddy -c "Add :TestTestTest dict" "$SOME_PLIST_PATH" || echo "failed"
tba $ plutil -p "$SOME_PLIST_PATH"
{
"Program" => "/Developer/Library/PrivateFrameworks/DVTInstrumentsFoundation.framework/DTServiceHub"
"EnvironmentVariables" => {
"LIB_PATH" => "/usr/local/lib/node_modules/appium//node_modules/appium-instruments/thirdparty/iwd7/"
"DYLD_INSERT_LIBRARIES" => "/usr/local/lib/node_modules/appium//node_modules/appium-instruments/thirdparty/iwd7/DTMobileISShim.dylib"
}
"JetsamProperties" => {
"JetsamMemoryLimit" => 0
}
"POSIXSpawnType" => "Adaptive"
"MachServices" => {
"com.apple.instruments.deviceservice.xpc" => 1
"com.apple.instruments.deviceservice.lockdown" => 1
}
"EnableTransactions" => 1
"Label" => "com.apple.instruments.deviceservice"
}
tba $ sudo /usr/libexec/PlistBuddy -c "Add :TestTestTest dict" "$SOME_PLIST_PATH" || echo "failed"
Password:
tba $ plutil -p "$SOME_PLIST_PATH"
{
"Program" => "/Developer/Library/PrivateFrameworks/DVTInstrumentsFoundation.framework/DTServiceHub"
"EnvironmentVariables" => {
"LIB_PATH" => "/usr/local/lib/node_modules/appium//node_modules/appium-instruments/thirdparty/iwd7/"
"DYLD_INSERT_LIBRARIES" => "/usr/local/lib/node_modules/appium//node_modules/appium-instruments/thirdparty/iwd7/DTMobileISShim.dylib"
}
"JetsamProperties" => {
"JetsamMemoryLimit" => 0
}
"POSIXSpawnType" => "Adaptive"
"TestTestTest" => {
}
"MachServices" => {
"com.apple.instruments.deviceservice.xpc" => 1
"com.apple.instruments.deviceservice.lockdown" => 1
}
"EnableTransactions" => 1
"Label" => "com.apple.instruments.deviceservice"
}
PlistBuddy 没有很好的文档记录(我在 developer.apple.com 上找不到它的手册页)所以 Apple 很可能希望使用它的高级用户(和开发人员)简单地知道在弄乱 root-owned plist 文件时需要调用 sudo
。
我建议在 bugreporter.apple.com 提交增强请求,并建议他们向 PlistBuddy 添加“-v
”(用于 Verbose)选项以打印出添加或删除的结果。
目前,您所能做的就是打印出您尝试设置的设置,如果它不起作用,则设置失败。
我的 plistbuddy 也悄无声息地失败了,直到我发现我没有对我的 entitlements.plist
的写入权限,所以请确保您始终对您正在编辑的 .plist 具有写入权限。
另一种选择是使用 plutil
,它不会静默失败。