qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Environment variables for user-mode QEMU


From: Riku Voipio
Subject: Re: [Qemu-devel] Environment variables for user-mode QEMU
Date: Thu, 25 Apr 2013 15:22:52 +0300
User-agent: Mutt/1.5.20 (2009-06-14)

Bcc: 
Subject: Re: [Qemu-devel] Environment variables for user-mode QEMU
Reply-To: 
In-Reply-To: <address@hidden>
X-message-flag: Warning: message not sent with a DRM-Certified client 

On Wed, Apr 24, 2013 at 03:16:27PM +0200, Thomas Schwinge wrote:
> We have a need to pass environment variable assignments containing commas
> to user-mode QEMU.  The usage information currently says:
 
>     You can use -E and -U options or the QEMU_SET_ENV and
>     QEMU_UNSET_ENV environment variables to set and unset
>     environment variables for the target process.
>     It is possible to provide several variables by separating them
>     by commas in getsubopt(3) style. Additionally it is possible to
>     provide the -E and -U options multiple times.
 
>     $ env -i x86_64-linux-user/qemu-x86_64 -E x=y,y=z /usr/bin/printenv
>     y=z
>     x=y
> 
> Instead of this, we'd like to see:
> 
>     $ env -i x86_64-linux-user/qemu-x86_64 -E x=y,y=z /usr/bin/printenv
>     x=y,y=z
> 
> Due to the tokenization based on comma in
> linux-user/main.c:handle_arg_set_env, there is currently no way to
> achieve this -- other than pre-setting environment variables before
> running user-mode QEMU, which obviously isn't always desirable/possible
> (LD_LIBRARY_PATH, etc.).
> 
> Assuming there is a consensus, how would you like this implemented?
 
> Is it OK to change the semantics of -E (as well as -U, for symmetry?) to
> not handle multiple environment variable assignments (preliminary patch
> below), or does that functionality need to be preserved?  Something needs
> to be done about QEMU_SET_ENV and QEMU_UNSET_ENV then (if anyone is using
> these at all, which we can't disprove), as these are not very useful if
> they can handle only one environment variable.

We do not want to break backwards compatability. Also, adding an new
option to support passing commas would be ugly - and
we would have to support both options for a long time.

The only reason why we need the comma parsing is for the
QEMU_SET_ENV env variable, where the only way to set multiple env
variables is with commas.

However, it can be argued, that adding support for env variables 
in commit fc9c54124d134dbd76338a92a91804dab2df8166 broke passing commas
using the traditional "-E " parameters. 

So we could weasel ourself out of this mess by removing comma parsing when
setting env variables from "-E", while keep parsing when using QEMU_SET_ENV.

Riku



reply via email to

[Prev in Thread] Current Thread [Next in Thread]