#977728 /usr/bin/virsh: Please pass XDG_* environment variables to the SSH binary

Package:
libvirt-clients
Source:
libvirt
Description:
Programs for the libvirt library
Submitter:
Guilhem Moulin
Date:
2020-12-19 17:45:03 UTC
Severity:
wishlist
Tags:
#977728#5
Date:
2020-12-19 17:40:26 UTC
From:
To:
Package: libvirt-clients
Version: 6.9.0-1+b2
Severity: wishlist
File: /usr/bin/virsh
Tags: patch upstream

Dear Maintainer,

Since version 8.4 OpenSSH supports environment variables in several
configuration values [0], thereby allowing using $XDG_RUNTIME_DIR as
ControlPath directory without having to hardcode its value in
~/.ssh/config:

    ControlPath ${XDG_RUNTIME_DIR}/ssh-%C

However the above snippet causes the command to fail as virsh runs it in
a sanitized environment:

    error: failed to connect to the hypervisor
    error: Cannot recv data: vdollar_percent_expand: env var ${XDG_RUNTIME_DIR} has no value
    invalid environment variable expansion: Connection reset by peer

This patch preserves environment variables of the XDG Base Directory
Specification [1] when calling the SSH binary.  (Other XDG_* environment
variables are arguably useful as well for ProxyCommand.)

Alternatively, maybe a configuration option to run the SSH binary in the
stock environment would do?  After all OpenSSH has its own environment
sanitation logic.

Thanks,
cheers,