{"thread":{"id":"4827","subject":"problems GIT_TRACE","startedAt":"2006-07-10T11:05:35Z","lastAt":"2006-07-11T00:11:28Z","messageCount":4,"participants":["Matthias Lederhofer","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"23535","messageId":"E1Fzta3-00066Z-8B@moooo.ath.cx","threadId":"4827","inReplyTo":null,"subject":"problems GIT_TRACE","fromName":"Matthias Lederhofer","fromEmail":"matled@gmx.net","sentAt":"2006-07-10T11:05:35Z","receivedAt":"2006-07-10T11:05:35Z","isPatch":false,"sender":{"key":"matled@gmx.net","avatar":null},"body":"I just discovered a problem with GIT_TRACE.  Some scripts redirect\nstderr to stdout and the trace messages go with it.  For example from\ngit-repack:\n> name=$(git-rev-list --objects --all $rev_list 2>&1 |\n>         git-pack-objects --non-empty $pack_objects .tmp-pack) ||\n>         exit 1\nThen for example git-pack-objects complains:\n> fatal: expected sha1, got garbage:\n>  trace: built-in: git 'rev-list' '--objects' '--all'\ngit-grep '2>&' shows a few other places that do this too, I'll take a\ncloser look at this later.  Is there any reason to redirect stderr to\nstdout?  I think this will always fail with such a strange error\nmessage when something is written to stderr.\n"},{"id":"23542","messageId":"7vwtalbqeo.fsf@assigned-by-dhcp.cox.net","threadId":"4827","inReplyTo":"E1Fzta3-00066Z-8B@moooo.ath.cx","subject":"Re: problems GIT_TRACE","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-07-10T12:22:39Z","receivedAt":"2006-07-10T12:22:39Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matthias Lederhofer <matled@gmx.net> writes:\n\n> I just discovered a problem with GIT_TRACE.  Some scripts redirect\n> stderr to stdout and the trace messages go with it.  For example from\n> git-repack:\n>> name=$(git-rev-list --objects --all $rev_list 2>&1 |\n>>         git-pack-objects --non-empty $pack_objects .tmp-pack) ||\n>>         exit 1\n> Then for example git-pack-objects complains:\n>> fatal: expected sha1, got garbage:\n>>  trace: built-in: git 'rev-list' '--objects' '--all'\n> git-grep '2>&' shows a few other places that do this too, I'll take a\n> closer look at this later.  Is there any reason to redirect stderr to\n> stdout?  I think this will always fail with such a strange error\n> message when something is written to stderr.\n\nThis particular one is trying to catch an error condition from\nrev-list.  Shell reports the exit status from the last command\nin the pipeline, and when rev-list notices a corrupt repository,\nit wants to tell pack-objects to stop producing incorrect pack,\nbut there is no way other than sending a garbage string (as an\nerror message) to cause pack-object to notice there is garbage\ncoming in.\n"},{"id":"23547","messageId":"E1FzvZG-0002C1-UN@moooo.ath.cx","threadId":"4827","inReplyTo":"7vwtalbqeo.fsf@assigned-by-dhcp.cox.net","subject":"[PATCH] fix git-repack for use with GIT_TRACE","fromName":"Matthias Lederhofer","fromEmail":"matled@gmx.net","sentAt":"2006-07-10T13:12:54Z","receivedAt":"2006-07-10T13:12:54Z","isPatch":true,"sender":{"key":"matled@gmx.net","avatar":null},"body":"---\nJunio C Hamano <junkio@cox.net> wrote:\n> This particular one is trying to catch an error condition from\n> rev-list.  Shell reports the exit status from the last command\n> in the pipeline, and when rev-list notices a corrupt repository,\n> it wants to tell pack-objects to stop producing incorrect pack,\n> but there is no way other than sending a garbage string (as an\n> error message) to cause pack-object to notice there is garbage\n> coming in.\n\nOk, this patch should fix this.  Instead of \"echo abort\" another more\nmeaningful message could be used.  I checked the other scripts which\nredirect stderr and they should be fine.  In the tests I found\nt/t1200-tutorial.sh:38 \nt/t1300-repo-config.sh:276\nt/t5500-fetch-pack.sh:66\nredirecting stderr, which probably fail which GIT_TRACE.\n\ngit-cvsserver.perl:2138 has 2>&1 but uses an regexp to match for the\ncontent, so the trace message should not make a problem.  Can someone\nusing git-cvsserver confirm this?  Perhaps this should be changed to\n2>/dev/null anyway.\n\n---\n\n git-repack.sh |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/git-repack.sh b/git-repack.sh\nindex 640ad8d..4dd7dad 100755\n--- a/git-repack.sh\n+++ b/git-repack.sh\n@@ -43,7 +43,7 @@ case \",$all_into_one,\" in\n \t;;\n esac\n pack_objects=\"$pack_objects $local $quiet $no_reuse_delta$extra\"\n-name=$(git-rev-list --objects --all $rev_list 2>&1 |\n+name=$( (git-rev-list --objects --all $rev_list || echo abort) |\n \tgit-pack-objects --non-empty $pack_objects .tmp-pack) ||\n \texit 1\n if [ -z \"$name\" ]; then\n-- \n1.4.1.gf157-dirty\n"},{"id":"23599","messageId":"7vy7v16lvz.fsf@assigned-by-dhcp.cox.net","threadId":"4827","inReplyTo":"E1FzvZG-0002C1-UN@moooo.ath.cx","subject":"Re: [PATCH] fix git-repack for use with GIT_TRACE","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-07-11T00:11:28Z","receivedAt":"2006-07-11T00:11:28Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matthias Lederhofer <matled@gmx.net> writes:\n\n> Ok, this patch should fix this.  Instead of \"echo abort\" another more\n> meaningful message could be used.\n\n\"git-rev-list died with exit code $?\" perhaps.\n\n> I checked the other scripts which\n> redirect stderr and they should be fine.  In the tests I found\n> t/t1200-tutorial.sh:38 \n> t/t1300-repo-config.sh:276\n> t/t5500-fetch-pack.sh:66\n> redirecting stderr, which probably fail which GIT_TRACE.\n\nProbably t/test-lib.sh should unset GIT_TRACE then like it does\nfor other environment variables.\n"}]}