From: Gabriel Filion Date: Sat, 28 Jul 2012 03:02:10 +0000 (-0400) Subject: Add BUP_DIR to the subprocess environment during set-dir on the server. X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=8ed5d4da0b7f160bb903dfaa6ecc4f2f895f03f0;p=packages%2Fb%2Fbup.git Add BUP_DIR to the subprocess environment during set-dir on the server. In the normal flow of a remote backup, the client indicates to the server end where it wants to save data (e.g. where the bup repository is) by issuing a "set-dir path" command. This command on the server end records the path in a global variable. But it doesn't place it in the environment. This causes any subprocess forked on the server end to be ignorant about the location of the bup repository and causes errors such as this one: Traceback (most recent call last): File "/usr/lib/bup/cmd/bup-midx", line 231, in git.check_repo_or_die() File "/usr/lib/bup/bup/git.py", line 851, in check_repo_or_die init_repo() File "/usr/lib/bup/bup/git.py", line 828, in init_repo _git_wait('git init', p) File "/usr/lib/bup/bup/git.py", line 887, in _git_wait raise GitError('%s returned %d' % (cmd, rv)) bup.git.GitError: git init returned 1 ['/usr/bin/bup', 'midx', '--auto', '--dir', '/backup/test/objects/pack']: returned 1 Signed-off-by: Gabriel Filion Reviewed-by: Rob Browning --- diff --git a/cmd/server-cmd.py b/cmd/server-cmd.py index acd6119..a9d742c 100755 --- a/cmd/server-cmd.py +++ b/cmd/server-cmd.py @@ -28,6 +28,9 @@ def init_dir(conn, arg): def set_dir(conn, arg): git.check_repo_or_die(arg) + # OK. we now know the path is a proper repository. Record this path in the + # environment so that subprocesses inherit it and know where to operate. + os.environ['BUP_DIR'] = arg debug1('bup server: bupdir is %r\n' % git.repodir) _set_mode() conn.ok()