All of lore.kernel.org
 help / color / mirror / Atom feed
* Weirdness with port-update hook and local push
@ 2005-12-05 20:36 Daniel Barkalow
  2005-12-05 20:40 ` Johannes Schindelin
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Barkalow @ 2005-12-05 20:36 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

I have the following post-update hook:

-----
#!/bin/sh

unset GIT_DIR
cd /home/barkalow/auto-working/web
if ! git pull /home/barkalow/git/web.git/
then
  exit 1  
fi
make
-----

>From that "git pull", I'm getting:

/home/barkalow/bin/git-pull: line 108: 30608 Broken pipe      git-merge $no_summary $no_commit $strategy_args "$merge_name" HEAD $merge_head

It works fine when pushing over ssh, and when I just run the hook 
directly. (It does a fast forward merge without any trouble.) Any ideas on 
what's confusing it?

	-Daniel
*This .sig left intentionally blank*

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Weirdness with port-update hook and local push
  2005-12-05 20:36 Weirdness with port-update hook and local push Daniel Barkalow
@ 2005-12-05 20:40 ` Johannes Schindelin
  2005-12-05 22:01   ` Daniel Barkalow
  0 siblings, 1 reply; 5+ messages in thread
From: Johannes Schindelin @ 2005-12-05 20:40 UTC (permalink / raw)
  To: Daniel Barkalow; +Cc: git, Junio C Hamano

Hi,

On Mon, 5 Dec 2005, Daniel Barkalow wrote:

> I have the following post-update hook:
> 
> -----
> #!/bin/sh
> 
> unset GIT_DIR
> cd /home/barkalow/auto-working/web
> if ! git pull /home/barkalow/git/web.git/
> then
>   exit 1  
> fi
> make
> -----
> 
> >From that "git pull", I'm getting:
> 
> /home/barkalow/bin/git-pull: line 108: 30608 Broken pipe      git-merge $no_summary $no_commit $strategy_args "$merge_name" HEAD $merge_head
> 
> It works fine when pushing over ssh,

Maybe it runs as a different user? (Sorry if this sounds dumb, but that's 
exactly the kind of solution I usually find after *days*.)

Hth,
Dscho

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Weirdness with port-update hook and local push
  2005-12-05 20:40 ` Johannes Schindelin
@ 2005-12-05 22:01   ` Daniel Barkalow
  2005-12-05 22:11     ` Junio C Hamano
       [not found]     ` <Pine.LNX.4.63.0512052318290.3406@wbgn013.biozentrum.uni-wuerzburg.de>
  0 siblings, 2 replies; 5+ messages in thread
From: Daniel Barkalow @ 2005-12-05 22:01 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git, Junio C Hamano

On Mon, 5 Dec 2005, Johannes Schindelin wrote:

> Hi,
> 
> On Mon, 5 Dec 2005, Daniel Barkalow wrote:
> 
> > I have the following post-update hook:
> > 
> > -----
> > #!/bin/sh
> > 
> > unset GIT_DIR
> > cd /home/barkalow/auto-working/web
> > if ! git pull /home/barkalow/git/web.git/
> > then
> >   exit 1  
> > fi
> > make
> > -----
> > 
> > >From that "git pull", I'm getting:
> > 
> > /home/barkalow/bin/git-pull: line 108: 30608 Broken pipe      git-merge $no_summary $no_commit $strategy_args "$merge_name" HEAD $merge_head
> > 
> > It works fine when pushing over ssh,
> 
> Maybe it runs as a different user? (Sorry if this sounds dumb, but that's 
> exactly the kind of solution I usually find after *days*.)

I think it's an environment thing of some sort, most likely, but it can't 
be the user; nothing's setuid and I'm only one user.

The thing that confuses me is that it works when run from ssh or directly, 
but not when run from a local push. I'd expect the two that work to be 
most different.

	-Daniel
*This .sig left intentionally blank*

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Weirdness with port-update hook and local push
  2005-12-05 22:01   ` Daniel Barkalow
@ 2005-12-05 22:11     ` Junio C Hamano
       [not found]     ` <Pine.LNX.4.63.0512052318290.3406@wbgn013.biozentrum.uni-wuerzburg.de>
  1 sibling, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2005-12-05 22:11 UTC (permalink / raw)
  To: git

Daniel Barkalow <barkalow@iabervon.org> writes:

> The thing that confuses me is that it works when run from ssh or directly, 
> but not when run from a local push. I'd expect the two that work to be 
> most different.

One suspicion and one suggestion (without knowing exactly where
that suggestion might lead us to).

 - your stdout/stderr might be connected to somewhere that your
   output gets stuck ("broken pipe"), when your script is run
   from the hook.

 - your environment might be different from what you are
   assuming.

How about doing something like this?

	  #!/bin/sh

	+ exec >/var/tmp/hook-out.$$ 2>/var/tmp/hook-err.$$
	+ echo "** env **"
	+ env
	+ echo "** vars **"
	+ i=0
	+ for v
	+ do
	+	 echo "$i: $v"
	+	 i=$(($i+1))
	+ done
	+ echo "** pwd etc **"
	+ pwd
	+ id -a

	  unset GIT_DIR
	  cd /home/barkalow/auto-working/web
	  if ! git pull /home/barkalow/git/web.git/

and then next replace the whole thing with:

	exec >/dev/null 2>&1

        

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Weirdness with port-update hook and local push
       [not found]     ` <Pine.LNX.4.63.0512052318290.3406@wbgn013.biozentrum.uni-wuerzburg.de>
@ 2005-12-06  1:12       ` Daniel Barkalow
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Barkalow @ 2005-12-06  1:12 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git, Junio C Hamano

On Mon, 5 Dec 2005, Johannes Schindelin wrote:

> Hi,
> 
> On Mon, 5 Dec 2005, Daniel Barkalow wrote:
> 
> > I think it's an environment thing of some sort, most likely, but it can't 
> > be the user; nothing's setuid and I'm only one user.
> 
> Can you insert "env > /tmp/env.$$.out", execute both without and with ssh, 
> and compare?

Actually, "ls -l /proc/$$/fd" shows that stdin and stdout are sockets with 
ssh, pipes with local, and ttys when just running the script. 

The hooks probably ought to be run with something different for 
stdin/stdout than the connection to the source of the data. /dev/null, 
maybe? Or a log file? Maybe dup stderr, which still seems to be going to 
the pusher's terminal?

	-Daniel
*This .sig left intentionally blank*

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-12-06  1:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-05 20:36 Weirdness with port-update hook and local push Daniel Barkalow
2005-12-05 20:40 ` Johannes Schindelin
2005-12-05 22:01   ` Daniel Barkalow
2005-12-05 22:11     ` Junio C Hamano
     [not found]     ` <Pine.LNX.4.63.0512052318290.3406@wbgn013.biozentrum.uni-wuerzburg.de>
2005-12-06  1:12       ` Daniel Barkalow

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.