We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Mojave, new workstation
Hi, I'm on a new workstation with Dropbox installed.  I installed mackup with pip and ran 'mackup restore' and got this:

Traceback (most recent call last):
  File "/usr/local/bin/mackup", line 9, in <module>
    load_entry_point('mackup==0.8.20', 'console_scripts', 'mackup')()
  File "/Library/Python/2.7/site-packages/mackup/main.py", line 65, in main
    app_db = ApplicationsDatabase()
  File "/Library/Python/2.7/site-packages/mackup/appsdb.py", line 63, in __init__
    .format(xdg_config_home))
ValueError: $XDG_CONFIG_HOME: /Users/stephens/.config does not exist

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `mackup/appsdb.py`
Content:
```
1 """
2 The applications database.
3 
4 The Applications Database provides an easy to use interface to load application
5 data from the Mackup Database (files).
6 """
7 import os
8 
9 try:
10     import configparser
11 except ImportError:
12     import ConfigParser as configparser
13 
14 
15 from .constants import APPS_DIR
16 from .constants import CUSTOM_APPS_DIR
17 
18 
19 class ApplicationsDatabase(object):
20 
21     """Database containing all the configured applications."""
22 
23     def __init__(self):
24         """Create a ApplicationsDatabase instance."""
25         # Build the dict that will contain the properties of each application
26         self.apps = dict()
27 
28         for config_file in ApplicationsDatabase.get_config_files():
29             config = configparser.SafeConfigParser(allow_no_value=True)
30 
31             # Needed to not lowercase the configuration_files in the ini files
32             config.optionxform = str
33 
34             if config.read(config_file):
35                 # Get the filename without the directory name
36                 filename = os.path.basename(config_file)
37                 # The app name is the cfg filename with the extension
38                 app_name = filename[:-len('.cfg')]
39 
40                 # Start building a dict for this app
41                 self.apps[app_name] = dict()
42 
43                 # Add the fancy name for the app, for display purpose
44                 app_pretty_name = config.get('application', 'name')
45                 self.apps[app_name]['name'] = app_pretty_name
46 
47                 # Add the configuration files to sync
48                 self.apps[app_name]['configuration_files'] = set()
49                 if config.has_section('configuration_files'):
50                     for path in config.options('configuration_files'):
51                         if path.startswith('/'):
52                             raise ValueError('Unsupported absolute path: {}'
53                                              .format(path))
54                         self.apps[app_name]['configuration_files'].add(path)
55 
56                 # Add the XDG configuration files to sync
57                 home = os.path.expanduser('~/')
58                 failobj = "{}.config".format(home)
59                 xdg_config_home = os.environ.get('XDG_CONFIG_HOME', failobj)
60                 if xdg_config_home:
61                     if not os.path.exists(xdg_config_home):
62                         raise ValueError('$XDG_CONFIG_HOME: {} does not exist'
63                                          .format(xdg_config_home))
64                     if not xdg_config_home.startswith(home):
65                         raise ValueError('$XDG_CONFIG_HOME: {} must be '
66                                          'somewhere within your home '
67                                          'directory: {}'
68                                          .format(xdg_config_home, home))
69                     if config.has_section('xdg_configuration_files'):
70                         for path in config.options('xdg_configuration_files'):
71                             if path.startswith('/'):
72                                 raise ValueError('Unsupported absolute path: '
73                                                  '{}'
74                                                  .format(path))
75                             path = os.path.join(xdg_config_home, path)
76                             path = path.replace(home, '')
77                             (self.apps[app_name]['configuration_files']
78                                 .add(path))
79 
80     @staticmethod
81     def get_config_files():
82         """
83         Return the application configuration files.
84 
85         Return a list of configuration files describing the apps supported by
86         Mackup. The files return are absolute full path to those files.
87         e.g. /usr/lib/mackup/applications/bash.cfg
88 
89         Only one config file per application should be returned, custom config
90         having a priority over stock config.
91 
92         Returns:
93             set of strings.
94         """
95         # Configure the config parser
96         apps_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)),
97                                 APPS_DIR)
98         custom_apps_dir = os.path.join(os.environ['HOME'], CUSTOM_APPS_DIR)
99 
100         # List of stock application config files
101         config_files = set()
102 
103         # Temp list of user added app config file names
104         custom_files = set()
105 
106         # Get the list of custom application config files first
107         if os.path.isdir(custom_apps_dir):
108             for filename in os.listdir(custom_apps_dir):
109                 if filename.endswith('.cfg'):
110                     config_files.add(os.path.join(custom_apps_dir,
111                                                   filename))
112                     # Also add it to the set of custom apps, so that we don't
113                     # add the stock config for the same app too
114                     custom_files.add(filename)
115 
116         # Add the default provided app config files, but only if those are not
117         # customized, as we don't want to overwrite custom app config.
118         for filename in os.listdir(apps_dir):
119             if filename.endswith('.cfg') and filename not in custom_files:
120                 config_files.add(os.path.join(apps_dir, filename))
121 
122         return config_files
123 
124     def get_name(self, name):
125         """
126         Return the fancy name of an application.
127 
128         Args:
129             name (str)
130 
131         Returns:
132             str
133         """
134         return self.apps[name]['name']
135 
136     def get_files(self, name):
137         """
138         Return the list of config files of an application.
139 
140         Args:
141             name (str)
142 
143         Returns:
144             set of str.
145         """
146         return self.apps[name]['configuration_files']
147 
148     def get_app_names(self):
149         """
150         Return application names.
151 
152         Return the list of application names that are available in the
153         database.
154 
155         Returns:
156             set of str.
157         """
158         app_names = set()
159         for name in self.apps:
160             app_names.add(name)
161 
162         return app_names
163 
164     def get_pretty_app_names(self):
165         """
166         Return the list of pretty app names that are available in the database.
167 
168         Returns:
169             set of str.
170         """
171         pretty_app_names = set()
172         for app_name in self.get_app_names():
173             pretty_app_names.add(self.get_name(app_name))
174 
175         return pretty_app_names
176
```
--- 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/mackup/appsdb.py b/mackup/appsdb.py
--- a/mackup/appsdb.py
+++ b/mackup/appsdb.py
@@ -57,25 +57,21 @@
                 home = os.path.expanduser('~/')
                 failobj = "{}.config".format(home)
                 xdg_config_home = os.environ.get('XDG_CONFIG_HOME', failobj)
-                if xdg_config_home:
-                    if not os.path.exists(xdg_config_home):
-                        raise ValueError('$XDG_CONFIG_HOME: {} does not exist'
-                                         .format(xdg_config_home))
-                    if not xdg_config_home.startswith(home):
-                        raise ValueError('$XDG_CONFIG_HOME: {} must be '
-                                         'somewhere within your home '
-                                         'directory: {}'
-                                         .format(xdg_config_home, home))
-                    if config.has_section('xdg_configuration_files'):
-                        for path in config.options('xdg_configuration_files'):
-                            if path.startswith('/'):
-                                raise ValueError('Unsupported absolute path: '
-                                                 '{}'
-                                                 .format(path))
-                            path = os.path.join(xdg_config_home, path)
-                            path = path.replace(home, '')
-                            (self.apps[app_name]['configuration_files']
-                                .add(path))
+                if not xdg_config_home.startswith(home):
+                    raise ValueError('$XDG_CONFIG_HOME: {} must be '
+                                     'somewhere within your home '
+                                     'directory: {}'
+                                     .format(xdg_config_home, home))
+                if config.has_section('xdg_configuration_files'):
+                    for path in config.options('xdg_configuration_files'):
+                        if path.startswith('/'):
+                            raise ValueError('Unsupported absolute path: '
+                                             '{}'
+                                             .format(path))
+                        path = os.path.join(xdg_config_home, path)
+                        path = path.replace(home, '')
+                        (self.apps[app_name]['configuration_files']
+                            .add(path))
 
     @staticmethod
     def get_config_files():

{"golden_diff": "diff --git a/mackup/appsdb.py b/mackup/appsdb.py\n--- a/mackup/appsdb.py\n+++ b/mackup/appsdb.py\n@@ -57,25 +57,21 @@\n                 home = os.path.expanduser('~/')\n                 failobj = \"{}.config\".format(home)\n                 xdg_config_home = os.environ.get('XDG_CONFIG_HOME', failobj)\n-                if xdg_config_home:\n-                    if not os.path.exists(xdg_config_home):\n-                        raise ValueError('$XDG_CONFIG_HOME: {} does not exist'\n-                                         .format(xdg_config_home))\n-                    if not xdg_config_home.startswith(home):\n-                        raise ValueError('$XDG_CONFIG_HOME: {} must be '\n-                                         'somewhere within your home '\n-                                         'directory: {}'\n-                                         .format(xdg_config_home, home))\n-                    if config.has_section('xdg_configuration_files'):\n-                        for path in config.options('xdg_configuration_files'):\n-                            if path.startswith('/'):\n-                                raise ValueError('Unsupported absolute path: '\n-                                                 '{}'\n-                                                 .format(path))\n-                            path = os.path.join(xdg_config_home, path)\n-                            path = path.replace(home, '')\n-                            (self.apps[app_name]['configuration_files']\n-                                .add(path))\n+                if not xdg_config_home.startswith(home):\n+                    raise ValueError('$XDG_CONFIG_HOME: {} must be '\n+                                     'somewhere within your home '\n+                                     'directory: {}'\n+                                     .format(xdg_config_home, home))\n+                if config.has_section('xdg_configuration_files'):\n+                    for path in config.options('xdg_configuration_files'):\n+                        if path.startswith('/'):\n+                            raise ValueError('Unsupported absolute path: '\n+                                             '{}'\n+                                             .format(path))\n+                        path = os.path.join(xdg_config_home, path)\n+                        path = path.replace(home, '')\n+                        (self.apps[app_name]['configuration_files']\n+                            .add(path))\n \n     @staticmethod\n     def get_config_files():\n", "issue": "Mojave, new workstation\nHi, I'm on a new workstation with Dropbox installed.  I installed mackup with pip and ran 'mackup restore' and got this:\r\n\r\nTraceback (most recent call last):\r\n  File \"/usr/local/bin/mackup\", line 9, in <module>\r\n    load_entry_point('mackup==0.8.20', 'console_scripts', 'mackup')()\r\n  File \"/Library/Python/2.7/site-packages/mackup/main.py\", line 65, in main\r\n    app_db = ApplicationsDatabase()\r\n  File \"/Library/Python/2.7/site-packages/mackup/appsdb.py\", line 63, in __init__\r\n    .format(xdg_config_home))\r\nValueError: $XDG_CONFIG_HOME: /Users/stephens/.config does not exist\n", "before_files": [{"content": "\"\"\"\nThe applications database.\n\nThe Applications Database provides an easy to use interface to load application\ndata from the Mackup Database (files).\n\"\"\"\nimport os\n\ntry:\n    import configparser\nexcept ImportError:\n    import ConfigParser as configparser\n\n\nfrom .constants import APPS_DIR\nfrom .constants import CUSTOM_APPS_DIR\n\n\nclass ApplicationsDatabase(object):\n\n    \"\"\"Database containing all the configured applications.\"\"\"\n\n    def __init__(self):\n        \"\"\"Create a ApplicationsDatabase instance.\"\"\"\n        # Build the dict that will contain the properties of each application\n        self.apps = dict()\n\n        for config_file in ApplicationsDatabase.get_config_files():\n            config = configparser.SafeConfigParser(allow_no_value=True)\n\n            # Needed to not lowercase the configuration_files in the ini files\n            config.optionxform = str\n\n            if config.read(config_file):\n                # Get the filename without the directory name\n                filename = os.path.basename(config_file)\n                # The app name is the cfg filename with the extension\n                app_name = filename[:-len('.cfg')]\n\n                # Start building a dict for this app\n                self.apps[app_name] = dict()\n\n                # Add the fancy name for the app, for display purpose\n                app_pretty_name = config.get('application', 'name')\n                self.apps[app_name]['name'] = app_pretty_name\n\n                # Add the configuration files to sync\n                self.apps[app_name]['configuration_files'] = set()\n                if config.has_section('configuration_files'):\n                    for path in config.options('configuration_files'):\n                        if path.startswith('/'):\n                            raise ValueError('Unsupported absolute path: {}'\n                                             .format(path))\n                        self.apps[app_name]['configuration_files'].add(path)\n\n                # Add the XDG configuration files to sync\n                home = os.path.expanduser('~/')\n                failobj = \"{}.config\".format(home)\n                xdg_config_home = os.environ.get('XDG_CONFIG_HOME', failobj)\n                if xdg_config_home:\n                    if not os.path.exists(xdg_config_home):\n                        raise ValueError('$XDG_CONFIG_HOME: {} does not exist'\n                                         .format(xdg_config_home))\n                    if not xdg_config_home.startswith(home):\n                        raise ValueError('$XDG_CONFIG_HOME: {} must be '\n                                         'somewhere within your home '\n                                         'directory: {}'\n                                         .format(xdg_config_home, home))\n                    if config.has_section('xdg_configuration_files'):\n                        for path in config.options('xdg_configuration_files'):\n                            if path.startswith('/'):\n                                raise ValueError('Unsupported absolute path: '\n                                                 '{}'\n                                                 .format(path))\n                            path = os.path.join(xdg_config_home, path)\n                            path = path.replace(home, '')\n                            (self.apps[app_name]['configuration_files']\n                                .add(path))\n\n    @staticmethod\n    def get_config_files():\n        \"\"\"\n        Return the application configuration files.\n\n        Return a list of configuration files describing the apps supported by\n        Mackup. The files return are absolute full path to those files.\n        e.g. /usr/lib/mackup/applications/bash.cfg\n\n        Only one config file per application should be returned, custom config\n        having a priority over stock config.\n\n        Returns:\n            set of strings.\n        \"\"\"\n        # Configure the config parser\n        apps_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)),\n                                APPS_DIR)\n        custom_apps_dir = os.path.join(os.environ['HOME'], CUSTOM_APPS_DIR)\n\n        # List of stock application config files\n        config_files = set()\n\n        # Temp list of user added app config file names\n        custom_files = set()\n\n        # Get the list of custom application config files first\n        if os.path.isdir(custom_apps_dir):\n            for filename in os.listdir(custom_apps_dir):\n                if filename.endswith('.cfg'):\n                    config_files.add(os.path.join(custom_apps_dir,\n                                                  filename))\n                    # Also add it to the set of custom apps, so that we don't\n                    # add the stock config for the same app too\n                    custom_files.add(filename)\n\n        # Add the default provided app config files, but only if those are not\n        # customized, as we don't want to overwrite custom app config.\n        for filename in os.listdir(apps_dir):\n            if filename.endswith('.cfg') and filename not in custom_files:\n                config_files.add(os.path.join(apps_dir, filename))\n\n        return config_files\n\n    def get_name(self, name):\n        \"\"\"\n        Return the fancy name of an application.\n\n        Args:\n            name (str)\n\n        Returns:\n            str\n        \"\"\"\n        return self.apps[name]['name']\n\n    def get_files(self, name):\n        \"\"\"\n        Return the list of config files of an application.\n\n        Args:\n            name (str)\n\n        Returns:\n            set of str.\n        \"\"\"\n        return self.apps[name]['configuration_files']\n\n    def get_app_names(self):\n        \"\"\"\n        Return application names.\n\n        Return the list of application names that are available in the\n        database.\n\n        Returns:\n            set of str.\n        \"\"\"\n        app_names = set()\n        for name in self.apps:\n            app_names.add(name)\n\n        return app_names\n\n    def get_pretty_app_names(self):\n        \"\"\"\n        Return the list of pretty app names that are available in the database.\n\n        Returns:\n            set of str.\n        \"\"\"\n        pretty_app_names = set()\n        for app_name in self.get_app_names():\n            pretty_app_names.add(self.get_name(app_name))\n\n        return pretty_app_names\n", "path": "mackup/appsdb.py"}], "after_files": [{"content": "\"\"\"\nThe applications database.\n\nThe Applications Database provides an easy to use interface to load application\ndata from the Mackup Database (files).\n\"\"\"\nimport os\n\ntry:\n    import configparser\nexcept ImportError:\n    import ConfigParser as configparser\n\n\nfrom .constants import APPS_DIR\nfrom .constants import CUSTOM_APPS_DIR\n\n\nclass ApplicationsDatabase(object):\n\n    \"\"\"Database containing all the configured applications.\"\"\"\n\n    def __init__(self):\n        \"\"\"Create a ApplicationsDatabase instance.\"\"\"\n        # Build the dict that will contain the properties of each application\n        self.apps = dict()\n\n        for config_file in ApplicationsDatabase.get_config_files():\n            config = configparser.SafeConfigParser(allow_no_value=True)\n\n            # Needed to not lowercase the configuration_files in the ini files\n            config.optionxform = str\n\n            if config.read(config_file):\n                # Get the filename without the directory name\n                filename = os.path.basename(config_file)\n                # The app name is the cfg filename with the extension\n                app_name = filename[:-len('.cfg')]\n\n                # Start building a dict for this app\n                self.apps[app_name] = dict()\n\n                # Add the fancy name for the app, for display purpose\n                app_pretty_name = config.get('application', 'name')\n                self.apps[app_name]['name'] = app_pretty_name\n\n                # Add the configuration files to sync\n                self.apps[app_name]['configuration_files'] = set()\n                if config.has_section('configuration_files'):\n                    for path in config.options('configuration_files'):\n                        if path.startswith('/'):\n                            raise ValueError('Unsupported absolute path: {}'\n                                             .format(path))\n                        self.apps[app_name]['configuration_files'].add(path)\n\n                # Add the XDG configuration files to sync\n                home = os.path.expanduser('~/')\n                failobj = \"{}.config\".format(home)\n                xdg_config_home = os.environ.get('XDG_CONFIG_HOME', failobj)\n                if not xdg_config_home.startswith(home):\n                    raise ValueError('$XDG_CONFIG_HOME: {} must be '\n                                     'somewhere within your home '\n                                     'directory: {}'\n                                     .format(xdg_config_home, home))\n                if config.has_section('xdg_configuration_files'):\n                    for path in config.options('xdg_configuration_files'):\n                        if path.startswith('/'):\n                            raise ValueError('Unsupported absolute path: '\n                                             '{}'\n                                             .format(path))\n                        path = os.path.join(xdg_config_home, path)\n                        path = path.replace(home, '')\n                        (self.apps[app_name]['configuration_files']\n                            .add(path))\n\n    @staticmethod\n    def get_config_files():\n        \"\"\"\n        Return the application configuration files.\n\n        Return a list of configuration files describing the apps supported by\n        Mackup. The files return are absolute full path to those files.\n        e.g. /usr/lib/mackup/applications/bash.cfg\n\n        Only one config file per application should be returned, custom config\n        having a priority over stock config.\n\n        Returns:\n            set of strings.\n        \"\"\"\n        # Configure the config parser\n        apps_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)),\n                                APPS_DIR)\n        custom_apps_dir = os.path.join(os.environ['HOME'], CUSTOM_APPS_DIR)\n\n        # List of stock application config files\n        config_files = set()\n\n        # Temp list of user added app config file names\n        custom_files = set()\n\n        # Get the list of custom application config files first\n        if os.path.isdir(custom_apps_dir):\n            for filename in os.listdir(custom_apps_dir):\n                if filename.endswith('.cfg'):\n                    config_files.add(os.path.join(custom_apps_dir,\n                                                  filename))\n                    # Also add it to the set of custom apps, so that we don't\n                    # add the stock config for the same app too\n                    custom_files.add(filename)\n\n        # Add the default provided app config files, but only if those are not\n        # customized, as we don't want to overwrite custom app config.\n        for filename in os.listdir(apps_dir):\n            if filename.endswith('.cfg') and filename not in custom_files:\n                config_files.add(os.path.join(apps_dir, filename))\n\n        return config_files\n\n    def get_name(self, name):\n        \"\"\"\n        Return the fancy name of an application.\n\n        Args:\n            name (str)\n\n        Returns:\n            str\n        \"\"\"\n        return self.apps[name]['name']\n\n    def get_files(self, name):\n        \"\"\"\n        Return the list of config files of an application.\n\n        Args:\n            name (str)\n\n        Returns:\n            set of str.\n        \"\"\"\n        return self.apps[name]['configuration_files']\n\n    def get_app_names(self):\n        \"\"\"\n        Return application names.\n\n        Return the list of application names that are available in the\n        database.\n\n        Returns:\n            set of str.\n        \"\"\"\n        app_names = set()\n        for name in self.apps:\n            app_names.add(name)\n\n        return app_names\n\n    def get_pretty_app_names(self):\n        \"\"\"\n        Return the list of pretty app names that are available in the database.\n\n        Returns:\n            set of str.\n        \"\"\"\n        pretty_app_names = set()\n        for app_name in self.get_app_names():\n            pretty_app_names.add(self.get_name(app_name))\n\n        return pretty_app_names\n", "path": "mackup/appsdb.py"}]}