Patchwork [2,of,2,STABLE] test-obsmarker-template: run mkcommit in subshell to isolate envvars

login
register
mail settings
Submitter Yuya Nishihara
Date July 28, 2018, 7:03 a.m.
Message ID <5b3b74e4b21442777f74.1532761436@mimosa>
Download mbox | patch
Permalink /patch/32959/
State Accepted
Headers show

Comments

Yuya Nishihara - July 28, 2018, 7:03 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1532760723 -32400
#      Sat Jul 28 15:52:03 2018 +0900
# Branch stable
# Node ID 5b3b74e4b21442777f741df60fd81e52e220a182
# Parent  2b7ce7b55514e248a3247f135f1938090ff19045
test-obsmarker-template: run mkcommit in subshell to isolate envvars

I don't know if it is a feature or a bug, but it appears that environment
variables passed to a shell function persist on /bin/sh.
Augie Fackler - July 30, 2018, 1:42 p.m.
> On Jul 28, 2018, at 03:03, Yuya Nishihara <yuya@tcha.org> wrote:
> 
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1532760723 -32400
> #      Sat Jul 28 15:52:03 2018 +0900
> # Branch stable
> # Node ID 5b3b74e4b21442777f741df60fd81e52e220a182
> # Parent  2b7ce7b55514e248a3247f135f1938090ff19045
> test-obsmarker-template: run mkcommit in subshell to isolate envvars
> 
> I don't know if it is a feature or a bug, but it appears that environment
> variables passed to a shell function persist on /bin/sh.

Wow. I spent a while trying to figure this failure on the BSD buildbot out and got stumped. Nice find!

Patch

diff --git a/tests/test-obsmarker-template.t b/tests/test-obsmarker-template.t
--- a/tests/test-obsmarker-template.t
+++ b/tests/test-obsmarker-template.t
@@ -2598,7 +2598,7 @@  Test metadata encoding (issue5754)
   >    f.write(b't\xe8st2') and None
   > EOF
   $ mkcommit ROOT
-  $ HGENCODING=latin-1 HGUSER="`cat test1`" mkcommit A0
+  $ ( HGENCODING=latin-1 HGUSER="`cat test1`" mkcommit A0 )
   $ echo 42 >> A0
   $ HGENCODING=latin-1 hg amend -m "A1" --note "`cat test2`"
   $ HGENCODING=latin-1 hg amend -m "A2" \
@@ -2611,31 +2611,31 @@  metadata should be stored in UTF-8, and 
 local encoding since the command is supposed to show unmodified content:
 
   $ HGENCODING=latin-1 hg debugobsolete
-  5f66a482f0bb2fcaccfc215554ad5eb9f40b50f5 718c0d00cee1429bdb73064e0d88908c601507a8 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '9', 'note': 't\xc3\xa8st2', 'operation': 'amend', 'user': 't\xc3\xa8st1'}
+  5f66a482f0bb2fcaccfc215554ad5eb9f40b50f5 718c0d00cee1429bdb73064e0d88908c601507a8 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '9', 'note': 't\xc3\xa8st2', 'operation': 'amend', 'user': 'test'}
   718c0d00cee1429bdb73064e0d88908c601507a8 1132562159b35bb27e1d6b80c80ee94a1659a4da 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 't\xc3\xa8st2'}
-  e1724525bc3bec4472d7915a02811b938004a7a2 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 't\xc3\xa8st2'}
+  8f82db6f991db367fdbb3b6dba5e187ecc3ebd96 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 't\xc3\xa8st2'}
 
 metadata should be converted back to local encoding when displaying:
 
   $ HGENCODING=latin-1 hg fatelog --hidden
-  @  e1724525bc3b
+  @  8f82db6f991d
   |    Obsfate: pruned by t\xe8st2 (at 1970-01-01 00:00 +0000); (esc)
   o  1132562159b3
   |
   | x  718c0d00cee1
   |/     Obsfate: rewritten using amend as 3:1132562159b3 by t\xe8st2 (at 1970-01-01 00:00 +0000); (esc)
   | x  5f66a482f0bb
-  |/     Obsfate: rewritten using amend as 2:718c0d00cee1 by t\xe8st1 (at 1970-01-01 00:00 +0000); (esc)
+  |/     Obsfate: rewritten using amend as 2:718c0d00cee1 by test (at 1970-01-01 00:00 +0000);
   o  ea207398892e
   
   $ HGENCODING=utf-8 hg fatelog --hidden
-  @  e1724525bc3b
+  @  8f82db6f991d
   |    Obsfate: pruned by t\xc3\xa8st2 (at 1970-01-01 00:00 +0000); (esc)
   o  1132562159b3
   |
   | x  718c0d00cee1
   |/     Obsfate: rewritten using amend as 3:1132562159b3 by t\xc3\xa8st2 (at 1970-01-01 00:00 +0000); (esc)
   | x  5f66a482f0bb
-  |/     Obsfate: rewritten using amend as 2:718c0d00cee1 by t\xc3\xa8st1 (at 1970-01-01 00:00 +0000); (esc)
+  |/     Obsfate: rewritten using amend as 2:718c0d00cee1 by test (at 1970-01-01 00:00 +0000);
   o  ea207398892e