{"thread":{"id":"26252","subject":"[PATCH] Fix wrong failures in config test","startedAt":"2011-01-10T16:13:21Z","lastAt":"2011-01-10T21:59:33Z","messageCount":11,"participants":["Ingo Br ückl","Jonathan Nieder","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"159271","messageId":"4d2b3198.674034bb.bm000@wupperonline.de","threadId":"26252","inReplyTo":null,"subject":"[PATCH] Fix wrong failures in config test","fromName":"Ingo Br ückl","fromEmail":"ib@wupperonline.de","sentAt":"2011-01-10T16:13:21Z","receivedAt":"2011-01-10T16:13:21Z","isPatch":true,"sender":{"key":"ib@wupperonline.de","avatar":"https://avatars.githubusercontent.com/u/123327?v=4"},"body":"The tests after '--set in alternative GIT_CONFIG' failed because\nvariable GIT_CONFIG was still set.\n\nSigned-off-by: Ingo Brückl <ib@wupperonline.de>\n---\n\nIs it only me (bash 3.2.48(1)-release) experiencing these failures?\n\n t/t1300-repo-config.sh |    2 ++\n 1 files changed, 2 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh\nindex d0e5546..d1c9a8f 100755\n--- a/t/t1300-repo-config.sh\n+++ b/t/t1300-repo-config.sh\n@@ -428,6 +428,8 @@ EOF\n\n test_expect_success '--set in alternative GIT_CONFIG' 'cmp other-config expect'\n\n+unset GIT_CONFIG\n+\n cat > .git/config << EOF\n # Hallo\n \t#Bello\n--\n1.7.3.5\n"},{"id":"159273","messageId":"20110110165251.GB7714@burratino","threadId":"26252","inReplyTo":"4d2b3198.674034bb.bm000@wupperonline.de","subject":"Re: [PATCH] Fix wrong failures in config test","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-01-10T16:52:51Z","receivedAt":"2011-01-10T16:52:51Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Ingo Brückl wrote:\n\n> The tests after '--set in alternative GIT_CONFIG' failed because\n> variable GIT_CONFIG was still set.\n[...]\n> Is it only me (bash 3.2.48(1)-release) experiencing these failures?\n\nCould you explain the nature of the failures in more detail?  What\nversion of git are you building?  Is GIT_CONFIG already set in the\nenvironment before you run t1300-repo-config.sh (it shouldn't matter)?\nHow does output from \"sh t1300-repo-config.sh -v -i\" end?  If that\ndoesn't end up being helpful, how about \"GIT_TRACE=1 sh -x\nt1300-repo-config.sh -v -i\"?\n\nRegards,\nJonathan\n"},{"id":"159277","messageId":"4d2b3ecd.7c62abb5.bm000@wupperonline.de","threadId":"26252","inReplyTo":"20110110165251.GB7714@burratino","subject":"Re: [PATCH] Fix wrong failures in config test","fromName":"Ingo Br ückl","fromEmail":"ib@wupperonline.de","sentAt":"2011-01-10T17:15:22Z","receivedAt":"2011-01-10T17:15:22Z","isPatch":true,"sender":{"key":"ib@wupperonline.de","avatar":"https://avatars.githubusercontent.com/u/123327?v=4"},"body":"Jonathan Nieder wrote on Mon, 10 Jan 2011 10:52:51 -0600:\n\n> Could you explain the nature of the failures in more detail?\n\nYeah, sorry.\n\n> What version of git are you building?\n\n1.7.3.5\n\n> Is GIT_CONFIG already set in the environment before you run\n> t1300-repo-config.sh (it shouldn't matter)?\n\nNo.\n\n> How does output from \"sh t1300-repo-config.sh -v -i\" end?\n\n  expecting success: git config --rename-section branch.eins branch.zwei\n  fatal: No such section!\n  not ok - 50 rename section\n  #       git config --rename-section branch.eins branch.zwei\n\nThe problem is that the last 'git config' worked on other-config due to\nvariable GIT_CONFIG. Test 50 should work now on .git/config, but as\nGIT_CONFIG is still set, it doesn't and fails.\n\nIngo\n"},{"id":"159279","messageId":"20110110172931.GB7882@burratino","threadId":"26252","inReplyTo":"4d2b3ecd.7c62abb5.bm000@wupperonline.de","subject":"Re: [PATCH] Fix wrong failures in config test","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-01-10T17:29:31Z","receivedAt":"2011-01-10T17:29:31Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Ingo Brückl wrote:\n> Jonathan Nieder wrote on Mon, 10 Jan 2011 10:52:51 -0600:\n\n>> How does output from \"sh t1300-repo-config.sh -v -i\" end?\n>\n>   expecting success: git config --rename-section branch.eins branch.zwei\n>   fatal: No such section!\n>   not ok - 50 rename section\n>   #       git config --rename-section branch.eins branch.zwei\n\nThanks.\n\n> The problem is that the last 'git config' worked on other-config due to\n> variable GIT_CONFIG.\n\nI'm still missing something.\n\n\tGIT_CONFIG=other-config git config -l > output\n\techo $GIT_CONFIG\n\nshould result in no output to stdout, right?  In other words, the\nconstruct\n\n\tenvvar=value git command\n\nis not supposed to pollute the current environment.\n\nIt sounds like you've checked that \"unset GIT_CONFIG\" fixes it; what's\nleft is to explain why GIT_CONFIG had a value in the first place.\n\nConfused,\nJonathan\n"},{"id":"159283","messageId":"7vhbdg6286.fsf@alter.siamese.dyndns.org","threadId":"26252","inReplyTo":"4d2b3198.674034bb.bm000@wupperonline.de","subject":"Re: [PATCH] Fix wrong failures in config test","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-01-10T18:30:17Z","receivedAt":"2011-01-10T18:30:17Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ingo Brückl <ib@wupperonline.de> writes:\n\n> The tests after '--set in alternative GIT_CONFIG' failed because\n> variable GIT_CONFIG was still set.\n>\n> Signed-off-by: Ingo Brückl <ib@wupperonline.de>\n> ---\n>\n> Is it only me (bash 3.2.48(1)-release) experiencing these failures?\n\n>\n>  t/t1300-repo-config.sh |    2 ++\n>  1 files changed, 2 insertions(+), 0 deletions(-)\n\nt1300 first sources test-lib.sh that explicitly unsets GIT_CONFIG and the\ntests that might touch GIT_CONFIG all do so by a single-shot assignment to\nbe exported, i.e.\n\n\tGIT_CONFIG=other-config git config anwohner.park ausweis\n\nthat shouldn't affect the later test, unless the shell is broken.\n\nWith this patch, can you check which one of the new tests barf on you?\n\n t/t1300-repo-config.sh |   21 +++++++++++++++++++++\n 1 files changed, 21 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh\nindex d0e5546..c91d166 100755\n--- a/t/t1300-repo-config.sh\n+++ b/t/t1300-repo-config.sh\n@@ -7,6 +7,10 @@ test_description='Test git config in different settings'\n \n . ./test-lib.sh\n \n+test_expect_success 'is GIT_CONFIG set (0)?' '\n+\ttest \"z${GIT_CONFIG+set}\" = z\n+'\n+\n test -f .git/config && rm .git/config\n \n git config core.penguin \"little blue\"\n@@ -399,8 +403,17 @@ cat > expect << EOF\n ein.bahn=strasse\n EOF\n \n+\n+test_expect_success 'is GIT_CONFIG set (1)?' '\n+\ttest \"z${GIT_CONFIG+set}\" = z\n+'\n+\n GIT_CONFIG=other-config git config -l > output\n \n+test_expect_success 'is GIT_CONFIG set (2)?' '\n+\ttest \"z${GIT_CONFIG+set}\" = z\n+'\n+\n test_expect_success 'alternative GIT_CONFIG' 'cmp output expect'\n \n test_expect_success 'alternative GIT_CONFIG (--file)' \\\n@@ -419,6 +432,10 @@ test_expect_success 'refer config from subdirectory' '\n \n GIT_CONFIG=other-config git config anwohner.park ausweis\n \n+test_expect_success 'is GIT_CONFIG set (3)?' '\n+\ttest \"z${GIT_CONFIG+set}\" = z\n+'\n+\n cat > expect << EOF\n [ein]\n \tbahn = strasse\n@@ -426,6 +443,10 @@ cat > expect << EOF\n \tpark = ausweis\n EOF\n \n+test_expect_success 'is GIT_CONFIG set (4)?' '\n+\ttest \"z${GIT_CONFIG+set}\" = z\n+'\n+\n test_expect_success '--set in alternative GIT_CONFIG' 'cmp other-config expect'\n \n cat > .git/config << EOF\n"},{"id":"159284","messageId":"4d2b5c52.68e3cdc2.bm000@wupperonline.de","threadId":"26252","inReplyTo":"7vhbdg6286.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] Fix wrong failures in config test","fromName":"Ingo Br ückl","fromEmail":"ib@wupperonline.de","sentAt":"2011-01-10T19:21:49Z","receivedAt":"2011-01-10T19:21:49Z","isPatch":true,"sender":{"key":"ib@wupperonline.de","avatar":"https://avatars.githubusercontent.com/u/123327?v=4"},"body":"I wrote:\n\n> Is it only me [...] experiencing these failures?\n\nAnd the answer is yes. Sorry.\n\nAs Jonathan and Junio stated,\n\n>  envvar=value git command\n\n>  GIT_CONFIG=other-config git config anwohner.park ausweis\n\nshouldn't affect the environment of the tests.\n\nUnfortunately, I had a shell alias function named git that interfered. In\nfact it passes to the git program (command git \"$@\") but sadly does not know\nabout the newly set PATH and (still inexplicably to me) makes the variable\nset.\n\nSo it's all my problem.\n\nIngo\n"},{"id":"159285","messageId":"20110110194242.GA11801@burratino","threadId":"26252","inReplyTo":"4d2b5c52.68e3cdc2.bm000@wupperonline.de","subject":"Re: [PATCH] Fix wrong failures in config test","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-01-10T19:42:42Z","receivedAt":"2011-01-10T19:42:42Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Ingo Brückl wrote:\n> As Jonathan and Junio stated,\n\n>>  envvar=value git command\n>\n>>  GIT_CONFIG=other-config git config anwohner.park ausweis\n>\n> shouldn't affect the environment of the tests.\n>\n> Unfortunately, I had a shell alias function named git that interfered. In\n> fact it passes to the git program (command git \"$@\") but sadly does not know\n> about the newly set PATH and (still inexplicably to me) makes the variable\n> set.\n\nFor what it's worth, here's what POSIX[1] has to say:\n\n\tWhen a given simple command is required to be executed [...] the\n\tfollowing expansions, assignments, and redirections shall all be\n\tperformed from the beginning of the command text to the end:\n[...]\n\tIf no command name results, variable assignments shall affect\n\tthe current execution environment. Otherwise, the variable\n\tassignments shall be exported for the execution environment of\n\tthe command and shall not affect the current execution\n\tenvironment (except for special built-ins). \n\nI am guessing the expansion of your 'git' alias starts with a special\nbuiltin.  For the future, it is probably best to guard settings for\ninteractive use with\n\n\tif test \"${PS1+set}\"\n\tthen\n\t\tCDPATH=something\n\t\talias foo=bar\n\t\talias baz=qux\n\t\t...\n\tfi\n\nor even better,\n\n\tcase $- in\n\t*i*)\n\t\tCDPATH=something\n\t\t...\n\tesac\n\nThanks for explaining.\nJonathan\n\n[1] http://unix.org/2008edition/\n"},{"id":"159286","messageId":"7v62tw5twb.fsf@alter.siamese.dyndns.org","threadId":"26252","inReplyTo":"20110110194242.GA11801@burratino","subject":"Re: [PATCH] Fix wrong failures in config test","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-01-10T21:30:12Z","receivedAt":"2011-01-10T21:30:12Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n>> Unfortunately, I had a shell alias function named git that interfered. In\n>> fact it passes to the git program (command git \"$@\") but sadly does not know\n>> about the newly set PATH and (still inexplicably to me) makes the variable\n>> set.\n\nYuck.  I really do not want to do something like this X-<.\n\n t/test-lib.sh |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex cb1ca97..df1b4f2 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -77,10 +77,10 @@ export GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME\n export EDITOR\n \n # Protect ourselves from common misconfiguration to export\n-# CDPATH into the environment\n+# CDPATH into the environment and such\n unset CDPATH\n-\n unset GREP_OPTIONS\n+unalias git >/dev/null 2>&1 || :\n \n case $(echo $GIT_TRACE |tr \"[A-Z]\" \"[a-z]\") in\n \t1|2|true)\n"},{"id":"159287","messageId":"20110110213308.GA12030@burratino","threadId":"26252","inReplyTo":"7v62tw5twb.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] Fix wrong failures in config test","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-01-10T21:33:08Z","receivedAt":"2011-01-10T21:33:08Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Junio C Hamano wrote:\n> Jonathan Nieder <jrnieder@gmail.com> writes:\n\n>>> Unfortunately, I had a shell alias function named git that interfered. In\n>>> fact it passes to the git program (command git \"$@\") but sadly does not know\n>>> about the newly set PATH and (still inexplicably to me) makes the variable\n>>> set.\n>\n> Yuck.  I really do not want to do something like this X-<.\n\nPlease don't. :)\n"},{"id":"159291","messageId":"4d2b7f25.10be45ba.bm000@wupperonline.de","threadId":"26252","inReplyTo":"7v62tw5twb.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] Fix wrong failures in config test","fromName":"Ingo Br ückl","fromEmail":"ib@wupperonline.de","sentAt":"2011-01-10T21:50:10Z","receivedAt":"2011-01-10T21:50:10Z","isPatch":true,"sender":{"key":"ib@wupperonline.de","avatar":"https://avatars.githubusercontent.com/u/123327?v=4"},"body":"Junio C Hamano wrote:\n\n> Yuck.  I really do not want to do something like this X-<.\n\nAnd you shouldn't. :-)\n\nIt's my personal problem (now that I know) to unset the alias.\n\nIngo\n"},{"id":"159292","messageId":"20110110215933.GB12030@burratino","threadId":"26252","inReplyTo":"4d2b7b68.47102a21.bm000@wupperonline.de","subject":"Re: [PATCH] Fix wrong failures in config test","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-01-10T21:59:33Z","receivedAt":"2011-01-10T21:59:33Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Ingo Brückl wrote:\n\n> It's a function (available in login shells and thus during the test suite):\n\nThe test suite doesn't run in a login shell.  As I hinted before, you can\nput\n\n\tcase \"$-\" in\n\t*i*)\t# interactive shell\n\t\t;;\n\t*)\n\t\treturn 0\n\tesac\n\nin your .bashrc before the function definition and all should be well.\n\n> From what I've learned from you now, if 'git' is an exported bash function,\n> 'VAR=val git' will always automatically result in VAR being exported\n\nI didn't understand at first why this particular vintage of bash makes\nVAR leak into the current environment.  I tried to reproduce it with\nDebian bash 3.2-4 (which is based on bash 3.2.39(1)-release) with no\nsuccess.\n\nIn any event git avoids\n\n\tVAR=val fn\n\nwhen fn is a function for this and possibly other reasons (see [1]).\n\nI do not think git ought to guard against a git function (or alias) in\nthe user's environment, even though doing so might lead to a better\nuser experience and less confusion on the mailing list.  git does not\nprotect against 'rm' being an alias to 'rm -i' or 'svn' being an\nalias, either.\n\nRegards,\nJonathan\n\n[1] http://thread.gmane.org/gmane.comp.version-control.git/135766/focus=137095\n"}]}