xpra icon
Bug tracker and wiki

#1224 closed defect (worksforme)

expand set of variables in 'env'

Reported by: psycho_zs Owned by: psycho_zs
Priority: major Milestone: 1.0
Component: server Version: 1.0.x
Keywords: variables environment Cc:

Description (last modified by Antoine Martin)

Please consider supporting some variable expansion in 'env' parameters:

Common variables:

$HOME
$USER
$UID
$GID
$GROUPS
$LANG and $LC_* variables

XDG vars:

$XDG_CACHE_HOME
$XDG_CONFIG_DIRS
$XDG_CONFIG_HOME
$XDG_CURRENT_DESKTOP
$XDG_DATA_DIRS
$XDG_DATA_HOME
$XDG_MENU_PREFIX
$XDG_RUNTIME_DIR
$XDG_SEAT
$XDG_SEAT_PATH
$XDG_SESSION_DESKTOP
$XDG_SESSION_ID
$XDG_SESSION_PATH
$XDG_SESSION_TYPE
$XDG_VTNR

Change History (6)

comment:1 Changed 18 months ago by Antoine Martin

Description: modified (diff)
Owner: changed from Antoine Martin to psycho_zs

Done in r12795 using os.path.expandvars. We expand any variable found in the environment using the syntax $VAR or ${VAR}.

Limitations:

  • I can't think of any problems it would cause but this function is designed for expanding paths
  • We do not expand variables defined using the env switch, so --env=A=X --env=B=$A will not give you B=X

Please close if that works for you.

comment:2 Changed 18 months ago by psycho_zs

Resolution: fixed
Status: newclosed

Knowing that limitation, strings can be repeated.

It works.
Thank you!

comment:3 Changed 17 months ago by Antoine Martin

Milestone: 0.181.0

Milestone renamed

comment:4 Changed 12 months ago by psycho_zs

Resolution: fixed
Status: closedreopened
Version: trunk1.0.x

Variables stopped working after upgrade to stable branch 1.0-r14502-1 (deb).

for example, with this line in config:
env = XDG_CONFIG_HOME=${HOME}/.config

variable is set as literal ${HOME}/.config

comment:5 Changed 12 months ago by Antoine Martin

Status: reopenednew

Fixed in r14605, this will be included in 1.0.1

FYI: with 1.0, you often want to use "start-env=KEY=VALUE" rather than "env=" (and the former works as expected in 1.0):

  • "start-env" affects all commands started by xpra
  • "env" affects everything including xpra itself
Last edited 12 months ago by Antoine Martin (previous) (diff)

comment:6 Changed 11 months ago by Antoine Martin

Resolution: worksforme
Status: newclosed

Not heard back, closing.

Note: See TracTickets for help on using tickets.