From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Andreas Schwab <schwab@suse.de>, Laurent Vivier <laurent@vivier.eu>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH] linux-user: preserve incoming order of environment variables in the target
Date: Wed, 29 Mar 2023 14:19:18 +0200 [thread overview]
Message-ID: <f83cced2-06dd-3e56-43dc-f76ad10deb56@linaro.org> (raw)
In-Reply-To: <mvmmt3vu8bz.fsf@suse.de>
On 29/3/23 13:04, Andreas Schwab wrote:
> Do not reverse the order of envionment variables in the target environ
"environment"
> array relative to the incoming environ order. Some testsuites depend on a
> specific order, even though it is not defined by any standard.
>
> Signed-off-by: Andreas Schwab <schwab@suse.de>
> ---
> linux-user/main.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/linux-user/main.c b/linux-user/main.c
> index 4b18461969..d0ede3f990 100644
> --- a/linux-user/main.c
> +++ b/linux-user/main.c
> @@ -691,8 +691,13 @@ int main(int argc, char **argv, char **envp)
> envlist = envlist_create();
>
> /* add current environment into the list */
> + /* envlist_setenv adds to the front of the list; to preserve environ
> + order add from back to front */
> for (wrk = environ; *wrk != NULL; wrk++) {
> - (void) envlist_setenv(envlist, *wrk);
> + continue;
> + }
> + while (wrk != environ) {
> + (void) envlist_setenv(envlist, *--wrk);
> }
Preferably using a dumber form (easier to review IMHO):
while (wrk != environ) {
wrk--;
(void) envlist_setenv(envlist, *wrk);
}
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
prev parent reply other threads:[~2023-03-29 12:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-29 11:04 [PATCH] linux-user: preserve incoming order of environment variables in the target Andreas Schwab
2023-03-29 12:19 ` Philippe Mathieu-Daudé [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f83cced2-06dd-3e56-43dc-f76ad10deb56@linaro.org \
--to=philmd@linaro.org \
--cc=laurent@vivier.eu \
--cc=qemu-devel@nongnu.org \
--cc=schwab@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).