Strange git notes completion behaviour
Hi All,
I tried the following in git 2.51.0 on NonStop (big endian x86):
git notes add -m "Test Note" HEAD
git notes show HEAD
The git notes show reports a completion code of 037777777764 (-12). This gets
hidden by bash, which truncates negative results so it shows as 0, not -12. This
only seems to happen in git notes show, not any other commands or sub-commands. I checked in gdb and this is in fact happening. Anywhere I can look to try to find where this is failing?
--Randall
Quoted 16 lines · On Tue, Oct 21, 2025 at 5:07 PM <[email protected]> wrote:
Hi All,
I tried the following in git 2.51.0 on NonStop (big endian x86):
git notes add -m "Test Note" HEAD
git notes show HEADThe git notes show reports a completion code of 037777777764 (-12). This gets
hidden by bash, which truncates negative results so it shows as 0, not -12. This
only seems to happen in git notes show, not any other commands or sub-commands. I checked in gdb and this is in fact happening. Anywhere I can look to try to find where this is failing?
Quoted 1 line
--Randall
Exit code or shell (tab) completion? I'm a bit confused, so maybe someone else is, too.
Signature · 1 line
D. Ben Knoble
Quoted 17 lines · D. Ben Knoble
Quoted 16 lines · On Tue, Oct 21, 2025 at 5:07 PM <[email protected]> wrote:
Hi All,
I tried the following in git 2.51.0 on NonStop (big endian x86):
git notes add -m "Test Note" HEAD
git notes show HEADThe git notes show reports a completion code of 037777777764 (-12). This gets hidden by bash, which truncates negative results so it shows as 0, not -12.
This
only seems to happen in git notes show, not any other commands or sub-commands. I checked in gdb and this is in fact happening. Anywhere I can look to try to find where this is failing?
Quoted 4 lines
Quoted 1 line
--Randall
Exit code or shell (tab) completion? I'm a bit confused, so maybe someone else is, too.
It is the exit code. When in gdb, the return from notes is -12 as above. By the time It gets back to bash, the lower bytes are dropped so I end up with a 0xFF, which bash thinks is a 0, so the exit code is hidden from view. I tried the !!fn construct in a standard alone test program with no wisdom gained.
Quoted 4 lines · On Tue, Oct 21, 2025 at 05:52:38PM -0400, [email protected] wrote:
It is the exit code. When in gdb, the return from notes is -12 as above. By the time It gets back to bash, the lower bytes are dropped so I end up with a
0xFF, which bash thinks is a 0, so the exit code is hidden from view. I tried the !!fn construct in a standard alone test program with no wisdom gained.
I don't think the "!!fn()" line ever returns here. In the show() function of builtin/notes.c (which is what "fn" is pointing to for "git notes show"), we end up calling execv_git_cmd() to run "git show". So you are really seeing the exit code of something like:
git show $(git notes list HEAD)
That in turn is propagating the return from show_blob_object(). Which I'd think would return "0" here, since it actually showed the blob, though it does look like it could return -1 in a few cases.
Another possible point of confusion: that git-show invocation will run a pager. It's been a long time since I've looked at that code, but IIRC we try to preserve the exit code of the actual Git command (rather than the pager). But you might try:
git --no-pager notes show HEAD
to see if that behaves differently. I couldn't reproduce the issue at all on my end.
-Peff
Quoted 19 lines · Jeff King
Quoted 4 lines · On Tue, Oct 21, 2025 at 05:52:38PM -0400, [email protected] wrote:
It is the exit code. When in gdb, the return from notes is -12 as above. By the time It gets back to bash, the lower bytes are dropped so I end up with a
0xFF, which bash thinks is a 0, so the exit code is hidden from view. I tried the !!fn construct in a standard alone test program withno wisdom gained.
I don't think the "!!fn()" line ever returns here. In the
show()function ofbuiltin/notes.c(which is what "fn" is pointing to for "git notes show"), we end up callingexecv_git_cmd()to run "git show". So you are really seeing the exit code of something like:git show $(git notes list HEAD)
That in turn is propagating the return from
show_blob_object(). Which I'd think would return "0" here, since it actually showed the blob, though it does look like it could return -1 in a few cases.
Quoted 7 lines
Another possible point of confusion: that git-show invocation will run a pager. It's been a long time since I've looked at that code, but IIRC we try to preserve the exit code of the actual Git command (rather than the pager). But you might try:
git --no-pager notes show HEAD
to see if that behaves differently. I couldn't reproduce the issue at all on my end.
I tried running with --no-pager. No difference. Interesting:
git show $(git notes list HEAD)
works correctly with no error report (from inside gdb), while the run of
git --no-pager notes show HEAD
still reports:
Run till exit from #0 main (argc=5, argv=0x811d000)
at /home/jenkinsbuild/.jenkins/workspace/Git_Pipeline/common-main.c:8
Process (0,896) exited with code 037777777764.
Is there a path where just an implied return is used? I have seen the optimizer return whatever is in an x86 register - rsx and rsi are both 12 at git.c:982
- on occasion.
Quoted 8 lines · On Wed, Oct 22, 2025 at 10:27:01AM -0400, [email protected] wrote:
I tried running with --no-pager. No difference. Interesting:
git show $(git notes list HEAD)
works correctly with no error report (from inside gdb), while the run of
git --no-pager notes show HEAD
Quoted 8 lines
still reports:
Run till exit from #0 main (argc=5, argv=0x811d000)
at/home/jenkinsbuild/.jenkins/workspace/Git_Pipeline/common-main.c:8
Process (0,896) exited with code 037777777764.Is there a path where just an implied return is used? I have seen the optimizer return whatever is in an x86 register - rsx and rsi are both 12 at git.c:982
- on occasion.
Not that I know of (and I'd expect the compiler to complain if we ever had a code path that didn't return). It is weird that git-show produces the right exit code, but our execvp() of it does not. In your place I guess I'd try walking through the debugger all the way down to the exec system call (and ideally convincing the debugger to keep going in the exec'd process image).
-Peff
Quoted 19 lines · Jeff King
Quoted 8 lines · On Wed, Oct 22, 2025 at 10:27:01AM -0400, [email protected] wrote:
I tried running with --no-pager. No difference. Interesting:
git show $(git notes list HEAD)
works correctly with no error report (from inside gdb), while the run of
git --no-pager notes show HEAD
Quoted 8 lines
still reports:
Run till exit from #0 main (argc=5, argv=0x811d000)
at/home/jenkinsbuild/.jenkins/workspace/Git_Pipeline/common-main.c:8
Process (0,896) exited with code 037777777764.Is there a path where just an implied return is used? I have seen the optimizer return whatever is in an x86 register - rsx and rsi are both 12 at git.c:982
- on occasion.
Quoted 6 lines
Not that I know of (and I'd expect the compiler to complain if we ever had a code path that didn't return). It is weird that git-show produces the right exit code, but our
execvp()of it does not. In your place I guess I'd try walking through the debugger all the way down to the exec system call (and ideally convincing the debugger to keep going in the exec'd process image).
What I found is this:
Git drops into sane_execvp and converts the
git notes show HEAD
to
git show 1aa950256829721750e809788e7b858db79a934a.
When execvp is called, it immediately fails with a -12 - not returned, just terminates. The -12 is an NonStop-specific execvp error indicating the process failed because the object is invalid (strange and likely an artifact rather than a real problem).
When I use the arguments as presented to execvp via bash directly, I get:
error: no note found for object 1aa950256829721750e809788e7b858db79a934a.
and gdb correctly reports
Process (0,709) exited with code 01.
There is no commit with that hash. HEAD is actually 3fc1917e0e69b23265f5c49f90fdb6f4ed98f4a3 so git show is correctly failing. This is Indicating that notes is not invoking git correctly.
Quoted 6 lines · On Fri, Oct 24, 2025 at 01:33:02PM -0400, [email protected] wrote:
What I found is this:
Git drops into
sane_execvpand converts thegit notes show HEAD
Quoted 8 lines
to
git show
1aa950256829721750e809788e7b858db79a934a.When execvp is called, it immediately fails with a -12 - not returned, just terminates. The -12 is an NonStop-specific execvp error indicating the process failed because the object is invalid (strange and likely an artifact rather than a real problem).
When you say "object" here, you don't mean a Git object, but rather that execvp() could not run the "git" binary for some reason (so the "object" here is the on-disk executable)? Just making sure I understand.
Quoted 7 lines
When I use the arguments as presented to execvp via bash directly, I get:
error: no note found for object
1aa950256829721750e809788e7b858db79a934a.There is no commit with that hash. HEAD is actually
3fc1917e0e69b23265f5c49f90fdb6f4ed98f4a3so git show is correctly failing. This is Indicating that notes is not invoking git correctly.
Are you sure you are running "git show" there and not "git notes show". Because 1aa950256 should be the blob that the note for HEAD points to, and thus does not itself have a note. And "git show" should not be looking up notes at all (and the "no note found" message is from builtin/notes.c).
-Peff
Quoted 31 lines · Jeff King
Quoted 6 lines · On Fri, Oct 24, 2025 at 01:33:02PM -0400, [email protected] wrote:
What I found is this:
Git drops into
sane_execvpand converts thegit notes show HEAD
Quoted 8 lines
to
git show
1aa950256829721750e809788e7b858db79a934a.When execvp is called, it immediately fails with a -12 - not returned, just terminates. The -12 is an NonStop-specific execvp error indicating the process failed because the object is invalid (strange and likely an artifact rather than a real problem).
When you say "object" here, you don't mean a Git object, but rather that
execvp()could not run the "git" binary for some reason (so the "object" here is the on-disk executable)? Just making sure I understand.Quoted 3 lines
When I use the arguments as presented to execvp via bash directly, I get:
error: no note found for object
1aa950256829721750e809788e7b858db79a934a.Quoted 5 lines
There is no commit with that hash. HEAD is actually
3fc1917e0e69b23265f5c49f90fdb6f4ed98f4a3
so git show is correctly failing. This is Indicating that notes is not invoking git correctly.
Quoted 4 lines
Are you sure you are running "git show" there and not "git notes show". Because
1aa950256should be the blob that the note for HEAD points to, and thus does not itself have a note. And "git show" should not be looking up notes at all (and the "no note found" message is frombuiltin/notes.c).
I am 100% sure that git notes show is running git show with the notes blob as above.
Quoted 32 lines · On Fri, Oct 24, 2025 at 02:38:05PM -0400, [email protected] wrote:
Quoted 31 lines · Jeff King
Quoted 6 lines · On Fri, Oct 24, 2025 at 01:33:02PM -0400, [email protected] wrote:
What I found is this:
Git drops into
sane_execvpand converts thegit notes show HEAD
Quoted 8 lines
to
git show
1aa950256829721750e809788e7b858db79a934a.When execvp is called, it immediately fails with a -12 - not returned, just terminates. The -12 is an NonStop-specific execvp error indicating the process failed because the object is invalid (strange and likely an artifact rather than a real problem).
When you say "object" here, you don't mean a Git object, but rather that
execvp()could not run the "git" binary for some reason (so the "object" here is the on-disk executable)? Just making sure I understand.Quoted 3 lines
When I use the arguments as presented to execvp via bash directly, I get:
error: no note found for object
1aa950256829721750e809788e7b858db79a934a.Quoted 5 lines
There is no commit with that hash. HEAD is actually
3fc1917e0e69b23265f5c49f90fdb6f4ed98f4a3
so git show is correctly failing. This is Indicating that notes is not invoking git correctly.
Quoted 6 lines
Quoted 4 lines
Are you sure you are running "git show" there and not "git notes show". Because
1aa950256should be the blob that the note for HEAD points to, and thus does not itself have a note. And "git show" should not be looking up notes at all (and the "no note found" message is frombuiltin/notes.c).I am 100% sure that git notes show is running git show with the notes blob as above.
Yes, I am, too. What I was asking is when you tried to replicate that using bash directly, how did you get a "no note found" message from "git show"? I.e., it sounds like you ran the wrong command. Or I am misunderstanding what you you meant by "When I use the arguments as presented to execvp via bash directly".
-Peff
Quoted 50 lines
-----Original Message-----
From: Jeff King <[email protected]>
Sent: October 24, 2025 2:52 PM
To: [email protected]
Cc: 'D. Ben Knoble' <[email protected]>; [email protected]
Subject: Re: [BUG] Strange git notes completion behaviourQuoted 33 lines · On Fri, Oct 24, 2025 at 02:38:05PM -0400, [email protected] wrote:
Quoted 32 lines · Jeff King
Quoted 6 lines · On Fri, Oct 24, 2025 at 01:33:02PM -0400, [email protected] wrote:
What I found is this:
Git drops into
sane_execvpand converts thegit notes show HEAD
Quoted 8 lines
to
git show
1aa950256829721750e809788e7b858db79a934a.When execvp is called, it immediately fails with a -12 - not returned, just terminates. The -12 is an NonStop-specific execvp error indicating the process failed because the object is invalid (strange and likely an artifact rather than a real problem).
When you say "object" here, you don't mean a Git object, but rather that
execvp()could not run the "git" binary for some reason (so the "object" here is the on-disk executable)? Just making sure I understand.Quoted 3 lines
When I use the arguments as presented to execvp via bash directly, I get:
error: no note found for object
1aa950256829721750e809788e7b858db79a934a.Quoted 5 lines
There is no commit with that hash. HEAD is actually
3fc1917e0e69b23265f5c49f90fdb6f4ed98f4a3
so git show is correctly failing. This is Indicating that notes is not invoking git correctly.Quoted 4 lines
Quoted 4 lines
Are you sure you are running "git show" there and not "git notes show". Because
1aa950256should be the blob that the note for HEAD points to, and thus does not itself have a note. And "git show" should not be looking up notes at all (and the "no note found" message is from
builtin/notes.c).Quoted 1 line
Quoted 7 lines
Quoted 1 line
I am 100% sure that git notes show is running git show with the notes blob as
above.
Yes, I am, too. What I was asking is when you tried to replicate that using bash directly, how did you get a "no note found" message from "git show"? I.e., it sounds like you ran the wrong command. Or I am misunderstanding what you you meant by "When I use the arguments as presented to execvp via bash directly".
I ran the exact command that git passed to execvp but did so via bash. This is what gdb showed:
Breakpoint 2, sane_execvp (file=0x80aa470 "git", argv=0x8122700)
at /home/randall/git/run-command.c:244
* 244 int exec_id = trace2_exec(file, (const char **)argv);
(xInspect 0,1011):n
* 247 if (!execvp(file, argv))
(xInspect 0,1011):p file
$1 = (const unsigned char *) 0x80aa470 "git" (xInspect 0,1011):p argv[0]
$2 = 0x81224a0 "git"
(xInspect 0,1011):p argv[1]
$3 = 0x8122770 "show"
(xInspect 0,1011):p argv[2]
$4 = 0x8122780 "1aa950256829721750e809788e7b858db79a934a" (xInspect 0,1011):p argv[3]
$5 = 0x0
I assumed that I should give that command a try from bash.
Quoted 43 lines · On Fri, Oct 24, 2025 at 03:02:18PM -0400, [email protected] wrote:
Quoted 16 lines
Quoted 10 lines
Quoted 10 lines
Quoted 3 lines
When I use the arguments as presented to execvp via bash directly, I get:
error: no note found for object
1aa950256829721750e809788e7b858db79a934a.Quoted 5 lines
There is no commit with that hash. HEAD is actually
3fc1917e0e69b23265f5c49f90fdb6f4ed98f4a3
so git show is correctly failing. This is Indicating that notes is not invoking git correctly.Quoted 4 lines
Quoted 4 lines
Are you sure you are running "git show" there and not "git notes show". Because
1aa950256should be the blob that the note for HEAD points to, and thus does not itself have a note. And "git show" should not be looking up notes at all (and the "no note found" message is from
builtin/notes.c).Quoted 1 line
Quoted 7 lines
Quoted 1 line
I am 100% sure that git notes show is running git show with the notes blob as
above.
Yes, I am, too. What I was asking is when you tried to replicate that using bash directly, how did you get a "no note found" message from "git show"? I.e., it sounds like you ran the wrong command. Or I am misunderstanding what you you meant by "When I use the arguments as presented to execvp via bash directly".
I ran the exact command that git passed to execvp but did so via bash. This is what gdb showed:
Breakpoint 2,
sane_execvp(file=0x80aa470 "git", argv=0x8122700)at /home/randall/git/run-command.c:244* 244 int
exec_id=trace2_exec(file, (const char **)argv);
(xInspect 0,1011):n
* 247 if (!execvp(file, argv))
(xInspect 0,1011):p file
$1 = (const unsigned char *)0x80aa470"git" (xInspect 0,1011):p argv[0]
$2 =0x81224a0"git"
(xInspect 0,1011):p argv[1]
$3 =0x8122770"show"
(xInspect 0,1011):p argv[2]
$4 =0x8122780"1aa950256829721750e809788e7b858db79a934a" (xInspect 0,1011):p argv[3]
$5 =0x0
Quoted 1 line
I assumed that I should give that command a try from bash.
OK, yeah, that's what I thought you meant. And that command produced the output "error: no note found for object 1aa95025..."? That doesn't make any sense to me. Which is why I asked if you accidentally typo'd it into "git notes show 1aa95025...".
-Peff