<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Allen Brooker (AllenJB) &#187; Gentoo</title>
	<atom:link href="http://allenjb.me.uk/?feed=rss2&#038;tag=gentoo" rel="self" type="application/rss+xml" />
	<link>http://allenjb.me.uk</link>
	<description>Programming yesterday was about developers vs idiots. Now the developers are the idiots.</description>
	<lastBuildDate>Tue, 31 Aug 2010 12:45:46 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Beware of warnings about default Apache2 config for PHP</title>
		<link>http://allenjb.me.uk/?p=200</link>
		<comments>http://allenjb.me.uk/?p=200#comments</comments>
		<pubDate>Tue, 31 Aug 2010 06:50:24 +0000</pubDate>
		<dc:creator>AllenJB</dc:creator>
				<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[WebDev]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://allenjb.me.uk/?p=200</guid>
		<description><![CDATA[Planet PHP recently popped up a post by Ilia with a warning about the configuration of PHP using AddHandler instead of AddType.
Now I&#8217;m all for people publshing warnings about security issues, but they really should at least read the official documentation to check their information first.
In this case, to summarise the documentation:

AddHandler is used for [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://planet-php.net">Planet PHP</a> recently popped up a <a href="http://ilia.ws/index.php?url=archives/226-Beware-of-the-default-Apache-2-config-for-PHP.html">post by Ilia</a> with a warning about the configuration of PHP using AddHandler instead of AddType.</p>
<p>Now I&#8217;m all for people publshing warnings about security issues, but they really should at least read the official documentation to check their information first.</p>
<p>In this case, to summarise <a href="http://httpd.apache.org/docs/2.2/mod/mod_mime.html">the documentation</a>:</p>
<ul>
<li>AddHandler is used for server-side content handling &#8211; it associates a handler with the specified content</li>
<li>AddType is used for determining the Content-Type in relation to the client request (ie. the default Content-Type identified to the browser)</li>
<li>BOTH obey multiple extensions, but a response can only have one Content-Type while a file can be handled by multiple Handlers.</li>
</ul>
<p>This means that while, when using AddType, &#8220;test.php.gif&#8221; no longer works, &#8220;test.php.something&#8221; will (assuming .something doesn&#8217;t have an associated Type), because .php is the last extension encountered which has an associated Type. So the so called &#8220;fix&#8221; doesn&#8217;t really fix the problem at all.</p>
<p>Additionally, when using AddType, instead of the default Content-Type being text/html, it becomes &#8220;application/x-httpd-php&#8221;, which is technically incorrect and may result in your website not being viewable in browsers or by search engine bots.</p>
<p>If you really want to make it so that only files ending with .php are handled by PHP, then <a href="http://httpd.apache.org/docs/2.2/mod/mod_mime.html#multipleext">you should use SetHandler instead of AddHandler</a>. In fact, this is what the <a href="http://www.php.net/manual/en/install.unix.apache2.php">current official PHP documentation recommends</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://allenjb.me.uk/?feed=rss2&amp;p=200</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Portage 2.2 and License Management</title>
		<link>http://allenjb.me.uk/?p=180</link>
		<comments>http://allenjb.me.uk/?p=180#comments</comments>
		<pubDate>Wed, 18 Nov 2009 00:12:36 +0000</pubDate>
		<dc:creator>AllenJB</dc:creator>
				<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[license]]></category>
		<category><![CDATA[portage]]></category>

		<guid isPermaLink="false">http://allenjb.me.uk/?p=180</guid>
		<description><![CDATA[Portage 2.2 has recently introduced a new feature that allows users to select what licenses they want to allow on their install. The interface still needs some work (for example, Portage needs to explain when it has &#8220;ignored&#8221; packages due to license during updates) so that users don&#8217;t, for example, get confused as to why [...]]]></description>
			<content:encoded><![CDATA[<p>Portage 2.2 has recently introduced a new feature that allows users to select what licenses they want to allow on their install. The interface still needs some work (for example, Portage needs to explain when it has &#8220;ignored&#8221; packages due to license during updates) so that users don&#8217;t, for example, get confused as to why their system suddenly wants icedtea instead of sun-jdk. Other than these fairly minor issues, it seems to be working well so far.</p>
<p>There&#8217;s <a href="http://en.gentoo-wiki.com/wiki/Licenses">an article on Gentoo Wiki</a> that explains this new feature from a users point of view and how to tailor it to your individual tastes.</p>
]]></content:encoded>
			<wfw:commentRss>http://allenjb.me.uk/?feed=rss2&amp;p=180</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Logwatch with Metalog</title>
		<link>http://allenjb.me.uk/?p=174</link>
		<comments>http://allenjb.me.uk/?p=174#comments</comments>
		<pubDate>Mon, 09 Nov 2009 14:36:56 +0000</pubDate>
		<dc:creator>AllenJB</dc:creator>
				<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[broken]]></category>
		<category><![CDATA[logwatch]]></category>
		<category><![CDATA[metalog]]></category>

		<guid isPermaLink="false">http://allenjb.me.uk/?p=174</guid>
		<description><![CDATA[Just a heads up to say that I&#8217;ve finally discovered why logwatch doesn&#8217;t work with metalog-1 any more &#8211; some bright spark changed the default log format. On the up side, it&#8217;s configurable, so the configuration to change it back has been added to the guide I wrote on Gentoo Wiki
]]></description>
			<content:encoded><![CDATA[<p>Just a heads up to say that I&#8217;ve finally discovered why logwatch doesn&#8217;t work with metalog-1 any more &#8211; some bright spark changed the default log format. On the up side, it&#8217;s configurable, so the configuration to change it back has been added to the guide I wrote <a href="http://en.gentoo-wiki.com/wiki/Logwatch_with_Metalog">on Gentoo Wiki</a></p>
]]></content:encoded>
			<wfw:commentRss>http://allenjb.me.uk/?feed=rss2&amp;p=174</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Attack of the 5 year old DST / run-crons bug!</title>
		<link>http://allenjb.me.uk/?p=167</link>
		<comments>http://allenjb.me.uk/?p=167#comments</comments>
		<pubDate>Tue, 27 Oct 2009 23:42:39 +0000</pubDate>
		<dc:creator>AllenJB</dc:creator>
				<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://allenjb.me.uk/?p=167</guid>
		<description><![CDATA[So I noticed that when we switched off the abomination that is daylight savings this weekend just gone, my systems which run on &#8220;GB&#8221; time rather than &#8220;UTC&#8221; executed their cron scripts twice. This despite the fact that, at a glance, they should execute at (or shortly after) 03:01, which should be safe.
Turns out this [...]]]></description>
			<content:encoded><![CDATA[<p>So I noticed that when we switched off the abomination that is daylight savings this weekend just gone, my systems which run on &#8220;GB&#8221; time rather than &#8220;UTC&#8221; executed their cron scripts twice. This despite the fact that, at a glance, they should execute at (or shortly after) 03:01, which should be safe.</p>
<p>Turns out this isn&#8217;t quite the case. There&#8217;s a <a href="http://bugs.gentoo.org/show_bug.cgi?id=69777">5 year old bug in Gentoo&#8217;s Bugzilla</a> about this known issue and it appears to be down to the way run-crons manages its lock / last run files. I&#8217;m already running a run-crons <a href="http://bugs.gentoo.org/show_bug.cgi?id=261000">patched for recursive directory scanning</a> on some of my systems, so it wasn&#8217;t that big a step to basically do away with Gentoo&#8217;s supplied script altogether.</p>
<p>Now I&#8217;m running &#8220;run-crons-in&#8221; &#8211; a much simplified script that simply relies on the cron daemon itself for timing (which is how it should be, in my opinion). Here&#8217;s my script:</p>
<pre>
#!/bin/bash
# 2009-10-27 Complete rewrite of run-crons
# This version is designed to be called using @hourly @daily @weekly or @monthly
# With, for example: run-crons-in daily
#
# This version assumes:
# - We don't care if a previous script is still running
# - The cron daemon handles all timing in a sensible manner
# - Therefore no locking is necessary

AJB_DEBUG=0
AJB_TIMES=1
AJB_PTIMES=1
AJB_TIMEFORMAT='%Y-%m-%d %T'
BASE=$1

AJB_STARTTIME="`date +\"${AJB_TIMEFORMAT}\"`"
[ $AJB_TIMES -eq 1 ] &#038;&#038; echo "Start time: ${AJB_STARTTIME}"

run_recursive() {
        CRONDIR="$1"
        [ $AJB_DEBUG -eq 1 ] &#038;&#038; echo "Executing cron scripts in directory: $CRONDIR"
        for SCRIPT in $CRONDIR/* ; do
                if [[ -x $SCRIPT &#038;&#038; ! -d $SCRIPT ]]; then
                        [ $AJB_DEBUG -eq 1 ] &#038;&#038; echo "Executing cron script: $SCRIPT"
                        AJB_PSTARTTIME="`date +\"${AJB_TIMEFORMAT}\"`"
                        [ $AJB_PTIMES -eq 1 ] &#038;&#038; echo "Script start time: ${AJB_PSTARTTIME}"
                        $SCRIPT
                        AJB_PSTOPTIME="`date +\"${AJB_TIMEFORMAT}\"`"
                        [ $AJB_PTIMES -eq 1 ] &#038;&#038; echo "Script stop time: ${AJB_PSTOPTIME}"
                fi

                if [[ -d $SCRIPT ]]; then
                        run_recursive $SCRIPT
                fi
        done
}

CRONDIR="/etc/cron.${BASE}"

test -d "$CRONDIR" || echo "Directory does not exist or is not a directory: ${CRONDIR}"
set +e
test -d "$CRONDIR" &#038;&#038; run_recursive "$CRONDIR"

AJB_STOPTIME="`date +\"${AJB_TIMEFORMAT}\"`"
[ $AJB_TIMES -eq 1 ] &#038;&#038; echo "End time: ${AJB_STOPTIME}"
</pre>
<p>As you can see, it&#8217;s fairly basic &#8211; altho I&#8217;ve added some extra output for timing and debugging, simply because I felt like it. I&#8217;m currently testing this long term to ensure it works as expected, but hopefully I&#8217;ll adopt this for all my systems within a couple of months.</p>
<p>The full /etc/crontab entries are now:</p>
<pre>
@hourly   root    /usr/local/sbin/run-crons-in hourly
@daily    root    /usr/local/sbin/run-crons-in daily
@weekly   root    /usr/local/sbin/run-crons-in weekly
@monthly  root    /usr/local/sbin/run-crons-in monthly
</pre>
<p>(Yes, I realize that, at least by the man page, those are all going to run at midnight, but daily is the only set of scripts that ever does anything really stressful on the system I&#8217;m currently testing on, and it&#8217;s a quad core, and I really don&#8217;t care otherwise I wouldn&#8217;t be testing cron daemons on it)</p>
<p>I&#8217;m also taking the opportunity to use <a href="https://fedorahosted.org/cronie/">cronie</a> in place of vixie-cron. There&#8217;s little documentation for this project, but as far as I can see it&#8217;s a drop-in replacement for / fork of vixie-cron from redhat that&#8217;s actively maintained.</p>
<p>I did take a quick look at the other cron daemons in the portage tree, but cronie appears to be the only one that&#8217;s actively maintained.</p>
]]></content:encoded>
			<wfw:commentRss>http://allenjb.me.uk/?feed=rss2&amp;p=167</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gentoo Wiki: New Guide: Logwatch with Metalog</title>
		<link>http://allenjb.me.uk/?p=162</link>
		<comments>http://allenjb.me.uk/?p=162#comments</comments>
		<pubDate>Fri, 09 Oct 2009 11:46:35 +0000</pubDate>
		<dc:creator>AllenJB</dc:creator>
				<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[logwatch]]></category>
		<category><![CDATA[metalog]]></category>

		<guid isPermaLink="false">http://allenjb.me.uk/?p=162</guid>
		<description><![CDATA[I finally got around to configuring logwatch to work with metalog, and wrote up the process as a guide. You can find it over on Gentoo Wiki.
]]></description>
			<content:encoded><![CDATA[<p>I finally got around to configuring logwatch to work with metalog, and wrote up the process as a guide. You can find it over on <a href="http://en.gentoo-wiki.com/wiki/Logwatch_with_Metalog">Gentoo Wiki</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://allenjb.me.uk/?feed=rss2&amp;p=162</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gentoo &amp; Trac: Post-commit magic</title>
		<link>http://allenjb.me.uk/?p=153</link>
		<comments>http://allenjb.me.uk/?p=153#comments</comments>
		<pubDate>Fri, 28 Aug 2009 11:15:21 +0000</pubDate>
		<dc:creator>AllenJB</dc:creator>
				<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[trac]]></category>

		<guid isPermaLink="false">http://allenjb.me.uk/?p=153</guid>
		<description><![CDATA[When using trac under Gentoo, the location of the pre-commit and post-commit scripts changes every version. In addition, I have multiple repositories. Together this makes for annoying maintainance every time I create a new repo or upgrade trac. The solution? Shell scripting magic:

# Repo path is in format: /home/allenjb/allenjb.me.uk/svn/&#60;project>
# Trac env path is in format: [...]]]></description>
			<content:encoded><![CDATA[<p>When using trac under Gentoo, the location of the pre-commit and post-commit scripts changes every version. In addition, I have multiple repositories. Together this makes for annoying maintainance every time I create a new repo or upgrade trac. The solution? Shell scripting magic:<br />
<code><br />
# Repo path is in format: /home/allenjb/allenjb.me.uk/svn/&lt;project><br />
# Trac env path is in format: /home/allenjb/allenjb.me.uk/trac/&lt;project><br />
# PROJECT contains the &lt;project> name<br />
PROJECT=`echo ${REPOS} | cut -d "/" -f 6`<br />
TRAC_ENV="/home/allenjb/allenjb.me.uk/trac/${PROJECT}"<br />
# TRAC_VER contains the trac version<br />
TRAC_VER=`trac-admin --help | head -n 1 | sed -e 's/^\([^0-9]*\)\(.*\)/\2/'`</p>
<p>/usr/bin/python /usr/share/doc/trac-${TRAC_VER}/contrib/trac-post-commit-hook -p "$TRAC_ENV" -r "$REV"<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://allenjb.me.uk/?feed=rss2&amp;p=153</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
