Index: includes/path.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/path.inc,v
retrieving revision 1.36
diff -u -p -r1.36 path.inc
--- includes/path.inc	16 May 2009 19:07:02 -0000	1.36
+++ includes/path.inc	16 May 2009 22:51:42 -0000
@@ -50,6 +50,7 @@ function drupal_lookup_path($action, $pa
   $no_src = &drupal_static(__FUNCTION__ . ':no_src', array());
   $count = &drupal_static(__FUNCTION__ . ':count');
   $system_paths = &drupal_static(__FUNCTION__ . ':system_paths');
+  $blacklist = &drupal_static(__FUNCTION__ . ':blacklist');
   $no_aliases = &drupal_static(__FUNCTION__ . ':no_alias', array());
   $first_call = &drupal_static(__FUNCTION__ . ':first_call', TRUE);
 
@@ -70,9 +71,11 @@ function drupal_lookup_path($action, $pa
   elseif ($count > 0 && $path != '') {
     if ($action == 'alias') {
       // During the first call to drupal_lookup_path() per language, load the
-      // expected system paths for the page from cache.
+      // expected system paths for the page from cache and fetch the path
+      // blacklist variable.
       if ($first_call) {
         $first_call = FALSE;
+        $blacklist = variable_get('path_optimization_list', drupal_path_blacklist());
         $map[$path_language] = array();
         // Load system paths from cache.
         $cid = current_path();
@@ -93,9 +96,13 @@ function drupal_lookup_path($action, $pa
       if (isset($map[$path_language][$path])) {
         return $map[$path_language][$path];
       }
+      // If the alias is in the blacklist, return FALSE.
+      if (drupal_match_path($path, $blacklist)) {
+        return FALSE;
+      }
       // For system paths which were not cached, query aliases individually.
-      else if (!isset($no_aliases[$path_language][$path])) {
-        // Get the most fitting result falling back with alias without language
+      if (!isset($no_aliases[$path_language][$path])) {
+        // Get the most fitting result falling back with alias without language.
         $alias = db_query("SELECT dst FROM {url_alias} WHERE src = :src AND language IN(:language, '') ORDER BY language DESC", array(
           ':src' => $path,
           ':language' => $path_language
@@ -347,3 +354,32 @@ function drupal_match_path($path, $patte
 function current_path() {
   return $_GET['q'];
 }
+
+/**
+ * Helper function for drupal_lookup_path().
+ *
+ * @return
+ *  A list of system paths to be used as the default blacklist for
+ *  drupal_lookup_path(). Aliases will not be saved or looked up for system
+ *  paths matching this list.
+ *
+ */
+function drupal_path_blacklist() {
+  return 'admin*
+  */add
+  */edit
+  */outline
+  */revisions
+  */track
+  book
+  comment/*
+  filter*
+  logout
+  poll
+  profile
+  tracker*
+  user
+  user/register
+  user/login';
+}
+
Index: modules/path/path.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/path/path.admin.inc,v
retrieving revision 1.21
diff -u -p -r1.21 path.admin.inc
--- modules/path/path.admin.inc	16 May 2009 15:23:16 -0000	1.21
+++ modules/path/path.admin.inc	16 May 2009 22:51:42 -0000
@@ -140,6 +140,13 @@ function path_admin_form_validate($form,
   $src = $form_state['values']['src'];
   $dst = $form_state['values']['dst'];
   $pid = isset($form_state['values']['pid']) ? $form_state['values']['pid'] : 0;
+  $blacklist = variable_get('path_optimization_list', drupal_path_blacklist());
+
+  if (drupal_match_path($src, $blacklist)) {
+    // @TODO Offer a pointer on how to correct this.
+    form_set_error('src', t("The path '@link_path' cannot be aliased because it is skipped by default when querying path aliases.", array('@link_path' => $src)));
+  }
+
   // Language is only set if locale module is enabled, otherwise save for all languages.
   $language = isset($form_state['values']['language']) ? $form_state['values']['language'] : '';
 
? sites/all/modules/pqp/d7.patch
