diff options
author | Lars Wirzenius <liw@liw.fi> | 2014-02-25 08:45:16 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2014-02-25 08:45:16 +0000 |
commit | b7512ada93c2de80f3be6374bc7c32643c61940e (patch) | |
tree | 48a5f7ddeb042c73c4a1f36cc3b1cd7479485e1f /obnamlib/plugins/fuse_plugin.py | |
parent | d2489623d055746354ab3023aec7f43ccde3b84d (diff) | |
download | obnam-b7512ada93c2de80f3be6374bc7c32643c61940e.tar.gz |
RE-instate chdir in re-opening repo
Valery pointed out to me that FUSE itself does a chdir, so we do
need to chdir back to where we were when re-opening.
Diffstat (limited to 'obnamlib/plugins/fuse_plugin.py')
-rw-r--r-- | obnamlib/plugins/fuse_plugin.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/obnamlib/plugins/fuse_plugin.py b/obnamlib/plugins/fuse_plugin.py index 0f287381..9ff6eaae 100644 --- a/obnamlib/plugins/fuse_plugin.py +++ b/obnamlib/plugins/fuse_plugin.py @@ -582,6 +582,13 @@ class MountPlugin(obnamlib.ObnamPlugin): self.app.settings.require('client-name') self.app.settings.require('to') + # Remember the current working directory. FUSE will change + # the current working directory to / when it backgrounds itself, + # and this can break a --repository setting value that is a + # relative pathname. When we re-open the repository, we'll first + # chdir to where we are now, so this doesn't break. + self.cwd = os.getcwd() + self.repo = self.app.get_repository_object() logging.debug( @@ -604,4 +611,9 @@ class MountPlugin(obnamlib.ObnamPlugin): def reopen(self): self.repo.close() + + # Change to original working directory, to allow relative paths + # for --repository to work correctly. + os.chdir(self.cwd) + self.repo = self.app.get_repository_object() |