Index: modules/contact/contact.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/contact/contact.install,v
retrieving revision 1.25
diff -u -p -r1.25 contact.install
--- modules/contact/contact.install	8 Jun 2010 03:48:14 -0000	1.25
+++ modules/contact/contact.install	8 Sep 2010 04:38:44 -0000
@@ -116,16 +116,7 @@ function contact_update_7001() {
  * Enable the 'access user contact forms' for registered users by default.
  */
 function contact_update_7002() {
-  // Do not use user_role_grant_permission() since it relies on
-  // hook_permission(), which will not run for contact module if it is
-  // disabled.
-  db_merge('role_permission')
-    ->key(array(
-      'rid' => DRUPAL_AUTHENTICATED_RID,
-      'permission' => 'access user contact forms',
-      'module' => 'contact',
-    ))
-    ->execute();
+  _update_user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('access user contact forms'), 'contact');
 }
 
 /**
Index: modules/filter/filter.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.install,v
retrieving revision 1.43
diff -u -p -r1.43 filter.install
--- modules/filter/filter.install	5 Sep 2010 01:05:06 -0000	1.43
+++ modules/filter/filter.install	8 Sep 2010 04:38:44 -0000
@@ -284,21 +284,21 @@ function filter_update_7003() {
         // Port the filter settings.
         $settings = array();
         if ($new_name == 'filter_html') {
-          if ($setting = variable_get("allowed_html_{$record->format}", NULL)) {
+          if ($setting = variable_get("allowed_html_{$record->format}")) {
             $settings['allowed_html'] = $setting;
             variable_del("allowed_html_{$record->format}");
           }
-          if ($setting = variable_get("filter_html_help_{$record->format}", NULL)) {
+          if ($setting = variable_get("filter_html_help_{$record->format}")) {
             $settings['filter_html_help'] = $setting;
             variable_del("filter_html_help_{$record->format}");
           }
-          if ($setting = variable_get("filter_html_nofollow_{$record->format}", NULL)) {
+          if ($setting = variable_get("filter_html_nofollow_{$record->format}")) {
             $settings['filter_html_nofollow'] = $setting;
             variable_del("filter_html_nofollow_{$record->format}");
           }
         }
         elseif ($new_name == 'filter_url') {
-          if ($setting = variable_get("filter_url_length_{$record->format}", NULL)) {
+          if ($setting = variable_get("filter_url_length_{$record->format}")) {
             $settings['filter_url_length'] = $setting;
             variable_del("filter_url_length_{$record->format}");
           }
Index: modules/user/user.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.install,v
retrieving revision 1.62
diff -u -p -r1.62 user.install
--- modules/user/user.install	5 Sep 2010 01:05:06 -0000	1.62
+++ modules/user/user.install	8 Sep 2010 04:38:45 -0000
@@ -346,7 +346,7 @@ function user_update_dependencies() {
   $dependencies['system'][7000] = array(
     'user' => 7008,
   );
-  // user_update_7006 relies on filter_update_7002.
+  // user_update_7006 relies on filter_update_7003.
   // TODO: move user_update_7006 down below in the upgrade process.
   $dependencies['user'][7006] = array(
     'filter' => 7003,
@@ -368,6 +368,8 @@ function user_update_dependencies() {
  *   An array of permissions names.
  * @param $module
  *   The name of the module defining the permissions.
+ *
+ * @see user_role_grant_permissions()
  */
 function _update_user_role_grant_permissions($rid, array $permissions, $module) {
   // Grant new permissions for the role.
@@ -382,6 +384,10 @@ function _update_user_role_grant_permiss
       ))
       ->execute();
   }
+
+  // Clear the user access cache.
+  drupal_static_reset('user_access');
+  drupal_static_reset('user_role_permissions');
 }
 
 /**
Index: modules/user/user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.module,v
retrieving revision 1.1199
diff -u -p -r1.1199 user.module
--- modules/user/user.module	7 Sep 2010 22:38:30 -0000	1.1199
+++ modules/user/user.module	8 Sep 2010 04:38:45 -0000
@@ -2848,6 +2848,11 @@ function user_role_change_permissions($r
 /**
  * Grant permissions to a user role.
  *
+ * When granting permissions from within an update function, this function
+ * should not be used because it will not work correctly if the module being
+ * updated is disabled at the time the update is run. In that case, use
+ * _update_user_role_grant_permissions() instead.
+ *
  * @param $rid
  *   The ID of a user role to alter.
  * @param $permissions
