Thread (73 messages) 73 messages, 7 authors, 2021-08-31

RE: [PATCH v2] tr2: log parent process name

From: Randall S. Becker <hidden>
Date: 2021-05-20 21:36:38

On May 20, 2021 5:06 PM, Emily Shaffer wrote:
To: git@vger.kernel.org
Cc: Emily Shaffer <redacted>; Ævar Arnfjörð Bjarmason <redacted>; Junio C Hamano <redacted>;
Jeff Hostetler [off-list ref]; Bagas Sanjaya [off-list ref]
Subject: [PATCH v2] tr2: log parent process name

It can be useful to tell who invoked Git - was it invoked manually by a user via CLI or script? By an IDE?  In some cases - like 'repo' tool -
we can influence the source code and set the GIT_TRACE2_PARENT_SID environment variable from the caller process. In 'repo''s case,
that parent SID is manipulated to include the string "repo", which means we can positively identify when Git was invoked by 'repo' tool.
However, identifying parents that way requires both that we know which tools invoke Git and that we have the ability to modify the source
code of those tools. It cannot scale to keep up with the various IDEs and wrappers which use Git, most of which we don't know about.
Learning which tools and wrappers invoke Git, and how, would give us insight to decide where to improve Git's usability and performance.

Unfortunately, there's no cross-platform reliable way to gather the name of the parent process. If procfs is present, we can use that;
otherwise we will need to discover the name another way. However, the process ID should be sufficient regardless of platform.
I like this idea, but there are some platforms where this is unlikely to work. NonStop, in particular, can initiate git - and I frequently do - from a non-POSIX environment where process name is entirely different. In fact, it is something like $ABC (always beginning with a $, which makes life very difficult for shell scripts and screws up GIT_SSH_COMMAND, but I digress). I'm going to need to plug in something very platform-specific to make this work. getppid() always returns 1 in this situation, which is extraordinarily meaningless on the platform and does not represent the actual parent.

I will try to put the appropriate compat hooks in once this moves into master but I can't promise it will be particularly efficient at this stage.

Regards,
Randall
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help