Rollback of commit ae5f442e9cf3ef6578e70104af7cb2a2288b9fb8.

*** Reason for rollback ***

This is causing segfaults.

*** Original change description ***

Remove copy ctor and operator= from BlazeStartupOptions

--
MOS_MIGRATED_REVID=104726824
diff --git a/src/main/cpp/BUILD b/src/main/cpp/BUILD
index 6ea2bb3..7954a67 100644
--- a/src/main/cpp/BUILD
+++ b/src/main/cpp/BUILD
@@ -50,7 +50,6 @@
         "blaze_startup_options.h",
         "blaze_startup_options_common.cc",
         "blaze_util_platform.h",
-        "extra_startup_options.h",
         "option_processor.cc",
         "option_processor.h",
     ],
diff --git a/src/main/cpp/blaze_startup_options.cc b/src/main/cpp/blaze_startup_options.cc
index b5aa5ce..7e0a158 100644
--- a/src/main/cpp/blaze_startup_options.cc
+++ b/src/main/cpp/blaze_startup_options.cc
@@ -32,6 +32,41 @@
 
 struct StartupOptions {};
 
+BlazeStartupOptions::BlazeStartupOptions() {
+  Init();
+}
+
+BlazeStartupOptions::BlazeStartupOptions(const BlazeStartupOptions &rhs)
+    : output_base(rhs.output_base),
+      install_base(rhs.install_base),
+      output_root(rhs.output_root),
+      output_user_root(rhs.output_user_root),
+      block_for_lock(rhs.block_for_lock),
+      host_jvm_debug(rhs.host_jvm_debug),
+      host_jvm_profile(rhs.host_jvm_profile),
+      host_jvm_args(rhs.host_jvm_args),
+      batch(rhs.batch),
+      batch_cpu_scheduling(rhs.batch_cpu_scheduling),
+      io_nice_level(rhs.io_nice_level),
+      max_idle_secs(rhs.max_idle_secs),
+      skyframe(rhs.skyframe),
+      blaze_cpu(rhs.blaze_cpu),
+      watchfs(rhs.watchfs),
+      allow_configurable_attributes(rhs.allow_configurable_attributes),
+      option_sources(rhs.option_sources),
+      webstatus_port(rhs.webstatus_port),
+      invocation_policy(rhs.invocation_policy),
+      host_javabase(rhs.host_javabase) {}
+
+BlazeStartupOptions::~BlazeStartupOptions() {
+}
+
+BlazeStartupOptions& BlazeStartupOptions::operator=(
+    const BlazeStartupOptions &rhs) {
+  Copy(rhs, this);
+  return *this;
+}
+
 string BlazeStartupOptions::GetProductName() {
   return "Bazel";
 }
diff --git a/src/main/cpp/blaze_startup_options.h b/src/main/cpp/blaze_startup_options.h
index f1ea545..f29ab3f 100644
--- a/src/main/cpp/blaze_startup_options.h
+++ b/src/main/cpp/blaze_startup_options.h
@@ -15,16 +15,18 @@
 #define BAZEL_SRC_MAIN_CPP_BLAZE_STARTUP_OPTIONS_H_
 
 #include <map>
+#include <memory>
 #include <string>
 #include <vector>
 
-#include "src/main/cpp/extra_startup_options.h"
 #include "src/main/cpp/util/exit_code.h"
 
 namespace blaze {
 
 using std::string;
 
+struct StartupOptions;
+
 // This class holds the parsed startup options for Blaze.
 // These options and their defaults must be kept in sync with those
 // in java/com/google/devtools/build/lib/blaze/BlazeServerStartupOptions.
@@ -38,6 +40,9 @@
 class BlazeStartupOptions {
  public:
   BlazeStartupOptions();
+  BlazeStartupOptions(const BlazeStartupOptions &rhs);
+  ~BlazeStartupOptions();
+  BlazeStartupOptions& operator=(const BlazeStartupOptions &rhs);
 
   // Returns the capitalized name of this binary.
   string GetProductName();
@@ -158,8 +163,9 @@
   std::map<string, string> option_sources;
 
   // This can be used for site-specific startup options. For Bazel, this is
-  // stubbed out.
-  ExtraStartupOptions extra_options;
+  // stubbed
+  // out.
+  std::unique_ptr<StartupOptions> extra_options;
 
   // Given the working directory, returns the nearest enclosing directory with a
   // WORKSPACE file in it.  If there is no such enclosing directory, returns "".
@@ -198,6 +204,14 @@
  private:
   string host_javabase;
 
+  // Sets default values for members.
+  void Init();
+
+  // Copies member variables from rhs to lhs. This cannot use the compiler-
+  // generated copy constructor because extra_options is a unique_ptr and
+  // unique_ptr deletes its copy constructor.
+  void Copy(const BlazeStartupOptions &rhs, BlazeStartupOptions *lhs);
+
   // Returns the directory to use for storing outputs.
   string GetOutputRoot();
 };
diff --git a/src/main/cpp/blaze_startup_options_common.cc b/src/main/cpp/blaze_startup_options_common.cc
index c151c7e..914f7ab 100644
--- a/src/main/cpp/blaze_startup_options_common.cc
+++ b/src/main/cpp/blaze_startup_options_common.cc
@@ -26,7 +26,7 @@
 
 namespace blaze {
 
-BlazeStartupOptions::BlazeStartupOptions() {
+void BlazeStartupOptions::Init() {
   bool testing = getenv("TEST_TMPDIR") != NULL;
   if (testing) {
     output_root = MakeAbsolute(getenv("TEST_TMPDIR"));
@@ -61,6 +61,33 @@
   return host_javabase;
 }
 
+void BlazeStartupOptions::Copy(
+    const BlazeStartupOptions &rhs, BlazeStartupOptions *lhs) {
+  assert(lhs);
+
+  lhs->output_base = rhs.output_base;
+  lhs->install_base = rhs.install_base;
+  lhs->output_root = rhs.output_root;
+  lhs->output_user_root = rhs.output_user_root;
+  lhs->block_for_lock = rhs.block_for_lock;
+  lhs->host_jvm_debug = rhs.host_jvm_debug;
+  lhs->host_jvm_profile = rhs.host_jvm_profile;
+  lhs->host_javabase = rhs.host_javabase;
+  lhs->host_jvm_args = rhs.host_jvm_args;
+  lhs->batch = rhs.batch;
+  lhs->batch_cpu_scheduling = rhs.batch_cpu_scheduling;
+  lhs->io_nice_level = rhs.io_nice_level;
+  lhs->max_idle_secs = rhs.max_idle_secs;
+  lhs->skyframe = rhs.skyframe;
+  lhs->blaze_cpu = rhs.blaze_cpu;
+  lhs->webstatus_port = rhs.webstatus_port;
+  lhs->watchfs = rhs.watchfs;
+  lhs->allow_configurable_attributes = rhs.allow_configurable_attributes;
+  lhs->fatal_event_bus_exceptions = rhs.fatal_event_bus_exceptions;
+  lhs->option_sources = rhs.option_sources;
+  lhs->invocation_policy = rhs.invocation_policy;
+}
+
 blaze_exit_code::ExitCode BlazeStartupOptions::ProcessArg(
       const string &argstr, const string &next_argstr, const string &rcfile,
       bool *is_space_separated, string *error) {
diff --git a/src/main/cpp/extra_startup_options.h b/src/main/cpp/extra_startup_options.h
deleted file mode 100644
index b4394a1..0000000
--- a/src/main/cpp/extra_startup_options.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2015 The Bazel Authors. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//    http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-#ifndef BAZEL_SRC_MAIN_CPP_BLAZE_EXTRA_STARTUP_OPTIONS_H_
-#define BAZEL_SRC_MAIN_CPP_BLAZE_EXTRA_STARTUP_OPTIONS_H_
-
-namespace blaze {
-
-struct ExtraStartupOptions {
-};
-
-}
-
-#endif  // BAZEL_SRC_MAIN_CPP_BLAZE_EXTRA_STARTUP_OPTIONS_H_