linux-user: preserve incoming order of environment variables in the target
PATCH v2 1/1 linux-user: preserve incoming order of environment variables in the target
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.
--- linux-user/main.c | 6 ++++++ 1 file changed, 6 insertions(+)
linux-user/main.c +6 -0
@@ -691,7 +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++) { +continue ; + } +while (wrk != environ) { + wrk--; (void )envlist_setenv (envlist, *wrk); }
Signature · 7 lines
2.40.0 -- Andreas Schwab, SUSE Labs, [email protected] GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."
Quoted 8 lines · Andreas Schwab
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 <[email protected]>--- linux-user/main.c | 6 ++++++ 1 file changed, 6 insertions(+)
bsd-user/main.c appears to have an identical code pattern that will need the same fix
Quoted 28 lines
linux-user/main.c +6
-0@@ -691,7 +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++) { +continue ; + } +while (wrk != environ) { + wrk--; (void )envlist_setenv (envlist, *wrk); }Signature · 7 lines
2.40.0 -- Andreas Schwab, SUSE Labs, [email protected] GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Quoted 21 lines · Daniel P. Berrangé
Quoted 8 lines · Andreas Schwab
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 <[email protected]>--- linux-user/main.c | 6 ++++++ 1 file changed, 6 insertions(+)
bsd-user/main.cappears to have an identical code pattern that will need the same fixQuoted 8 lines
linux-user/main.c +0
-0@@ -691,7 +691,13 @@ int main(int argc, char **argv, char **envp) envlist =envlist_create ();
Quoted 3 lines
linux-user/main.c int main(int argc, char **argv, char **envp) · line 695
Quoted 3 lines
linux-user/main.c +2
-0/* add current environment into the list */ +/* envlist_setenv adds to the front of the list; to preserve environ +order add from back to front */
Also, QEMU coding style now requires:
/*
* this comment form.
*/
;)
Quoted 20 lines
Quoted 17 lines
linux-user/main.c +4
-0for (wrk = environ; *wrk !=NULL ; wrk++) { +continue ; + } +while (wrk != environ) { + wrk--; (void )envlist_setenv (envlist, *wrk); }Signature · 7 lines
2.40.0 -- Andreas Schwab, SUSE Labs, [email protected] GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."With regards,
Daniel
Quoted 26 lines · Philippe Mathieu-Daudé
Quoted 13 lines · Daniel P. Berrangé
Quoted 8 lines · Andreas Schwab
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 <[email protected]>--- linux-user/main.c | 6 ++++++ 1 file changed, 6 insertions(+)
bsd-user/main.cappears to have an identical code pattern that will need the same fixQuoted 1 line
Quoted 9 lines
linux-user/main.c int main(int argc, char **argv, char **envp) · line 694
Quoted 9 lines
linux-user/main.c +2
-0@@ -691,7 +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 */ Also, QEMU coding style now requires:
Quoted 3 lines
/*
* this comment form.
*/
It's unfortunate that the next comment just below doesn't follow the correct style, so I didn't notice.
Signature · 3 lines
Andreas Schwab, SUSE Labs, [email protected] GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."
Quoted 5 lines · Daniel P. Berrangé
Quoted 4 lines · Andreas Schwab
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.
Quoted 7 lines
Quoted 4 lines
Signed-off-by Andreas Schwab <[email protected]>--- linux-user/main.c | 6 ++++++ 1 file changed, 6 insertions(+)
bsd-user/main.cappears to have an identical code pattern that will need the same fix
Yes, but I cannot test it, so I like to let someone else produce the patch.
Signature · 3 lines
Andreas Schwab, SUSE Labs, [email protected] GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."
Quoted 12 lines · Andreas Schwab
Quoted 10 lines · Daniel P. Berrangé
Quoted 8 lines · Andreas Schwab
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 <[email protected]>--- linux-user/main.c | 6 ++++++ 1 file changed, 6 insertions(+)
Quoted 5 lines
Quoted 2 lines
bsd-user/main.cappears to have an identical code pattern that will need the same fixYes, but I cannot test it, so I like to let someone else produce the patch.
The code in this case is 100% identical, so I think it is reasonable to expect that patch to cover both of them regardless.
In terms of testing we don't require the contributors to test all platform combinations affected. Our FreeBSD CI jobs will test the build of bsd-user.
If so desired though, any contributor can easily test BSD changes too via our VM infra. eg "make vm-build-freebsd" (see make vm-help for further options)
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Quoted 6 lines · Daniel P. Berrangé
Quoted 2 lines · Andreas Schwab
Do not reverse the order of environment variables in the target environ array relative to the incoming environ order. Some testsuites depend on
a
Quoted 2 lines
specific order, even though it is not defined by any standard.
Quoted 8 lines
Quoted 4 lines
Signed-off-by Andreas Schwab <[email protected]>--- linux-user/main.c | 6 ++++++ 1 file changed, 6 insertions(+)
bsd-user/main.cappears to have an identical code pattern that will need the same fix
Agreed. I am finishing up a vacation but was going to check on this... I agree that bsd-user wants to do this too...
Warner
Quoted 41 lines
Quoted 23 lines
linux-user/main.c +6
-1@@ -691,7 +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++) { +continue ; + } +while (wrk != environ) { + wrk--; (void )envlist_setenv (envlist, *wrk); } --2.40.0
Quoted 5 lines
--
Andreas Schwab, SUSE Labs, [email protected]
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."With regards,
Daniel
--
|: https://berrange.com -o-
https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-
https://fstop138.berrange.com :|
|: https://entangle-photo.org -o-
https://www.instagram.com/dberrange :|