All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] linux-user, bsd-user: preserve incoming order of environment variables in the target
@ 2023-03-29 15:00 Andreas Schwab
  2023-03-29 16:08 ` Philippe Mathieu-Daudé
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Andreas Schwab @ 2023-03-29 15:00 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: Warner Losh, Kyle Evans, qemu-devel

Do not reverse the order of environment variables in the target environ
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>
---
 bsd-user/main.c   | 10 +++++++++-
 linux-user/main.c | 10 +++++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/bsd-user/main.c b/bsd-user/main.c
index 89f225dead..eff834e8d8 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -298,8 +298,16 @@ int main(int argc, char **argv)
 
     envlist = envlist_create();
 
-    /* add current environment into the list */
+    /*
+     * 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++) {
+        continue;
+    }
+    while (wrk != environ) {
+        wrk--;
         (void) envlist_setenv(envlist, *wrk);
     }
 
diff --git a/linux-user/main.c b/linux-user/main.c
index 4b18461969..f0173ceefa 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -690,8 +690,16 @@ int main(int argc, char **argv, char **envp)
 
     envlist = envlist_create();
 
-    /* add current environment into the list */
+    /*
+     * 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++) {
+        continue;
+    }
+    while (wrk != environ) {
+        wrk--;
         (void) envlist_setenv(envlist, *wrk);
     }
 
-- 
2.40.0


-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v3] linux-user, bsd-user: preserve incoming order of environment variables in the target
  2023-03-29 15:00 [PATCH v3] linux-user, bsd-user: preserve incoming order of environment variables in the target Andreas Schwab
@ 2023-03-29 16:08 ` Philippe Mathieu-Daudé
  2023-03-30  1:25 ` [PATCH v3] linux-user,bsd-user: " Warner Losh
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-03-29 16:08 UTC (permalink / raw)
  To: Andreas Schwab, Laurent Vivier; +Cc: Warner Losh, Kyle Evans, qemu-devel

On 29/3/23 17:00, Andreas Schwab wrote:
> Do not reverse the order of environment variables in the target environ
> 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>
> ---
>   bsd-user/main.c   | 10 +++++++++-
>   linux-user/main.c | 10 +++++++++-
>   2 files changed, 18 insertions(+), 2 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3] linux-user,bsd-user: preserve incoming order of environment variables in the target
  2023-03-29 15:00 [PATCH v3] linux-user, bsd-user: preserve incoming order of environment variables in the target Andreas Schwab
  2023-03-29 16:08 ` Philippe Mathieu-Daudé
@ 2023-03-30  1:25 ` Warner Losh
  2023-05-22 12:30 ` [PATCH v3] linux-user, bsd-user: " Andreas Schwab
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Warner Losh @ 2023-03-30  1:25 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Laurent Vivier, Kyle Evans, QEMU Developers

[-- Attachment #1: Type: text/plain, Size: 2038 bytes --]

On Wed, Mar 29, 2023, 9:00 AM Andreas Schwab <schwab@suse.de> wrote:

> Do not reverse the order of environment variables in the target environ
> 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>
> ---
>  bsd-user/main.c   | 10 +++++++++-
>  linux-user/main.c | 10 +++++++++-
>  2 files changed, 18 insertions(+), 2 deletions(-)
>

Reviewed-by: Warner Losh <imp@bsdimp.com>


> diff --git a/bsd-user/main.c b/bsd-user/main.c
> index 89f225dead..eff834e8d8 100644
> --- a/bsd-user/main.c
> +++ b/bsd-user/main.c
> @@ -298,8 +298,16 @@ int main(int argc, char **argv)
>
>      envlist = envlist_create();
>
> -    /* add current environment into the list */
> +    /*
> +     * 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++) {
> +        continue;
> +    }
> +    while (wrk != environ) {
> +        wrk--;
>          (void) envlist_setenv(envlist, *wrk);
>      }
>
> diff --git a/linux-user/main.c b/linux-user/main.c
> index 4b18461969..f0173ceefa 100644
> --- a/linux-user/main.c
> +++ b/linux-user/main.c
> @@ -690,8 +690,16 @@ int main(int argc, char **argv, char **envp)
>
>      envlist = envlist_create();
>
> -    /* add current environment into the list */
> +    /*
> +     * 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++) {
> +        continue;
> +    }
> +    while (wrk != environ) {
> +        wrk--;
>          (void) envlist_setenv(envlist, *wrk);
>      }
>
> --
> 2.40.0
>
>
> --
> Andreas Schwab, SUSE Labs, schwab@suse.de
> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
> "And now for something completely different."
>

[-- Attachment #2: Type: text/html, Size: 3032 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3] linux-user, bsd-user: preserve incoming order of environment variables in the target
  2023-03-29 15:00 [PATCH v3] linux-user, bsd-user: preserve incoming order of environment variables in the target Andreas Schwab
  2023-03-29 16:08 ` Philippe Mathieu-Daudé
  2023-03-30  1:25 ` [PATCH v3] linux-user,bsd-user: " Warner Losh
@ 2023-05-22 12:30 ` Andreas Schwab
  2023-06-12 11:29 ` Andreas Schwab
  2023-06-13  9:32 ` Philippe Mathieu-Daudé
  4 siblings, 0 replies; 6+ messages in thread
From: Andreas Schwab @ 2023-05-22 12:30 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: Warner Losh, Kyle Evans, qemu-devel

Ping?

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3] linux-user, bsd-user: preserve incoming order of environment variables in the target
  2023-03-29 15:00 [PATCH v3] linux-user, bsd-user: preserve incoming order of environment variables in the target Andreas Schwab
                   ` (2 preceding siblings ...)
  2023-05-22 12:30 ` [PATCH v3] linux-user, bsd-user: " Andreas Schwab
@ 2023-06-12 11:29 ` Andreas Schwab
  2023-06-13  9:32 ` Philippe Mathieu-Daudé
  4 siblings, 0 replies; 6+ messages in thread
From: Andreas Schwab @ 2023-06-12 11:29 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: Warner Losh, Kyle Evans, qemu-devel

Ping?

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3] linux-user, bsd-user: preserve incoming order of environment variables in the target
  2023-03-29 15:00 [PATCH v3] linux-user, bsd-user: preserve incoming order of environment variables in the target Andreas Schwab
                   ` (3 preceding siblings ...)
  2023-06-12 11:29 ` Andreas Schwab
@ 2023-06-13  9:32 ` Philippe Mathieu-Daudé
  4 siblings, 0 replies; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-06-13  9:32 UTC (permalink / raw)
  To: Andreas Schwab, Laurent Vivier; +Cc: Warner Losh, Kyle Evans, qemu-devel

On 29/3/23 17:00, Andreas Schwab wrote:
> Do not reverse the order of environment variables in the target environ
> 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>
> ---
>   bsd-user/main.c   | 10 +++++++++-
>   linux-user/main.c | 10 +++++++++-
>   2 files changed, 18 insertions(+), 2 deletions(-)

I'll take this patch in my next PR, thanks!


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-06-13  9:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-29 15:00 [PATCH v3] linux-user, bsd-user: preserve incoming order of environment variables in the target Andreas Schwab
2023-03-29 16:08 ` Philippe Mathieu-Daudé
2023-03-30  1:25 ` [PATCH v3] linux-user,bsd-user: " Warner Losh
2023-05-22 12:30 ` [PATCH v3] linux-user, bsd-user: " Andreas Schwab
2023-06-12 11:29 ` Andreas Schwab
2023-06-13  9:32 ` Philippe Mathieu-Daudé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.