{"thread":{"id":"2750","subject":"Weirdness with port-update hook and local push","startedAt":"2005-12-05T20:36:18Z","lastAt":"2005-12-06T01:12:16Z","messageCount":5,"participants":["Daniel Barkalow","Johannes Schindelin","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"13216","messageId":"Pine.LNX.4.64.0512051530560.25300@iabervon.org","threadId":"2750","inReplyTo":null,"subject":"Weirdness with port-update hook and local push","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2005-12-05T20:36:18Z","receivedAt":"2005-12-05T20:36:18Z","isPatch":false,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"I have the following post-update hook:\n\n-----\n#!/bin/sh\n\nunset GIT_DIR\ncd /home/barkalow/auto-working/web\nif ! git pull /home/barkalow/git/web.git/\nthen\n  exit 1  \nfi\nmake\n-----\n\n>From that \"git pull\", I'm getting:\n\n/home/barkalow/bin/git-pull: line 108: 30608 Broken pipe      git-merge $no_summary $no_commit $strategy_args \"$merge_name\" HEAD $merge_head\n\nIt works fine when pushing over ssh, and when I just run the hook \ndirectly. (It does a fast forward merge without any trouble.) Any ideas on \nwhat's confusing it?\n\n\t-Daniel\n*This .sig left intentionally blank*\n"},{"id":"13217","messageId":"Pine.LNX.4.63.0512052138560.6554@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"2750","inReplyTo":"Pine.LNX.4.64.0512051530560.25300@iabervon.org","subject":"Re: Weirdness with port-update hook and local push","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-12-05T20:40:11Z","receivedAt":"2005-12-05T20:40:11Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 5 Dec 2005, Daniel Barkalow wrote:\n\n> I have the following post-update hook:\n> \n> -----\n> #!/bin/sh\n> \n> unset GIT_DIR\n> cd /home/barkalow/auto-working/web\n> if ! git pull /home/barkalow/git/web.git/\n> then\n>   exit 1  \n> fi\n> make\n> -----\n> \n> >From that \"git pull\", I'm getting:\n> \n> /home/barkalow/bin/git-pull: line 108: 30608 Broken pipe      git-merge $no_summary $no_commit $strategy_args \"$merge_name\" HEAD $merge_head\n> \n> It works fine when pushing over ssh,\n\nMaybe it runs as a different user? (Sorry if this sounds dumb, but that's \nexactly the kind of solution I usually find after *days*.)\n\nHth,\nDscho\n"},{"id":"13229","messageId":"Pine.LNX.4.64.0512051651050.25300@iabervon.org","threadId":"2750","inReplyTo":"Pine.LNX.4.63.0512052138560.6554@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: Weirdness with port-update hook and local push","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2005-12-05T22:01:04Z","receivedAt":"2005-12-05T22:01:04Z","isPatch":false,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"On Mon, 5 Dec 2005, Johannes Schindelin wrote:\n\n> Hi,\n> \n> On Mon, 5 Dec 2005, Daniel Barkalow wrote:\n> \n> > I have the following post-update hook:\n> > \n> > -----\n> > #!/bin/sh\n> > \n> > unset GIT_DIR\n> > cd /home/barkalow/auto-working/web\n> > if ! git pull /home/barkalow/git/web.git/\n> > then\n> >   exit 1  \n> > fi\n> > make\n> > -----\n> > \n> > >From that \"git pull\", I'm getting:\n> > \n> > /home/barkalow/bin/git-pull: line 108: 30608 Broken pipe      git-merge $no_summary $no_commit $strategy_args \"$merge_name\" HEAD $merge_head\n> > \n> > It works fine when pushing over ssh,\n> \n> Maybe it runs as a different user? (Sorry if this sounds dumb, but that's \n> exactly the kind of solution I usually find after *days*.)\n\nI think it's an environment thing of some sort, most likely, but it can't \nbe the user; nothing's setuid and I'm only one user.\n\nThe thing that confuses me is that it works when run from ssh or directly, \nbut not when run from a local push. I'd expect the two that work to be \nmost different.\n\n\t-Daniel\n*This .sig left intentionally blank*\n"},{"id":"13230","messageId":"7vk6ej9otl.fsf@assigned-by-dhcp.cox.net","threadId":"2750","inReplyTo":"Pine.LNX.4.64.0512051651050.25300@iabervon.org","subject":"Re: Weirdness with port-update hook and local push","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-12-05T22:11:34Z","receivedAt":"2005-12-05T22:11:34Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Daniel Barkalow <barkalow@iabervon.org> writes:\n\n> The thing that confuses me is that it works when run from ssh or directly, \n> but not when run from a local push. I'd expect the two that work to be \n> most different.\n\nOne suspicion and one suggestion (without knowing exactly where\nthat suggestion might lead us to).\n\n - your stdout/stderr might be connected to somewhere that your\n   output gets stuck (\"broken pipe\"), when your script is run\n   from the hook.\n\n - your environment might be different from what you are\n   assuming.\n\nHow about doing something like this?\n\n\t  #!/bin/sh\n\n\t+ exec >/var/tmp/hook-out.$$ 2>/var/tmp/hook-err.$$\n\t+ echo \"** env **\"\n\t+ env\n\t+ echo \"** vars **\"\n\t+ i=0\n\t+ for v\n\t+ do\n\t+\t echo \"$i: $v\"\n\t+\t i=$(($i+1))\n\t+ done\n\t+ echo \"** pwd etc **\"\n\t+ pwd\n\t+ id -a\n\n\t  unset GIT_DIR\n\t  cd /home/barkalow/auto-working/web\n\t  if ! git pull /home/barkalow/git/web.git/\n\nand then next replace the whole thing with:\n\n\texec >/dev/null 2>&1\n\n        \n"},{"id":"13235","messageId":"Pine.LNX.4.64.0512051945330.25300@iabervon.org","threadId":"2750","inReplyTo":"Pine.LNX.4.63.0512052318290.3406@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: Weirdness with port-update hook and local push","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2005-12-06T01:12:16Z","receivedAt":"2005-12-06T01:12:16Z","isPatch":false,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"On Mon, 5 Dec 2005, Johannes Schindelin wrote:\n\n> Hi,\n> \n> On Mon, 5 Dec 2005, Daniel Barkalow wrote:\n> \n> > I think it's an environment thing of some sort, most likely, but it can't \n> > be the user; nothing's setuid and I'm only one user.\n> \n> Can you insert \"env > /tmp/env.$$.out\", execute both without and with ssh, \n> and compare?\n\nActually, \"ls -l /proc/$$/fd\" shows that stdin and stdout are sockets with \nssh, pipes with local, and ttys when just running the script. \n\nThe hooks probably ought to be run with something different for \nstdin/stdout than the connection to the source of the data. /dev/null, \nmaybe? Or a log file? Maybe dup stderr, which still seems to be going to \nthe pusher's terminal?\n\n\t-Daniel\n*This .sig left intentionally blank*\n"}]}