From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Elijah Newren <newren@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH v2] Make running git under other debugger-like programs easy
Date: Tue, 10 Apr 2018 10:26:37 +0200 (DST) [thread overview]
Message-ID: <nycvar.QRO.7.76.6.1804101023100.55@ZVAVAG-6OXH6DA.rhebcr.pbec.zvpebfbsg.pbz> (raw)
In-Reply-To: <CABPp-BF4x-ppjptq1TBj+VicvGeWGbfj4e3f5ne_13AEKmvSQQ@mail.gmail.com>
Hi Elijah,
On Mon, 9 Apr 2018, Elijah Newren wrote:
> On Mon, Apr 9, 2018 at 2:19 PM, Johannes Schindelin
> <Johannes.Schindelin@gmx.de> wrote:
> >
> > On Mon, 9 Apr 2018, Elijah Newren wrote:
> >
> >> debug () {
> >> - GIT_TEST_GDB=1 "$@" <&6 >&5 2>&7
> >> + case "$1" in
> >> + -d)
> >> + DBG_FLAGS="$2" &&
> >
> > Maybe we can find a way that does not require setting a variable other
> > than GIT_DEBUGGER? After all, DBG_FLAGS will be visible to the script
> > calling `debug`...
>
> I guess we could instead do a
> export GIT_DEBUGGER="$2"
> here. Short of explicitly using 'export', I think we'd need another
> environment variable.
I suppose so. The GIT_DEBUGGER variable has to be exported *anyway*,
otherwise the bin-wrappers/* won't see it.
> I would have stuck with your original suggestion, except that by running:
> GIT_DEBUGGER="$1" debug_aux "$@"
> GIT_DEBUGGER would be set within the debug_aux function and would NOT
> be set once bin-wrappers/git was called, making git not run under the
> debugger as desired.
Oh, so in debug_aux, you'd have to do some funny
GIT_DEBUGGER="$GIT_DEBUGGER" "$@"
to export that variable to the process... Ugly.
> >> +*)
> >> + GIT_DEBUGGER_ARGS="$GIT_DEBUGGER"
> >> + unset GIT_DEBUGGER
> >> + exec ${GIT_DEBUGGER_ARGS} "${GIT_EXEC_PATH}/@@PROG@@" "$@"
> >
> > It may not be a big deal, bug GIT_DEBUGGER_ARGS (if it was exported e.g.
> > by the user calling the script) is now visible by the called process... (I
> > thought I had tried my best to avoid such a leaking variable in my
> > patch...)
>
> You had a separate, per-process variable:
> GIT_DEBUGGER_$$="$GIT_DEBUGGER"
Right. And I guess it does not work because the _$$ is not expanded, you'd
have to eval it, and then you'd have to quote the right side
appropriately, and it's all not worth it.
> The problem with that line is that the $$ apparently makes bash treat
> it as a command to run rather than as a variable and a value with the
> desire to set one to the other. Prepending the line with 'declare' or
> 'local' or perhaps 'readonly' would fix that, but those aren't posix
> and my reading suggested that while some other shells did support some
> of those builtins, the support was somewhat spotty. Since
> wrap-for-bin.sh runs under /bin/sh, not /bin/bash, I didn't have a way
> of making the per-process piece work and just fell back to a separate
> variable. Maybe we want to change that script to /bin/bash?
>
> Do you see any alternatives I'm missing?
No, not really.
Well, let's stick with your patch (with s/DBG_FLAGS/GIT_DEBUGGER/).
Thanks,
Dscho
next prev parent reply other threads:[~2018-04-10 8:26 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-05 17:49 [PATCH] Make running git under other debugger-like programs easy Elijah Newren
2018-04-05 19:57 ` Johannes Schindelin
2018-04-05 21:16 ` Elijah Newren
2018-04-06 10:38 ` Johannes Schindelin
2018-04-06 22:36 ` Elijah Newren
2018-04-09 18:51 ` [PATCH v2] " Elijah Newren
2018-04-09 21:19 ` Johannes Schindelin
2018-04-10 0:48 ` Elijah Newren
2018-04-10 8:26 ` Johannes Schindelin [this message]
2018-04-24 23:46 ` [PATCH v3] " Elijah Newren
2018-04-25 7:25 ` Johannes Schindelin
2018-04-26 1:56 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=nycvar.QRO.7.76.6.1804101023100.55@ZVAVAG-6OXH6DA.rhebcr.pbec.zvpebfbsg.pbz \
--to=johannes.schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=newren@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).