On Mon, Oct 22, 2012 at 7:12 PM, Felipe Contreras
<felipe.contre...@gmail.com> wrote:
> On Mon, Oct 22, 2012 at 4:31 PM, Felipe Contreras

> I've tried everything, and yet a SIGPIPE is detected only with
> remote-testgit, not with my code, and they both exit the same way, and
> at the same time, and fast-export exits the main function (apparently
> a process can finish with SIGPIPE after main?)
>
> I have no idea what's going on, so I don't know if we need any extra
> code in transport-helper at all.
>
> Any ideas?

Must be a timing issue:

sh -c 'echo hello' | sh -c 'exit 1' -> no signal
sh -c 'echo hello' | /usr/bin/false -> SIGPIPE

I can trigger it by adding an extra delay:

This works:

test_expect_success 'proper failure checks for pushing 1' '
        export GIT_REMOTE_TESTGIT_FAILURE=1 &&
        (cd localclone && ! git push --all) 2> errors &&
        grep -q "Error while running fast-export" errors
'

This doesn't:

test_expect_success 'proper failure checks for pushing 2' '
        export GIT_REMOTE_TESTGIT_FAILURE=1 &&
        export GIT_REMOTE_TESTGIT_SLEEPY=1 &&
        (cd localclone && ! git push --all) 2> errors &&
        grep -q "Error while running fast-export" errors
'

This does:

test_expect_success 'proper failure checks for pushing 3' '
        export GIT_REMOTE_TESTGIT_FAILURE=1 &&
        export GIT_REMOTE_TESTGIT_SLEEPY=1 &&
        (cd localclone && ! git push --all) 2> errors &&
        grep -q "Told to fail" errors
'

So, depending on your luck, transport-helper might or might display an
error, it will exit at the right place nonetheless, because of:

        if (strbuf_getline(buffer, helper, '\n') == EOF) {
                if (debug)
                        fprintf(stderr, "Debug: Remote helper quit.\n");
                exit(128);
        }

Not ideal, but I guess it's not a big deal.

Cheers.

-- 
Felipe Contreras
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to