=== modified file 'modules/node/node.install'
--- modules/node/node.install	2010-08-22 13:55:53 +0000
+++ modules/node/node.install	2010-09-10 14:32:59 +0000
@@ -512,10 +512,24 @@ function node_update_7006(&$sandbox) {
     $result = db_select('node_type', 'node_type')
       ->fields('node_type')
       ->execute();
+    foreach ($result as $type_object) {
+      $node_types[$type_object->type] = $type_object;
+    }
+    $extra_types = db_query('SELECT DISTINCT type FROM {node} WHERE type NOT IN (:types)', array(':types' => array_keys($node_types)))->fetchCol();
+    foreach ($extra_types as $type) {
+      $type_object = new stdClass;
+      $type_object->type = $type;
+      // Always create a body. Querying node_revisions for a non-empty body
+      // would skip creating body fields for types that have a body but
+      // the nodes of that type so far had empty bodies.
+      $type_object->has_body = 1;
+      $type_object->body_label = 'Body';
+      $node_types[$type_object->type] = $type_object;
+    }
 
     $default_trim_length = variable_get('teaser_length', 600);
     // Add body field instances for existing node types.
-    foreach ($result as $node_type) {
+    foreach ($node_types as $node_type) {
       if ($node_type->has_body) {
         $instance = node_add_body_field($node_type, $node_type->body_label);
         // Update newly created instance to convert teaser_length variable

=== modified file 'modules/simpletest/simpletest.info'
--- modules/simpletest/simpletest.info	2010-09-05 17:00:04 +0000
+++ modules/simpletest/simpletest.info	2010-09-10 14:36:15 +0000
@@ -39,5 +39,5 @@ files[] = tests/unicode.test
 files[] = tests/update.test
 files[] = tests/xmlrpc.test
 files[] = tests/upgrade/upgrade.test
-files[] = tests/upgrade/upgrade.poll.test
+files[] = tests/upgrade/upgrade.node.test
 files[] = tests/upgrade/upgrade.taxonomy.test

=== modified file 'modules/simpletest/tests/upgrade/drupal-6.filled.database.php'
--- modules/simpletest/tests/upgrade/drupal-6.filled.database.php	2010-09-05 17:00:04 +0000
+++ modules/simpletest/tests/upgrade/drupal-6.filled.database.php	2010-09-10 14:32:59 +0000
@@ -9788,6 +9788,23 @@ db_insert('node')->fields(array(
   'tnid' => '0',
   'translate' => '0',
 ))
+->values(array(
+  'nid' => '37',
+  'vid' => '49',
+  'type' => 'broken',
+  'language' => '',
+  'title' => 'node title 24',
+  'uid' => '6',
+  'status' => '1',
+  'created' => '1263769200',
+  'changed' => '1279310614',
+  'comment' => '0',
+  'promote' => '0',
+  'moderate' => '0',
+  'sticky' => '0',
+  'tnid' => '0',
+  'translate' => '0',
+))
 ->execute();
 
 db_create_table('node_access', array(
@@ -10158,6 +10175,13 @@ db_insert('node_comment_statistics')->fi
   'last_comment_uid' => '5',
   'comment_count' => '0',
 ))
+->values(array(
+  'nid' => '37',
+  'last_comment_timestamp' => '1279310615',
+  'last_comment_name' => NULL,
+  'last_comment_uid' => '6',
+  'comment_count' => '0',
+))
 ->execute();
 
 db_create_table('node_counter', array(
@@ -10798,6 +10822,17 @@ db_insert('node_revisions')->fields(arra
   'timestamp' => '1282936268',
   'format' => '0',
 ))
+->values(array(
+  'nid' => '37',
+  'vid' => '49',
+  'uid' => '6',
+  'title' => 'node title 24',
+  'body' => 'node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37',
+  'teaser' => 'node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37node body (broken) - 37no',
+  'log' => 'added 12 node',
+  'timestamp' => '1279310614',
+  'format' => '0',
+))
 ->execute();
 
 db_create_table('node_type', array(
@@ -19284,6 +19319,12 @@ db_insert('url_alias')->fields(array(
   'dst' => 'content/poll/11/results',
   'language' => '',
 ))
+->values(array(
+  'pid' => '49',
+  'src' => 'node/37',
+  'dst' => 'content/1263769200',
+  'language' => '',
+))
 ->execute();
 
 db_create_table('users', array(

=== added file 'modules/simpletest/tests/upgrade/upgrade.node.test'
--- modules/simpletest/tests/upgrade/upgrade.node.test	1970-01-01 00:00:00 +0000
+++ modules/simpletest/tests/upgrade/upgrade.node.test	2010-09-10 14:37:36 +0000
@@ -0,0 +1,95 @@
+<?php
+// $Id$
+
+/**
+ * Upgrade test for node bodies.
+ *
+ * Load a filled installation of Drupal 6 and run the upgrade process on it.
+ */
+class NodeBodyUpgradePathTestCase extends UpgradePathTestCase {
+  public static function getInfo() {
+    return array(
+      'name'  => 'Node body upgrade path',
+      'description'  => 'Node body upgrade path tests.',
+      'group' => 'Upgrade path',
+    );
+  }
+
+  public function setUp() {
+    // Path to the database dump.
+    $this->databaseDumpFile = drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.filled.database.php';
+    parent::setUp();
+  }
+
+  /**
+   * Test a successful upgrade.
+   */
+  public function testNodyBodyUpgrade() {
+    $this->assertTrue($this->performUpgrade(), t('The upgrade was completed successfully.'));
+    $this->drupalGet("content/1263769200");
+    $this->assertText('node body (broken) - 37');
+  }
+}
+
+/**
+ * Upgrade test for node type poll.
+ *
+ * Load a bare installation of Drupal 6 and run the upgrade process on it.
+ *
+ * The install only contains dblog (although it's optional, it's only so that
+ * another hook_watchdog module can take its place, the site is not functional
+ * without watchdog) and update.
+ */
+class PollUpgradePathTestCase extends UpgradePathTestCase {
+  public static function getInfo() {
+    return array(
+      'name'  => 'Poll upgrade path',
+      'description'  => 'Poll upgrade path tests.',
+      'group' => 'Upgrade path',
+    );
+  }
+
+  public function setUp() {
+    // Path to the database dump.
+    $this->databaseDumpFile = drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.filled.database.php';
+    parent::setUp();
+
+    $this->uninstallModulesExcept(array('poll'));
+  }
+
+  /**
+   * Test a successful upgrade.
+   */
+  public function testPollUpgrade() {
+    $this->assertTrue($this->performUpgrade(), t('The upgrade was completed successfully.'));
+
+    // Check modules page for poll
+    $this->drupalGet('admin/modules');
+
+    // Verify that the poll data is still correctly available
+    for ($i = 0; $i < 12; $i++) {
+      $this->drupalGet("content/poll/$i");
+
+      $nbchoices = ($i % 4) + 2;
+
+      for ($c = 0; $c < $nbchoices; $c++) {
+        $this->assertText("Choice $c for poll $i", t('Choice text is displayed correctly on poll view'));
+      }
+
+      // Now check that the votes are correct
+      $this->clickLink(t('Results'));
+
+      for ($c = 0; $c < $nbchoices; $c++) {
+        $this->assertText("Choice $c for poll $i", t('Choice text is displayed correctly on result view'));
+      }
+
+      $nbvotes = floor (($i % 4) + 5);
+      $elements = $this->xpath("//div[@class='percent']");
+      for ($c = 0; $c < $nbchoices; $c++) {
+        $votes = floor($nbvotes / $nbchoices);
+        if (($nbvotes % $nbchoices) > $c) $votes++;
+        $this->assertTrue(preg_match("/$votes vote/", $elements[$c]), t('The number of votes is displayed correctly: expected ' . $votes . ', got ' . $elements[$c]));
+      }
+    }
+  }
+}

=== removed file 'modules/simpletest/tests/upgrade/upgrade.poll.test'
--- modules/simpletest/tests/upgrade/upgrade.poll.test	2010-08-05 23:53:37 +0000
+++ modules/simpletest/tests/upgrade/upgrade.poll.test	1970-01-01 00:00:00 +0000
@@ -1,65 +0,0 @@
-<?php
-// $Id: upgrade.poll.test,v 1.3 2010/08/05 23:53:38 webchick Exp $
-
-/**
- * Upgrade test for poll.module.
- *
- * Load a bare installation of Drupal 6 and run the upgrade process on it.
- *
- * The install only contains dblog (although it's optional, it's only so that
- * another hook_watchdog module can take its place, the site is not functional
- * without watchdog) and update.
- */
-class PollUpgradePathTestCase extends UpgradePathTestCase {
-  public static function getInfo() {
-    return array(
-      'name'  => 'Poll upgrade path',
-      'description'  => 'Poll upgrade path tests.',
-      'group' => 'Upgrade path',
-    );
-  }
-
-  public function setUp() {
-    // Path to the database dump.
-    $this->databaseDumpFile = drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.filled.database.php';
-    parent::setUp();
-
-    $this->uninstallModulesExcept(array('poll'));
-  }
-
-  /**
-   * Test a successful upgrade.
-   */
-  public function testPollUpgrade() {
-    $this->assertTrue($this->performUpgrade(), t('The upgrade was completed successfully.'));
-
-    // Check modules page for poll
-    $this->drupalGet('admin/modules');
-
-    // Verify that the poll data is still correctly available
-    for ($i = 0; $i < 12; $i++) {
-      $this->drupalGet("content/poll/$i");
-
-      $nbchoices = ($i % 4) + 2;
-
-      for ($c = 0; $c < $nbchoices; $c++) {
-        $this->assertText("Choice $c for poll $i", t('Choice text is displayed correctly on poll view'));
-      }
-
-      // Now check that the votes are correct
-      $this->clickLink(t('Results'));
-
-      for ($c = 0; $c < $nbchoices; $c++) {
-        $this->assertText("Choice $c for poll $i", t('Choice text is displayed correctly on result view'));
-      }
-
-      $nbvotes = floor (($i % 4) + 5);
-      $elements = $this->xpath("//div[@class='percent']");
-      for ($c = 0; $c < $nbchoices; $c++) {
-        $votes = floor($nbvotes / $nbchoices);
-        if (($nbvotes % $nbchoices) > $c) $votes++;
-        $this->assertTrue(preg_match("/$votes vote/", $elements[$c]), t('The number of votes is displayed correctly: expected ' . $votes . ', got ' . $elements[$c]));
-      }
-    }
-  }
-}

=== modified file 'scripts/generate-d6-content.sh'
--- scripts/generate-d6-content.sh	2010-09-05 17:00:04 +0000
+++ scripts/generate-d6-content.sh	2010-09-10 14:35:52 +0000
@@ -185,3 +185,23 @@ for ($i = 0; $i < 12; $i++) {
     drupal_execute('poll_view_voting', $form_state, $node);
   }
 }
+
+$uid = 6;
+$user = user_load($uid);
+$node = new stdClass;
+$node->uid = $uid;
+$node->type = 'broken';
+$node->sticky = 0;
+$node->title = "node title 24";
+$node->body = str_repeat("node body ($node->type) - 37", 100);
+$node->teaser = node_teaser($node->body);
+$node->filter = variable_get('filter_default_format', 1);
+$node->format = FILTER_FORMAT_DEFAULT;
+$node->status = 1;
+$node->language = '';
+$node->revision = 0;
+$node->promote = 0;
+$node->created = 1263769200;
+$node->log = "added $i node";
+node_save($node);
+path_set_alias("node/$node->nid", "content/1263769200");

