{"id":56,"date":"2009-03-24T14:27:42","date_gmt":"2009-03-24T20:27:42","guid":{"rendered":"http:\/\/www.brunerd.com\/blog\/?p=56"},"modified":"2009-03-24T14:56:24","modified_gmt":"2009-03-24T20:56:24","slug":"new-plistbuddy-behaviour","status":"publish","type":"post","link":"https:\/\/www.brunerd.com\/blog\/2009\/03\/24\/new-plistbuddy-behaviour\/","title":{"rendered":"New PlistBuddy Behaviour"},"content":{"rendered":"<p>So, the new UniBody MacBooks come with a build 9G2133 of 10.5.6, currently build 9G55 of 10.5.6 is what&#8217;s out there. What&#8217;s more\u00a0<code>\/usr\/libexec\/PlistBuddy<\/code> has been updated as well<\/p>\n<p>9G2133 (new):<br \/>\n<code>-rwxr-xr-x  1 root  wheel  84400 Sep 24 17:21 PlistBuddy<\/code><\/p>\n<p>9G55 (old):<br \/>\n<code>-rwxr-xr-x  1 root  wheel  73792 Apr  7  2008 PlistBuddy<\/code><\/p>\n<p>What&#8217;s changed with PlistBuddy is this:<br \/>\n* Now, exits with non-zero status on failure (like the man page says)<br \/>\n* Writes errors to stderr instead of stdout<\/p>\n<p>What this might mean to you is if you have a script that tests the stdout of PlistBuddy to detect errors, instead of the exit code (which hasn&#8217;t worked until\u00a0now) then that script might just keep going and going and going&#8230;<\/p>\n<p>For example: I use \u00a0PlistBuddy to add icons to the Dock in custom pkgs I make for work. So the other day when I ran the base packages, Adobe Acrobat being one of them, it just kept going, never fininshing, looking in install.log I found my script stuck in a loop, counting ever higher&#8230;<\/p>\n<p><code>Mar 23 12:42:45 BlankMacBookUni runner[641]: postflight[648]: Print: Entry, \"persistent-apps:<strong>546217<\/strong>:tile-data:file-label\", Does Not Exist<\/code><\/p>\n<p>In about 30 mins it had gotten up to 546,217 attempts to read the Dock plist (thas&#8217; a big log file!). Since my script was testing the stdout string which was now blank because it was going to stderr, it didn&#8217;t know it reached the end!<\/p>\n<p>To illustrate how I changed the code to compensate for either version, here&#8217;s the snippet that will detect if it is at the end of the plist, based on the output (or lack thereof):<\/p>\n<p>Old code:<br \/>\n<code>if [[ \"$output\" == *Does\\ Not\\ Exist ]]; then<\/code><\/p>\n<p>New Code:<br \/>\n<code>if [[ \"$output\" == *Does\\ Not\\ Exist ]] || [ -z \"$output\" ]; then<\/code><\/p>\n<p>So, we&#8217;ll see if this is rolled into 10.5.7, probably. For Tiger, I use the PlistBuddy found in \/Library\/Receipts\/iTunesX.pkg\/Contents\/Resources\/, as of iTunes 8.1 it is still the older version.<\/p>\n<p>Hope this of use to someone. Thanks for reading.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So, the new UniBody MacBooks come with a build 9G2133 of 10.5.6, currently build 9G55 of 10.5.6 is what&#8217;s out there. What&#8217;s more\u00a0\/usr\/libexec\/PlistBuddy has been updated as well 9G2133 (new): -rwxr-xr-x 1 root wheel 84400 Sep 24 17:21 PlistBuddy 9G55 (old): -rwxr-xr-x 1 root wheel 73792 Apr 7 2008 PlistBuddy What&#8217;s changed with PlistBuddy is [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,9,4,12],"tags":[],"class_list":["post-56","post","type-post","status-publish","format-standard","hentry","category-apple","category-leopard","category-os-x","category-scripting"],"_links":{"self":[{"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/posts\/56","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/comments?post=56"}],"version-history":[{"count":8,"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/posts\/56\/revisions"}],"predecessor-version":[{"id":66,"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/posts\/56\/revisions\/66"}],"wp:attachment":[{"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/media?parent=56"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/categories?post=56"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/tags?post=56"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}