{"id":33,"date":"2009-08-04T20:36:36","date_gmt":"2009-08-05T03:36:36","guid":{"rendered":"http:\/\/porkrind.org\/missives2\/?p=33"},"modified":"2013-08-06T13:41:57","modified_gmt":"2013-08-06T20:41:57","slug":"all-my-stupid-man-pages-are-out-of-date","status":"publish","type":"post","link":"https:\/\/porkrind.org\/missives\/all-my-stupid-man-pages-are-out-of-date\/","title":{"rendered":"All My Stupid Man Pages Are Out Of Date"},"content":{"rendered":"<p>I got annoyed today when I ls-ed on my Mac OS X 10.5 system and saw this:<\/p>\n<pre>drwxr-xr-x@ 3 root  wheel  170 Jun  7 17:35 F9D86DAF-2868-4918-948A-110BB55DAB11<\/pre>\n<p>Well, that&#8217;s not what got me annoyed. I tried to look up what the &#8216;@&#8217; after the permissions meant in the man page and it didn&#8217;t mention it at all. I searched the web and found someone quote an excerpt of the man page that explained the &#8216;@&#8217;. And it was not in my man page at all! <em>That<\/em> is when I got annoyed.<\/p>\n<p>Then I remembered <a href=\"http:\/\/porkrind.org\/missives\/leopard-permissions-going-crazy\/comment-page-1\/#comment-56\">an exchange with a commenter<\/a>: earlier where it seemed like my docs were old.<\/p>\n<p>So I set out to find why my man pages were out of date. After some poking around I discovered this:<\/p>\n<pre>$ ls -l \/usr\/share\/man\/man1\/ls.1*\r\n-r--r--r--    1 root     wheel       15708 Mar  1  2006 \/usr\/share\/man\/man1\/ls.1\r\n-r--r--r--    1 root     wheel        6220 Apr 20  2008 \/usr\/share\/man\/man1\/ls.1.gz<\/pre>\n<p>So at some point the system installed new, nicely gzipped man pages but somehow failed to remove the old ones. And it turns out the man give the non-gzipped version precedence. Giving me old out of date documentation when I ask for it. Weak.<\/p>\n<p>A quickie perl script seemed in order:<\/p>\n<pre>find \/usr\/share\/man -name \"*.gz\" -or -print \\\r\n    | perl -ne 'chomp; print \"$_n\" if -f \"$_.gz\" &amp;&amp; -M $_ &gt; -M \"$_.gz\"' \\\r\n    | xargsn -n 10 sudo rm<\/pre>\n<p>where xargsn is defined in my .bashrc file as:<\/p>\n<pre>alias xargsn=\"tr '\\n' '\\0' | xargs -0\"<\/pre>\n<p>Using GNU <tt>xargs<\/tt> you can just do <tt>xargs -d\\\\n<\/tt> which is way easier for me to remember but stupid bsd <tt>xargs<\/tt> doesn&#8217;t appear to have the nice <tt>-d<\/tt> option. Weak, but I digress.<\/p>\n<p>Anyway, the script finds non-gzipped files in the system man hierarchy and, if they have an equivalent gzipped version that happens to be newer, deletes them.<\/p>\n<p>I had about 4500 that I was able to delete, and now my <tt>ls<\/tt> and <tt>chmod<\/tt> man pages have up-to-date info again. Aaaahhhhh.<\/p>\n<p>You might notice that I only deleted the non-gzipped version if it was older. It turns out I had about 10 man pages where the opposite was true. So I tweaked my script a little and did this:<\/p>\n<pre>find \/usr\/share\/man -name \"*.gz\" -or -print \\\r\n    | perl -ne 'chomp; print \"$_n\" if -f \"$_.gz\" &amp;&amp; -M $_ &lt; -M \"$_.gz\"' \\\r\n    | xargsn -n 1 sudo gzip -f<\/pre>\n<p>This one gzips the man page and replaces the older gzipped version when they both exist and the gzipped is older.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So at some point the system installed new, nicely gzipped man pages but somehow failed to remove the old ones. And it turns out the man give the non-gzipped version precedence. Giving me old out of date documentation when I ask for it. Weak.<br \/>\n&#8230;<br \/>\nI had about 4500 that I was able to delete, and now my ls and chmod man pages have up-to-date info again. Aaaahhhhh.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[10],"tags":[],"class_list":["post-33","post","type-post","status-publish","format-standard","hentry","category-sysadmin"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/porkrind.org\/missives\/wp-json\/wp\/v2\/posts\/33","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/porkrind.org\/missives\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/porkrind.org\/missives\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/porkrind.org\/missives\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/porkrind.org\/missives\/wp-json\/wp\/v2\/comments?post=33"}],"version-history":[{"count":12,"href":"https:\/\/porkrind.org\/missives\/wp-json\/wp\/v2\/posts\/33\/revisions"}],"predecessor-version":[{"id":438,"href":"https:\/\/porkrind.org\/missives\/wp-json\/wp\/v2\/posts\/33\/revisions\/438"}],"wp:attachment":[{"href":"https:\/\/porkrind.org\/missives\/wp-json\/wp\/v2\/media?parent=33"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/porkrind.org\/missives\/wp-json\/wp\/v2\/categories?post=33"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/porkrind.org\/missives\/wp-json\/wp\/v2\/tags?post=33"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}