Skip to content

Commit

Permalink
wrapper: rhv: drop XDG_RUNTIME_DIR from environment (RHBZ#1700461)
Browse files Browse the repository at this point in the history
It is not reset for su/sudo and it will cause permissions problems for
virt-v2v later on.

See: https://bugzilla.redhat.com/967509

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
  • Loading branch information
nyoxi committed Apr 16, 2019
1 parent bc61fb2 commit 185d75a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion wrapper/virt-v2v-wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
DEVNULL = subprocess.DEVNULL

# Wrapper version
VERSION = "18"
VERSION = "18.1"

LOG_LEVEL = logging.DEBUG
STATE_DIR = '/tmp'
Expand Down Expand Up @@ -757,6 +757,13 @@ def prepare_command(self, data, v2v_args, v2v_env, v2v_caps):
'-o', 'rhv',
'-os', data['export_domain'],
])
if 'XDG_RUNTIME_DIR' in v2v_env and self.get_uid() != 0:
# Drop XDG_RUNTIME_DIR from environment. Otherwise it would "leak"
# throuh our su/sudo call and would cause permissions error for
# virt-v2v.
#
# https://bugzilla.redhat.com/show_bug.cgi?id=967509
del v2v_env['XDG_RUNTIME_DIR']

return v2v_args, v2v_env

Expand Down

0 comments on commit 185d75a

Please sign in to comment.