{"thread":{"id":"65931","subject":"[PATCH] t0213: skip ancestry tests under user-mode emulation","startedAt":"2026-07-06T17:34:04Z","lastAt":"2026-08-03T20:59:28Z","messageCount":7,"participants":["Jamie Magee via GitGitGadget","Junio C Hamano","Weijie Yuan"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"547253","messageId":"pull.2168.git.1783359242130.gitgitgadget@gmail.com","threadId":"65931","inReplyTo":null,"subject":"[PATCH] t0213: skip ancestry tests under user-mode emulation","fromName":"Jamie Magee via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-07-06T17:34:01Z","receivedAt":"2026-07-06T17:34:04Z","isPatch":true,"body":"From: Jamie Magee <jamie.magee@gmail.com>\n\nThe tests added in 3c8c638df6 (t0213: add trace2 cmd_ancestry tests,\n2026-02-13) expect the cmd_ancestry event to name \"test-tool\" and\n\"git\". On Linux those names come from the \"comm\" field of\n/proc/<pid>/stat. Under user-mode emulation (e.g. qemu-user) /proc\nreports the emulator (\"qemu-riscv64\") instead, so the event is still\nemitted, the TRACE2_ANCESTRY probe enables the tests, and tests 2-5\nfail even though they pass on native riscv64.\n\nRequire the probe to see \"test-tool\" in the ancestry of a test-tool\nspawned from test-tool, so the tests skip when the names are unreliable.\n\nCc: Matthew John Cheetham <mjcheetham@outlook.com>\nSigned-off-by: Jamie Magee <jamie.magee@gmail.com>\n---\n    t0213: skip ancestry tests under user-mode emulation\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-2168%2FJamieMagee%2Ft0213-skip-under-emulation-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2168/JamieMagee/t0213-skip-under-emulation-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/2168\n\n t/t0213-trace2-ancestry.sh | 9 ++++++---\n 1 file changed, 6 insertions(+), 3 deletions(-)\n\ndiff --git a/t/t0213-trace2-ancestry.sh b/t/t0213-trace2-ancestry.sh\nindex a2b9536da8..2eb86c1952 100755\n--- a/t/t0213-trace2-ancestry.sh\n+++ b/t/t0213-trace2-ancestry.sh\n@@ -31,12 +31,15 @@ PATH=\"$TTDIR:$PATH\" && export PATH\n # no cmd_ancestry event is emitted.  We detect this at runtime and\n # skip the format-specific tests accordingly.\n \n-# Determine if cmd_ancestry is supported on this platform.\n+# Enable these tests only when cmd_ancestry reports real process names.\n+# The procinfo stub emits no event; under user-mode emulation (e.g.\n+# qemu-user) /proc reports the emulator, not the guest. Spawn test-tool\n+# from test-tool and require \"test-tool\" in the child's ancestry.\n test_expect_success 'detect cmd_ancestry support' '\n \ttest_when_finished \"rm -f trace.detect\" &&\n \tGIT_TRACE2_BRIEF=1 GIT_TRACE2=\"$(pwd)/trace.detect\" \\\n-\t\ttest-tool trace2 001return 0 &&\n-\tif grep -q \"^cmd_ancestry\" trace.detect\n+\t\ttest-tool trace2 004child test-tool trace2 001return 0 &&\n+\tif grep -q \"^cmd_ancestry.*test-tool\" trace.detect\n \tthen\n \t\ttest_set_prereq TRACE2_ANCESTRY\n \tfi\n\nbase-commit: e9019fcafe0040228b8631c30f97ae1adb61bcdc\n-- \ngitgitgadget\n"},{"id":"547281","messageId":"xmqqa4s38rbe.fsf@gitster.g","threadId":"65931","inReplyTo":"pull.2168.git.1783359242130.gitgitgadget@gmail.com","subject":"Re: [PATCH] t0213: skip ancestry tests under user-mode emulation","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-07-07T02:30:13Z","receivedAt":"2026-07-07T02:30:17Z","isPatch":true,"body":"\"Jamie Magee via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> -# Determine if cmd_ancestry is supported on this platform.\n> +# Enable these tests only when cmd_ancestry reports real process names.\n> +# The procinfo stub emits no event; under user-mode emulation (e.g.\n> +# qemu-user) /proc reports the emulator, not the guest. Spawn test-tool\n> +# from test-tool and require \"test-tool\" in the child's ancestry.\n\nT.r.i.c.k.y. ;-)\n\n>  test_expect_success 'detect cmd_ancestry support' '\n>  \ttest_when_finished \"rm -f trace.detect\" &&\n>  \tGIT_TRACE2_BRIEF=1 GIT_TRACE2=\"$(pwd)/trace.detect\" \\\n> -\t\ttest-tool trace2 001return 0 &&\n> -\tif grep -q \"^cmd_ancestry\" trace.detect\n> +\t\ttest-tool trace2 004child test-tool trace2 001return 0 &&\n> +\tif grep -q \"^cmd_ancestry.*test-tool\" trace.detect\n\nThis will be happy even if \"test-tool-trash\" that happens to have\n\"test-tool\" as its prefix appears on a cmd_ancestry line (for that\nmatter, things like \"cmd_ancestry-not-quite\" that has \"cmd_ancestry\"\nas its prefix would be accepted).  I guess that is OK because we are\ntesting this in a fairly tightly controlled environment (trace keys\nare taken from known vocabulary, not arbitrary strings, for example).\n\nWill queue.  Thanks.\n\n>  \tthen\n>  \t\ttest_set_prereq TRACE2_ANCESTRY\n>  \tfi\n>\n> base-commit: e9019fcafe0040228b8631c30f97ae1adb61bcdc\n"},{"id":"548728","messageId":"xmqq33xcz2i7.fsf@gitster.g","threadId":"65931","inReplyTo":"xmqqa4s38rbe.fsf@gitster.g","subject":"Re: [PATCH] t0213: skip ancestry tests under user-mode emulation","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-07-21T17:17:04Z","receivedAt":"2026-07-21T17:17:06Z","isPatch":true,"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> \"Jamie Magee via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n>\n>> -# Determine if cmd_ancestry is supported on this platform.\n>> +# Enable these tests only when cmd_ancestry reports real process names.\n>> +# The procinfo stub emits no event; under user-mode emulation (e.g.\n>> +# qemu-user) /proc reports the emulator, not the guest. Spawn test-tool\n>> +# from test-tool and require \"test-tool\" in the child's ancestry.\n>\n> T.r.i.c.k.y. ;-)\n>\n>>  test_expect_success 'detect cmd_ancestry support' '\n>>  \ttest_when_finished \"rm -f trace.detect\" &&\n>>  \tGIT_TRACE2_BRIEF=1 GIT_TRACE2=\"$(pwd)/trace.detect\" \\\n>> -\t\ttest-tool trace2 001return 0 &&\n>> -\tif grep -q \"^cmd_ancestry\" trace.detect\n>> +\t\ttest-tool trace2 004child test-tool trace2 001return 0 &&\n>> +\tif grep -q \"^cmd_ancestry.*test-tool\" trace.detect\n>\n> This will be happy even if \"test-tool-trash\" that happens to have\n> \"test-tool\" as its prefix appears on a cmd_ancestry line (for that\n> matter, things like \"cmd_ancestry-not-quite\" that has \"cmd_ancestry\"\n> as its prefix would be accepted).  I guess that is OK because we are\n> testing this in a fairly tightly controlled environment (trace keys\n> are taken from known vocabulary, not arbitrary strings, for example).\n>\n> Will queue.  Thanks.\n\nJust to clarify, 'Will queue' simply means that the patch will\nappear in 'seen'.  It does not imply that I have personally\nreviewed the change and found it acceptable to merge into 'next'.\n\nI would appreciate a review from someone familiar with the trace2\nfacility.\n\nThanks.\n"},{"id":"548731","messageId":"al-1JkcH91aW6VWM@wyuan.org","threadId":"65931","inReplyTo":"pull.2168.git.1783359242130.gitgitgadget@gmail.com","subject":"Re: [PATCH] t0213: skip ancestry tests under user-mode emulation","fromName":"Weijie Yuan","fromEmail":"wy@wyuan.org","sentAt":"2026-07-21T18:06:30Z","receivedAt":"2026-07-21T18:06:48Z","isPatch":true,"body":"On Mon, Jul 06, 2026 at 05:34:01PM +0000, Jamie Magee via GitGitGadget wrote:\n> From: Jamie Magee <jamie.magee@gmail.com>\n> \n> The tests added in 3c8c638df6 (t0213: add trace2 cmd_ancestry tests,\n> 2026-02-13) expect the cmd_ancestry event to name \"test-tool\" and\n> \"git\". On Linux those names come from the \"comm\" field of\n> /proc/<pid>/stat. Under user-mode emulation (e.g. qemu-user) /proc\n> reports the emulator (\"qemu-riscv64\") instead, so the event is still\n> emitted, the TRACE2_ANCESTRY probe enables the tests, and tests 2-5\n> fail even though they pass on native riscv64.\n> \n> Require the probe to see \"test-tool\" in the ancestry of a test-tool\n> spawned from test-tool, so the tests skip when the names are unreliable.\n> \n> Cc: Matthew John Cheetham <mjcheetham@outlook.com>\n> Signed-off-by: Jamie Magee <jamie.magee@gmail.com>\n> ---\n\nVery sorry to say something completely outside the patch.\n\nBut may I ask what's the point of writting the line started with \"Cc:\"?\nI know that Linux kernel has something about writting Cc in the commit\nmessage, while I don't see much from Git's documentation about trailers,\nincluding MyFirstContribution and SubmittingPatches. Although I know\nthat \"git send-email\" and \"git interpret-trailers\" could use \"Cc:\", I\nstill wonder whether using this trailer is encouraged or not. If so,\nadding some decriptions about it would be nice, I guess, since I was\nconfused when reading kernel docs about using Cc trailers in the commit\nmessage sometime ago.\n\nSorry in advance if I missed any context.\n\nThanks very much.\n"},{"id":"548745","messageId":"xmqqwluot3bz.fsf@gitster.g","threadId":"65931","inReplyTo":"al-1JkcH91aW6VWM@wyuan.org","subject":"Re: [PATCH] t0213: skip ancestry tests under user-mode emulation","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-07-21T21:55:44Z","receivedAt":"2026-07-21T21:55:47Z","isPatch":true,"body":"Weijie Yuan <wy@wyuan.org> writes:\n\n>> ...\n>> Cc: Matthew John Cheetham <mjcheetham@outlook.com>\n>> Signed-off-by: Jamie Magee <jamie.magee@gmail.com>\n>> ---\n>\n> Very sorry to say something completely outside the patch.\n>\n> But may I ask what's the point of writting the line started with \"Cc:\"?\n> ...\n> I know that Linux kernel has something about writting Cc in the commit\n> message, while I don't see much from Git's documentation about trailers,\n> including MyFirstContribution and SubmittingPatches.\n\nIf you ask me, 'Cc:' belongs in e-mail headers, not in commit\nmessages, though the Linux kernel community has a different\nconvention.\n\nGitGitGadget collects 'Cc:' lines from the commit message and, when\nsending e-mails on behalf of the author, copies the recipients\nlisted there, if I am not mistaken.  Thus, it is not surprising that\ncontributors use the trailer for that purpose.\n\nWe do not use the 'Cc:' trailer to allow a commit author to say, \"As\nthe commit object indicates, I CC'd this change to that expert.  I\nam no longer solely responsible for any bugs in this commit.  That\nexpert should have caught my mistake!\"  ;-)\n\nThanks.\n"},{"id":"548754","messageId":"amBi4DIk03ri7y2c@wyuan.org","threadId":"65931","inReplyTo":"xmqqwluot3bz.fsf@gitster.g","subject":"Re: [PATCH] t0213: skip ancestry tests under user-mode emulation","fromName":"Weijie Yuan","fromEmail":"wy@wyuan.org","sentAt":"2026-07-22T06:27:44Z","receivedAt":"2026-07-22T06:27:57Z","isPatch":true,"body":"On Tue, Jul 21, 2026 at 02:55:44PM -0700, Junio C Hamano wrote:\n> Weijie Yuan <wy@wyuan.org> writes:\n> \n> >> ...\n> >> Cc: Matthew John Cheetham <mjcheetham@outlook.com>\n> >> Signed-off-by: Jamie Magee <jamie.magee@gmail.com>\n> >> ---\n> >\n> > Very sorry to say something completely outside the patch.\n> >\n> > But may I ask what's the point of writting the line started with \"Cc:\"?\n> > ...\n> > I know that Linux kernel has something about writting Cc in the commit\n> > message, while I don't see much from Git's documentation about trailers,\n> > including MyFirstContribution and SubmittingPatches.\n> \n> If you ask me, 'Cc:' belongs in e-mail headers, not in commit\n> messages, though the Linux kernel community has a different\n> convention.\n> \n> GitGitGadget collects 'Cc:' lines from the commit message and, when\n> sending e-mails on behalf of the author, copies the recipients\n> listed there, if I am not mistaken.  Thus, it is not surprising that\n> contributors use the trailer for that purpose.\n\nYeah, I noticed that this patch was sent bt GGG. But since he has\nalready added \"Cc\" at the end of the commit message, yet in the actual\nemail header, there is no \"Matthew John Cheetham\", which was confusing?\nThis is something I forgot to mention in the previous email, sorry.\n\nI may have to take a closer look at GGG later.\n\n> We do not use the 'Cc:' trailer to allow a commit author to say, \"As\n> the commit object indicates, I CC'd this change to that expert.  I\n> am no longer solely responsible for any bugs in this commit.  That\n> expert should have caught my mistake!\"  ;-)\n\n;-) I agree!\n\nThanks!\n"},{"id":"549513","messageId":"xmqq8q6myl76.fsf@gitster.g","threadId":"65931","inReplyTo":"pull.2168.git.1783359242130.gitgitgadget@gmail.com","subject":"Re: [PATCH] t0213: skip ancestry tests under user-mode emulation","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-08-03T20:59:25Z","receivedAt":"2026-08-03T20:59:28Z","isPatch":true,"body":"\"Jamie Magee via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> From: Jamie Magee <jamie.magee@gmail.com>\n>\n> The tests added in 3c8c638df6 (t0213: add trace2 cmd_ancestry tests,\n> 2026-02-13) expect the cmd_ancestry event to name \"test-tool\" and\n> \"git\". On Linux those names come from the \"comm\" field of\n> /proc/<pid>/stat. Under user-mode emulation (e.g. qemu-user) /proc\n> reports the emulator (\"qemu-riscv64\") instead, so the event is still\n> emitted, the TRACE2_ANCESTRY probe enables the tests, and tests 2-5\n> fail even though they pass on native riscv64.\n>\n> Require the probe to see \"test-tool\" in the ancestry of a test-tool\n> spawned from test-tool, so the tests skip when the names are unreliable.\n>\n> Cc: Matthew John Cheetham <mjcheetham@outlook.com>\n> Signed-off-by: Jamie Magee <jamie.magee@gmail.com>\n> ---\n>     t0213: skip ancestry tests under user-mode emulation\n\nWhile nobody with similar environment that would benefit from this\nchange has stepped up since this patch was posted almost a month\nago (and I do not have such an environment to test it on, either),\nthis seems low impact enough to cause regressions in environments\nwhere the change does not intend to affect (i.e., native environments\nwhere process names are trustworthy).\n\nSo I am tempted to merge this down, only if it is to shrink the\nnumber of in-flight topics I have to carry and watch out for\nupdates, as nobody seems to be motivated enough to recruit testers\nor reviewers to move the topic forward.\n\nThose who are not in the user-mode emulation environment and are\nnegatively affected because this patch drops TRACE2_ANCESTRY from\nyour envionment should block me with a real review on the patch,\npreferrably with suggested improvements.\n\nThanks.\n"}]}