{"thread":{"id":"23538","subject":"weird fatal on push when post-receive hook exists but is empty","startedAt":"2010-04-20T16:21:22Z","lastAt":"2010-04-21T09:28:18Z","messageCount":3,"participants":["Sitaram Chamarty","Michael J Gruber","Johannes Sixt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"139986","messageId":"g2x2e24e5b91004200921mc5b0ffoc1c1ec2af25f71c@mail.gmail.com","threadId":"23538","inReplyTo":null,"subject":"weird fatal on push when post-receive hook exists but is empty","fromName":"Sitaram Chamarty","fromEmail":"sitaramc@gmail.com","sentAt":"2010-04-20T16:21:22Z","receivedAt":"2010-04-20T16:21:22Z","isPatch":false,"sender":{"key":"sitaramc@gmail.com","avatar":"https://avatars.githubusercontent.com/u/43316?v=4"},"body":"Helping someone with what at first appeared to be a gitolite problem,\nwe found something curious.  Here it is, reduced to pure git, even\nwithout ssh and other complications in between:\n\n    21:47:05 sita-lt:t $ rm -rf a b c\n    21:47:10 sita-lt:t $ git init --bare b\n    Initialized empty Git repository in /home/sitaram/t/b/\n    21:47:23 sita-lt:t $ git clone b a\n    Initialized empty Git repository in /home/sitaram/t/a/.git/\n    warning: You appear to have cloned an empty repository.\n    21:47:29 sita-lt:t $ cat > b/hooks/post-receive\n    #!/bin/bash\n    # dummy\n    21:47:55 sita-lt:t $ chmod +x b/hooks/post-receive\n    21:48:00 sita-lt:t $ cd a\n    21:48:02 sita-lt:a (master) $ date > foo;git add foo; git commit\n-m foo; git push origin master\n    [master (root-commit) f55bd25] foo\n     1 files changed, 1 insertions(+), 0 deletions(-)\n     create mode 100644 foo\n    Counting objects: 3, done.\n    Writing objects: 100% (3/3), 232 bytes, done.\n    Total 3 (delta 0), reused 0 (delta 0)\n    Unpacking objects: 100% (3/3), done.\n    fatal: The remote end hung up unexpectedly\n    error: error in sideband demultiplexer\n    error: .git/objects/f5/5bd251325ad1647a29869e75a8080fee1a5d97 died\nof signal 13\n    To /home/sitaram/t/b\n     * [new branch]      master -> master\n    error: failed to push some refs to '/home/sitaram/t/b'\n    (rc=1)21:48:23 sita-lt:a $\n\nOf course, this does not happen when the hook doesn't even exist...\n\n-- \nSitaram\n"},{"id":"140018","messageId":"4BCEBB50.7020003@drmicha.warpmail.net","threadId":"23538","inReplyTo":"g2x2e24e5b91004200921mc5b0ffoc1c1ec2af25f71c@mail.gmail.com","subject":"Re: weird fatal on push when post-receive hook exists but is empty","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2010-04-21T08:46:08Z","receivedAt":"2010-04-21T08:46:08Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Sitaram Chamarty venit, vidit, dixit 20.04.2010 18:21:\n> 21:47:05 sita-lt:t $ rm -rf a b c\n>     21:47:10 sita-lt:t $ git init --bare b\n>     Initialized empty Git repository in /home/sitaram/t/b/\n>     21:47:23 sita-lt:t $ git clone b a\n>     Initialized empty Git repository in /home/sitaram/t/a/.git/\n>     warning: You appear to have cloned an empty repository.\n>     21:47:29 sita-lt:t $ cat > b/hooks/post-receive\n>     #!/bin/bash\n>     # dummy\n>     21:47:55 sita-lt:t $ chmod +x b/hooks/post-receive\n>     21:48:00 sita-lt:t $ cd a\n>     21:48:02 sita-lt:a (master) $ date > foo;git add foo; git commit\n> -m foo; git push origin master\n>     [master (root-commit) f55bd25] foo\n>      1 files changed, 1 insertions(+), 0 deletions(-)\n>      create mode 100644 foo\n>     Counting objects: 3, done.\n>     Writing objects: 100% (3/3), 232 bytes, done.\n>     Total 3 (delta 0), reused 0 (delta 0)\n>     Unpacking objects: 100% (3/3), done.\n>     fatal: The remote end hung up unexpectedly\n>     error: error in sideband demultiplexer\n>     error: .git/objects/f5/5bd251325ad1647a29869e75a8080fee1a5d97 died\n> of signal 13\n>     To /home/sitaram/t/b\n>      * [new branch]      master -> master\n>     error: failed to push some refs to '/home/sitaram/t/b'\n>     (rc=1)21:48:23 sita-lt:a $\n\nWith git version 1.7.1.rc1.248.gcefbb and this script:\n\n#!/bin/bash\nrm -rf a b c\ngit init --bare b\ngit clone b a\ncat > b/hooks/post-receive <<EOF\n#!/bin/bash\n# dummy\nEOF\nchmod +x b/hooks/post-receive\ncd a\ndate > foo;git add foo; git commit -m foo; git push origin master\n\nI get this output:\nInitialized empty Git repository in /tmp/t/b/\nInitialized empty Git repository in /tmp/t/a/.git/\nwarning: You appear to have cloned an empty repository.\n[master (root-commit) 020a1fb] foo\n 1 files changed, 1 insertions(+), 0 deletions(-)\n create mode 100644 foo\nCounting objects: 3, done.\nWriting objects: 100% (3/3), 241 bytes, done.\nTotal 3 (delta 0), reused 0 (delta 0)\nUnpacking objects: 100% (3/3), done.\nTo /tmp/t/b\n * [new branch]      master -> master\n\nWhat are we doing differently?\n\nMichael\n"},{"id":"140023","messageId":"4BCEC532.5040807@viscovery.net","threadId":"23538","inReplyTo":"4BCEBB50.7020003@drmicha.warpmail.net","subject":"Re: weird fatal on push when post-receive hook exists but is empty","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2010-04-21T09:28:18Z","receivedAt":"2010-04-21T09:28:18Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 4/21/2010 10:46, schrieb Michael J Gruber:\n> What are we doing differently?\n\nYour box has a different scheduler. I doesn't run (or exit) the script\nsoon enough that the parent (receive-pack) can get SIGPIPE when it writes\nrefs to the script's stdin.\n\n-- Hannes\n"}]}