Arc land crashes with my git pre-commit hook


#1

I have a git pre-commit hook that runs some checks which need to pass before the commit is created. This includes arc lint as well as some other checks run through make.

I found the other day, coincidentally after an upgrade of arcanist from 733ac805 to b4a30268 (and libphutil from f3e1057 to 813a26a) that arc land stopped working and instead fails with an exception:

$ arc land
Landing current branch 'master'.
 TARGET  Landing onto "master", selected by following tracking branches upstream to the closest remote.
 REMOTE  Using remote "origin", selected by following tracking branches upstream to the closest remote.
You have untracked files in this working copy.

 ...

    Ignore these untracked files and continue? [y/N] y

 FETCH  Fetching origin/master...
This commit will be landed:

      - abcd123 blah blah blah

Landing revision 'D999: blah blah blah'...
 BUILDS PASSED  Harbormaster builds for the active diff completed successfully.
 Exception
Command failed with error #1!
COMMAND
git commit --author 'Danek Duvall <duvall@brightgate.com>' --date 'Fri, 1 Mar 2019 18:57:25 +0000' -F '/tmp/89y4terzl8w8gswo/1936-VwL8mm' --

STDOUT
(empty)

STDERR
 OKAY  No lint warnings.
<truncated make output>
(Run with `--trace` for a full exception trace.)

I don’t have a copy of the output where I ran with --trace handy; I will update when I collect another one.

I say that it’s coincident with the arcanist upgrade because when I checked out the original version and tried it again, I got the same problem. I really have run arc land numerous times since I installed the hook a few months ago, but I can’t explain why the older version no longer seems to work.

When I comment out core.hooksPath in my .gitconfig to disable the hook, arc land works as expected.

arc diff, even when rewriting commit comments into the arcanist format, doesn’t exhibit this problem.


#2

Please see Guide: Reporting a Bug, especially the part about reproduction steps.


#3

I did; I’m not sure which parts are missing. I’ll see if I can create a more self-contained example.


#4

The commit hook exit 1 will likely reproduce the behavior you describe. It does not look like arc is crashing; rather, it’s propagating an error code from git commit, which is likely failing because your commit hook is failing. This is expected. If your commit hook exits nonzero, that prevents the commit, and arc land can not continue (and should not: your hook told it to stop!).

The missing part is the content of your hook, but the problem is almost certainly in the implementation of your hook, not anything in arc. The output you’ve logged is the only reasonable behavior arc can have when git commit fails because of an error raised by a hook.


#5

That was my first thought, but git commit succeeded on the same workspace prior to the arc diff that created the thing I wanted. I know it’s not exactly the same, but I was reasonably certain it wasn’t due to the script failing. I’ll check again next time I’m about to land something; the simplified test case I was trying to put together didn’t exhibit the behavior, so it may be a few days.


#6

It just worked for me, so I’m going to go away now. :frowning:


closed #7