We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Toil Appliance should set /var/lib/toil as the default workdir 

Toil Appliance should set /var/lib/toil as the default workdir 


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `docker/Dockerfile.py`
Content:
```
1 # Copyright (C) 2015-2016 Regents of the University of California
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 
15 from __future__ import print_function
16 import os
17 import textwrap
18 
19 applianceSelf = os.environ['TOIL_APPLIANCE_SELF']
20 sdistName = os.environ['_TOIL_SDIST_NAME']
21 
22 
23 dependencies = ' '.join(['libffi-dev',  # For client side encryption for 'azure' extra with PyNACL
24                          'python-dev',  # For installing Python packages with native code
25                          'python-pip',  # Bootstrap pip, but needs upgrading, see below
26                          'libcurl4-openssl-dev',
27                          'libssl-dev',
28                          'wget',
29                          'curl',
30                          'openssh-server',
31                          'mesos=1.0.0-2.0.89.ubuntu1404',
32                          'rsync',
33                          'screen'])
34 
35 
36 def heredoc(s):
37     s = textwrap.dedent(s).format(**globals())
38     return s[1:] if s.startswith('\n') else s
39 
40 
41 motd = heredoc('''
42 
43     This is the Toil appliance. You can run your Toil script directly on the appliance, but only
44     in single-machine mode. Alternatively, create a Toil cluster with `toil launch-cluster`,
45     log into the leader of that cluster with `toil ssh-cluster` and run your Toil script there.
46 
47     For more information see http://toil.readthedocs.io/en/latest/
48 
49     Copyright (C) 2015-2016 Regents of the University of California
50 
51     Version: {applianceSelf}
52 
53 ''')
54 
55 # Prepare motd to be echoed in the Dockerfile using a RUN statement that uses bash's print
56 motd = ''.join(l + '\\n\\\n' for l in motd.splitlines())
57 
58 print(heredoc('''
59     FROM ubuntu:14.04
60 
61     RUN echo "deb http://repos.mesosphere.io/ubuntu/ trusty main" \
62         > /etc/apt/sources.list.d/mesosphere.list \
63         && apt-key adv --keyserver keyserver.ubuntu.com --recv E56151BF \
64         && apt-get -y update \
65         && apt-get -y install {dependencies} \
66         && apt-get clean && rm -rf /var/lib/apt/lists/*
67 
68     RUN mkdir /root/.ssh && \
69         chmod 700 /root/.ssh
70 
71     ADD waitForKey.sh /usr/bin/waitForKey.sh
72 
73     RUN chmod 777 /usr/bin/waitForKey.sh
74 
75     # The stock pip is too old and can't install from sdist with extras
76     RUN pip install --upgrade pip==8.1.2
77 
78     # Include virtualenv, as it is still the recommended way to deploy pipelines
79     RUN pip install --upgrade virtualenv==15.0.3
80 
81     # Install s3am (--never-download prevents silent upgrades to pip, wheel and setuptools)
82     RUN virtualenv --never-download /home/s3am \
83         && /home/s3am/bin/pip install s3am==2.0 \
84         && ln -s /home/s3am/bin/s3am /usr/local/bin/
85 
86     # Install statically linked version of docker client
87     RUN wget -O /usr/bin/docker https://get.docker.com/builds/Linux/x86_64/docker-1.10.3 \
88         && chmod +x /usr/bin/docker
89 
90     # Fix for Mesos interface dependency missing on ubuntu
91     RUN pip install protobuf==3.0.0
92 
93     # Move the Mesos module onto the Python path
94     RUN ln -s /usr/lib/python2.7/site-packages/mesos /usr/local/lib/python2.7/dist-packages/mesos
95 
96     # Fix for https://issues.apache.org/jira/browse/MESOS-3793
97     ENV MESOS_LAUNCHER=posix
98 
99     # Fix for `screen` (https://github.com/BD2KGenomics/toil/pull/1386#issuecomment-267424561)
100     ENV TERM linux
101 
102     # An appliance may need to start more appliances, e.g. when the leader appliance launches the
103     # worker appliance on a worker node. To support this, we embed a self-reference into the image:
104     ENV TOIL_APPLIANCE_SELF {applianceSelf}
105 
106     # This component changes most frequently and keeping it last maximizes Docker cache hits.
107     COPY {sdistName} .
108     RUN pip install {sdistName}[aws,mesos,encryption,cwl]
109     RUN rm {sdistName}
110 
111     # We intentionally inherit the default ENTRYPOINT and CMD from the base image, to the effect
112     # that the running appliance just gives you a shell. To start the Mesos master or slave
113     # daemons, the user # should override the entrypoint via --entrypoint.
114 
115     RUN echo '[ ! -z "$TERM" -a -r /etc/motd ] && cat /etc/motd' >> /etc/bash.bashrc \
116         && printf '{motd}' > /etc/motd
117 '''))
118
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/docker/Dockerfile.py b/docker/Dockerfile.py
--- a/docker/Dockerfile.py
+++ b/docker/Dockerfile.py
@@ -103,6 +103,10 @@
     # worker appliance on a worker node. To support this, we embed a self-reference into the image:
     ENV TOIL_APPLIANCE_SELF {applianceSelf}
 
+    RUN mkdir /var/lib/toil
+
+    ENV TOIL_WORKDIR /var/lib/toil
+
     # This component changes most frequently and keeping it last maximizes Docker cache hits.
     COPY {sdistName} .
     RUN pip install {sdistName}[aws,mesos,encryption,cwl]

{"golden_diff": "diff --git a/docker/Dockerfile.py b/docker/Dockerfile.py\n--- a/docker/Dockerfile.py\n+++ b/docker/Dockerfile.py\n@@ -103,6 +103,10 @@\n     # worker appliance on a worker node. To support this, we embed a self-reference into the image:\n     ENV TOIL_APPLIANCE_SELF {applianceSelf}\n \n+    RUN mkdir /var/lib/toil\n+\n+    ENV TOIL_WORKDIR /var/lib/toil\n+\n     # This component changes most frequently and keeping it last maximizes Docker cache hits.\n     COPY {sdistName} .\n     RUN pip install {sdistName}[aws,mesos,encryption,cwl]\n", "issue": "Toil Appliance should set /var/lib/toil as the default workdir \n\nToil Appliance should set /var/lib/toil as the default workdir \n\n", "before_files": [{"content": "# Copyright (C) 2015-2016 Regents of the University of California\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom __future__ import print_function\nimport os\nimport textwrap\n\napplianceSelf = os.environ['TOIL_APPLIANCE_SELF']\nsdistName = os.environ['_TOIL_SDIST_NAME']\n\n\ndependencies = ' '.join(['libffi-dev',  # For client side encryption for 'azure' extra with PyNACL\n                         'python-dev',  # For installing Python packages with native code\n                         'python-pip',  # Bootstrap pip, but needs upgrading, see below\n                         'libcurl4-openssl-dev',\n                         'libssl-dev',\n                         'wget',\n                         'curl',\n                         'openssh-server',\n                         'mesos=1.0.0-2.0.89.ubuntu1404',\n                         'rsync',\n                         'screen'])\n\n\ndef heredoc(s):\n    s = textwrap.dedent(s).format(**globals())\n    return s[1:] if s.startswith('\\n') else s\n\n\nmotd = heredoc('''\n\n    This is the Toil appliance. You can run your Toil script directly on the appliance, but only\n    in single-machine mode. Alternatively, create a Toil cluster with `toil launch-cluster`,\n    log into the leader of that cluster with `toil ssh-cluster` and run your Toil script there.\n\n    For more information see http://toil.readthedocs.io/en/latest/\n\n    Copyright (C) 2015-2016 Regents of the University of California\n\n    Version: {applianceSelf}\n\n''')\n\n# Prepare motd to be echoed in the Dockerfile using a RUN statement that uses bash's print\nmotd = ''.join(l + '\\\\n\\\\\\n' for l in motd.splitlines())\n\nprint(heredoc('''\n    FROM ubuntu:14.04\n\n    RUN echo \"deb http://repos.mesosphere.io/ubuntu/ trusty main\" \\\n        > /etc/apt/sources.list.d/mesosphere.list \\\n        && apt-key adv --keyserver keyserver.ubuntu.com --recv E56151BF \\\n        && apt-get -y update \\\n        && apt-get -y install {dependencies} \\\n        && apt-get clean && rm -rf /var/lib/apt/lists/*\n\n    RUN mkdir /root/.ssh && \\\n        chmod 700 /root/.ssh\n\n    ADD waitForKey.sh /usr/bin/waitForKey.sh\n\n    RUN chmod 777 /usr/bin/waitForKey.sh\n\n    # The stock pip is too old and can't install from sdist with extras\n    RUN pip install --upgrade pip==8.1.2\n\n    # Include virtualenv, as it is still the recommended way to deploy pipelines\n    RUN pip install --upgrade virtualenv==15.0.3\n\n    # Install s3am (--never-download prevents silent upgrades to pip, wheel and setuptools)\n    RUN virtualenv --never-download /home/s3am \\\n        && /home/s3am/bin/pip install s3am==2.0 \\\n        && ln -s /home/s3am/bin/s3am /usr/local/bin/\n\n    # Install statically linked version of docker client\n    RUN wget -O /usr/bin/docker https://get.docker.com/builds/Linux/x86_64/docker-1.10.3 \\\n        && chmod +x /usr/bin/docker\n\n    # Fix for Mesos interface dependency missing on ubuntu\n    RUN pip install protobuf==3.0.0\n\n    # Move the Mesos module onto the Python path\n    RUN ln -s /usr/lib/python2.7/site-packages/mesos /usr/local/lib/python2.7/dist-packages/mesos\n\n    # Fix for https://issues.apache.org/jira/browse/MESOS-3793\n    ENV MESOS_LAUNCHER=posix\n\n    # Fix for `screen` (https://github.com/BD2KGenomics/toil/pull/1386#issuecomment-267424561)\n    ENV TERM linux\n\n    # An appliance may need to start more appliances, e.g. when the leader appliance launches the\n    # worker appliance on a worker node. To support this, we embed a self-reference into the image:\n    ENV TOIL_APPLIANCE_SELF {applianceSelf}\n\n    # This component changes most frequently and keeping it last maximizes Docker cache hits.\n    COPY {sdistName} .\n    RUN pip install {sdistName}[aws,mesos,encryption,cwl]\n    RUN rm {sdistName}\n\n    # We intentionally inherit the default ENTRYPOINT and CMD from the base image, to the effect\n    # that the running appliance just gives you a shell. To start the Mesos master or slave\n    # daemons, the user # should override the entrypoint via --entrypoint.\n\n    RUN echo '[ ! -z \"$TERM\" -a -r /etc/motd ] && cat /etc/motd' >> /etc/bash.bashrc \\\n        && printf '{motd}' > /etc/motd\n'''))\n", "path": "docker/Dockerfile.py"}], "after_files": [{"content": "# Copyright (C) 2015-2016 Regents of the University of California\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom __future__ import print_function\nimport os\nimport textwrap\n\napplianceSelf = os.environ['TOIL_APPLIANCE_SELF']\nsdistName = os.environ['_TOIL_SDIST_NAME']\n\n\ndependencies = ' '.join(['libffi-dev',  # For client side encryption for 'azure' extra with PyNACL\n                         'python-dev',  # For installing Python packages with native code\n                         'python-pip',  # Bootstrap pip, but needs upgrading, see below\n                         'libcurl4-openssl-dev',\n                         'libssl-dev',\n                         'wget',\n                         'curl',\n                         'openssh-server',\n                         'mesos=1.0.0-2.0.89.ubuntu1404',\n                         'rsync',\n                         'screen'])\n\n\ndef heredoc(s):\n    s = textwrap.dedent(s).format(**globals())\n    return s[1:] if s.startswith('\\n') else s\n\n\nmotd = heredoc('''\n\n    This is the Toil appliance. You can run your Toil script directly on the appliance, but only\n    in single-machine mode. Alternatively, create a Toil cluster with `toil launch-cluster`,\n    log into the leader of that cluster with `toil ssh-cluster` and run your Toil script there.\n\n    For more information see http://toil.readthedocs.io/en/latest/\n\n    Copyright (C) 2015-2016 Regents of the University of California\n\n    Version: {applianceSelf}\n\n''')\n\n# Prepare motd to be echoed in the Dockerfile using a RUN statement that uses bash's print\nmotd = ''.join(l + '\\\\n\\\\\\n' for l in motd.splitlines())\n\nprint(heredoc('''\n    FROM ubuntu:14.04\n\n    RUN echo \"deb http://repos.mesosphere.io/ubuntu/ trusty main\" \\\n        > /etc/apt/sources.list.d/mesosphere.list \\\n        && apt-key adv --keyserver keyserver.ubuntu.com --recv E56151BF \\\n        && apt-get -y update \\\n        && apt-get -y install {dependencies} \\\n        && apt-get clean && rm -rf /var/lib/apt/lists/*\n\n    RUN mkdir /root/.ssh && \\\n        chmod 700 /root/.ssh\n\n    ADD waitForKey.sh /usr/bin/waitForKey.sh\n\n    RUN chmod 777 /usr/bin/waitForKey.sh\n\n    # The stock pip is too old and can't install from sdist with extras\n    RUN pip install --upgrade pip==8.1.2\n\n    # Include virtualenv, as it is still the recommended way to deploy pipelines\n    RUN pip install --upgrade virtualenv==15.0.3\n\n    # Install s3am (--never-download prevents silent upgrades to pip, wheel and setuptools)\n    RUN virtualenv --never-download /home/s3am \\\n        && /home/s3am/bin/pip install s3am==2.0 \\\n        && ln -s /home/s3am/bin/s3am /usr/local/bin/\n\n    # Install statically linked version of docker client\n    RUN wget -O /usr/bin/docker https://get.docker.com/builds/Linux/x86_64/docker-1.10.3 \\\n        && chmod +x /usr/bin/docker\n\n    # Fix for Mesos interface dependency missing on ubuntu\n    RUN pip install protobuf==3.0.0\n\n    # Move the Mesos module onto the Python path\n    RUN ln -s /usr/lib/python2.7/site-packages/mesos /usr/local/lib/python2.7/dist-packages/mesos\n\n    # Fix for https://issues.apache.org/jira/browse/MESOS-3793\n    ENV MESOS_LAUNCHER=posix\n\n    # Fix for `screen` (https://github.com/BD2KGenomics/toil/pull/1386#issuecomment-267424561)\n    ENV TERM linux\n\n    # An appliance may need to start more appliances, e.g. when the leader appliance launches the\n    # worker appliance on a worker node. To support this, we embed a self-reference into the image:\n    ENV TOIL_APPLIANCE_SELF {applianceSelf}\n\n    RUN mkdir /var/lib/toil\n\n    ENV TOIL_WORKDIR /var/lib/toil\n\n    # This component changes most frequently and keeping it last maximizes Docker cache hits.\n    COPY {sdistName} .\n    RUN pip install {sdistName}[aws,mesos,encryption,cwl]\n    RUN rm {sdistName}\n\n    # We intentionally inherit the default ENTRYPOINT and CMD from the base image, to the effect\n    # that the running appliance just gives you a shell. To start the Mesos master or slave\n    # daemons, the user # should override the entrypoint via --entrypoint.\n\n    RUN echo '[ ! -z \"$TERM\" -a -r /etc/motd ] && cat /etc/motd' >> /etc/bash.bashrc \\\n        && printf '{motd}' > /etc/motd\n'''))\n", "path": "docker/Dockerfile.py"}]}