* [BUG] Strange git notes completion behaviour
@ 2025-10-21 21:06 rsbecker
2025-10-21 21:32 ` D. Ben Knoble
0 siblings, 1 reply; 12+ messages in thread
From: rsbecker @ 2025-10-21 21:06 UTC (permalink / raw)
To: git
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
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [BUG] Strange git notes completion behaviour
2025-10-21 21:06 [BUG] Strange git notes completion behaviour rsbecker
@ 2025-10-21 21:32 ` D. Ben Knoble
2025-10-21 21:52 ` rsbecker
0 siblings, 1 reply; 12+ messages in thread
From: D. Ben Knoble @ 2025-10-21 21:32 UTC (permalink / raw)
To: rsbecker; +Cc: git
On Tue, Oct 21, 2025 at 5:07 PM <rsbecker@nexbridge.com> 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 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
Exit code or shell (tab) completion? I'm a bit confused, so maybe
someone else is, too.
--
D. Ben Knoble
^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: [BUG] Strange git notes completion behaviour
2025-10-21 21:32 ` D. Ben Knoble
@ 2025-10-21 21:52 ` rsbecker
2025-10-22 9:27 ` Jeff King
0 siblings, 1 reply; 12+ messages in thread
From: rsbecker @ 2025-10-21 21:52 UTC (permalink / raw)
To: 'D. Ben Knoble'; +Cc: git
On October 21, 2025 5:33 PM, D. Ben Knoble wrote:
>On Tue, Oct 21, 2025 at 5:07 PM <rsbecker@nexbridge.com> 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 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
>
>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.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [BUG] Strange git notes completion behaviour
2025-10-21 21:52 ` rsbecker
@ 2025-10-22 9:27 ` Jeff King
2025-10-22 14:27 ` rsbecker
0 siblings, 1 reply; 12+ messages in thread
From: Jeff King @ 2025-10-22 9:27 UTC (permalink / raw)
To: rsbecker; +Cc: 'D. Ben Knoble', git
On Tue, Oct 21, 2025 at 05:52:38PM -0400, rsbecker@nexbridge.com 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
^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: [BUG] Strange git notes completion behaviour
2025-10-22 9:27 ` Jeff King
@ 2025-10-22 14:27 ` rsbecker
2025-10-23 12:48 ` Jeff King
0 siblings, 1 reply; 12+ messages in thread
From: rsbecker @ 2025-10-22 14:27 UTC (permalink / raw)
To: 'Jeff King'; +Cc: 'D. Ben Knoble', git
On October 22, 2025 5:27 AM, Jeff King wrote:
>On Tue, Oct 21, 2025 at 05:52:38PM -0400, rsbecker@nexbridge.com 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.
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.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [BUG] Strange git notes completion behaviour
2025-10-22 14:27 ` rsbecker
@ 2025-10-23 12:48 ` Jeff King
2025-10-24 17:33 ` rsbecker
0 siblings, 1 reply; 12+ messages in thread
From: Jeff King @ 2025-10-23 12:48 UTC (permalink / raw)
To: rsbecker; +Cc: 'D. Ben Knoble', git
On Wed, Oct 22, 2025 at 10:27:01AM -0400, rsbecker@nexbridge.com 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
>
> 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
^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: [BUG] Strange git notes completion behaviour
2025-10-23 12:48 ` Jeff King
@ 2025-10-24 17:33 ` rsbecker
2025-10-24 17:46 ` Jeff King
0 siblings, 1 reply; 12+ messages in thread
From: rsbecker @ 2025-10-24 17:33 UTC (permalink / raw)
To: 'Jeff King'; +Cc: 'D. Ben Knoble', git
On October 23, 2025 8:49 AM, Jeff King wrote:
>On Wed, Oct 22, 2025 at 10:27:01AM -0400, rsbecker@nexbridge.com 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
>>
>> 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).
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.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [BUG] Strange git notes completion behaviour
2025-10-24 17:33 ` rsbecker
@ 2025-10-24 17:46 ` Jeff King
2025-10-24 18:38 ` rsbecker
0 siblings, 1 reply; 12+ messages in thread
From: Jeff King @ 2025-10-24 17:46 UTC (permalink / raw)
To: rsbecker; +Cc: 'D. Ben Knoble', git
On Fri, Oct 24, 2025 at 01:33:02PM -0400, rsbecker@nexbridge.com wrote:
> 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 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.
> 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 3fc1917e0e69b23265f5c49f90fdb6f4ed98f4a3
> so 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
^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: [BUG] Strange git notes completion behaviour
2025-10-24 17:46 ` Jeff King
@ 2025-10-24 18:38 ` rsbecker
2025-10-24 18:52 ` Jeff King
0 siblings, 1 reply; 12+ messages in thread
From: rsbecker @ 2025-10-24 18:38 UTC (permalink / raw)
To: 'Jeff King'; +Cc: 'D. Ben Knoble', git
On October 24, 2025 1:47 PM, Jeff King wrote:
>On Fri, Oct 24, 2025 at 01:33:02PM -0400, rsbecker@nexbridge.com wrote:
>
>> 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 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.
>
>> 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
>> 3fc1917e0e69b23265f5c49f90fdb6f4ed98f4a3
>> so 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).
I am 100% sure that git notes show is running git show with the notes blob as above.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [BUG] Strange git notes completion behaviour
2025-10-24 18:38 ` rsbecker
@ 2025-10-24 18:52 ` Jeff King
2025-10-24 19:02 ` rsbecker
0 siblings, 1 reply; 12+ messages in thread
From: Jeff King @ 2025-10-24 18:52 UTC (permalink / raw)
To: rsbecker; +Cc: 'D. Ben Knoble', git
On Fri, Oct 24, 2025 at 02:38:05PM -0400, rsbecker@nexbridge.com wrote:
> On October 24, 2025 1:47 PM, Jeff King wrote:
> >On Fri, Oct 24, 2025 at 01:33:02PM -0400, rsbecker@nexbridge.com wrote:
> >
> >> 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 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.
> >
> >> 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
> >> 3fc1917e0e69b23265f5c49f90fdb6f4ed98f4a3
> >> so 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).
>
> 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
^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: [BUG] Strange git notes completion behaviour
2025-10-24 18:52 ` Jeff King
@ 2025-10-24 19:02 ` rsbecker
2025-10-24 20:16 ` Jeff King
0 siblings, 1 reply; 12+ messages in thread
From: rsbecker @ 2025-10-24 19:02 UTC (permalink / raw)
To: 'Jeff King'; +Cc: 'D. Ben Knoble', git
>-----Original Message-----
>From: Jeff King <peff@peff.net>
>Sent: October 24, 2025 2:52 PM
>To: rsbecker@nexbridge.com
>Cc: 'D. Ben Knoble' <ben.knoble@gmail.com>; git@vger.kernel.org
>Subject: Re: [BUG] Strange git notes completion behaviour
>
>On Fri, Oct 24, 2025 at 02:38:05PM -0400, rsbecker@nexbridge.com wrote:
>
>> On October 24, 2025 1:47 PM, Jeff King wrote:
>> >On Fri, Oct 24, 2025 at 01:33:02PM -0400, rsbecker@nexbridge.com wrote:
>> >
>> >> 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 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.
>> >
>> >> 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
>> >> 3fc1917e0e69b23265f5c49f90fdb6f4ed98f4a3
>> >> so 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).
>>
>> 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.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [BUG] Strange git notes completion behaviour
2025-10-24 19:02 ` rsbecker
@ 2025-10-24 20:16 ` Jeff King
0 siblings, 0 replies; 12+ messages in thread
From: Jeff King @ 2025-10-24 20:16 UTC (permalink / raw)
To: rsbecker; +Cc: 'D. Ben Knoble', git
On Fri, Oct 24, 2025 at 03:02:18PM -0400, rsbecker@nexbridge.com wrote:
> >> >> 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
> >> >> 3fc1917e0e69b23265f5c49f90fdb6f4ed98f4a3
> >> >> so 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).
> >>
> >> 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.
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
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2025-10-24 20:16 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-21 21:06 [BUG] Strange git notes completion behaviour rsbecker
2025-10-21 21:32 ` D. Ben Knoble
2025-10-21 21:52 ` rsbecker
2025-10-22 9:27 ` Jeff King
2025-10-22 14:27 ` rsbecker
2025-10-23 12:48 ` Jeff King
2025-10-24 17:33 ` rsbecker
2025-10-24 17:46 ` Jeff King
2025-10-24 18:38 ` rsbecker
2025-10-24 18:52 ` Jeff King
2025-10-24 19:02 ` rsbecker
2025-10-24 20:16 ` Jeff King
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).