Error when activating SharePoint Feature: Failed to apply a web.config modification to file

I had trouble activating a SharePoint feature on my site which was causing the following error:

Failed to apply a web.config modification to file 'configuration/system.web/page
s'.  The specified node "
nfig" was not found in the web.config file.

While at first quite confusing, it turns out that that the error message was indeed correct ;-)... after I compared it with an earlier web.config the entire <pages> section had been removed (maybe by a previous rogue feature receiver?), so I re-added the following lines, and hey presto all was fine:

<pages enableSessionState="false" enableViewState="true" enableViewStateMac="true" validateRequest="false" pageParserFilterType="Microsoft.SharePoint.ApplicationRuntime.SPPageParserFilter, Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" asyncTimeout="7">  
<remove namespace="System.Web.UI.WebControls.WebParts" />
<add tagType="System.Web.UI.WebControls.SqlDataSource, System.Web, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mappedTagType="Microsoft.SharePoint.WebControls.SPSqlDataSource, Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />