All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Daniel Jacques <dnj@google.com>
Cc: "Junio C Hamano" <gitster@pobox.com>,
	git@vger.kernel.org, "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: Re: [PATCH v7 0/3] RUNTIME_PREFIX relocatable Git
Date: Mon, 26 Mar 2018 23:16:14 +0200 (DST)	[thread overview]
Message-ID: <nycvar.QRO.7.76.6.1803262305010.77@ZVAVAG-6OXH6DA.rhebcr.pbec.zvpebfbsg.pbz> (raw)
In-Reply-To: <CAD1RUU-oUXx+mGUe6QuTawLhLz1nGFZiOWnF7=DVA1uf455zfw@mail.gmail.com>

Hi,

On Mon, 26 Mar 2018, Daniel Jacques wrote:

> On Mon, Mar 26, 2018 at 2:01 AM Junio C Hamano <gitster@pobox.com> wrote:
> 
> > I wonder if the relocatable Git would allow a simpler arrangement to
> > test without installing.
> 
> > I am asking merely out of curiosity, not suggesting to make a trial
> > install somewhere in the build area and run the built Git normally
> > without GIT_EXEC_PATH trick.
> 
> RUNTIME_PREFIX resolves paths relative to the runtime path of the Git
> binary. These path expectations are constructed around installation
> directories, so I'd expect that installation is a prerequisite of testing.

Indeed. This is the relevant part of the code:

        if (!prefix &&
            !(prefix = strip_path_suffix(argv0_path, GIT_EXEC_PATH)) &&
            !(prefix = strip_path_suffix(argv0_path, BINDIR)) &&
            !(prefix = strip_path_suffix(argv0_path, "git"))) {
                prefix = FALLBACK_RUNTIME_PREFIX;
                trace_printf("RUNTIME_PREFIX requested, "
                                "but prefix computation failed.  "
                                "Using static fallback '%s'.\n", prefix);
        }

Note how the argv0_path (which is the absolute path of the directory
*containing* the `git` executable) is tested for several suffixes, i.e.
trailing directories, namely

	libexec/git-core
	bin
	git

That means that you will have to have your `git` executable built in a
worktree whose absolute path ends in one of these.

While writing this reply, I was wondering why "git" is included in this
list. You know, I can see libexec/git-core and bin because that is where
the `git` executable is installed to (or hard-linked to). But "git"?

Turns out that I am the responsible person for that (024aa7d8d51
(system_path(): simplify using strip_path_suffix(), and add suffix "git",
2009-02-19)), having assumed back then that everybody who uses the
RUNTIME_PREFIX feature and works on Git does so in /git/. Which is of
course no longer true in general. For example, I myself got bitten by this
when developing some patches on top of Dan's patch series in a *linked
worktree*  of the name "runtime-prefix". Oh well.

But the short answer is: no, you cannot rely on the RUNTIME_PREFIX feature
for running Git's own test suite. The GIT_EXEC_PATH method to force Git's
test suite to use the compiled executables is still required.

Even if it is fragile: if git-FOO exists in <prefix>/bin/ and some test
relies on the FOO subcommand but we removed it from the source code to
test whether it is needed, the test suite would pass just fine because it
finds git-FOO in the PATH.

*sigh* seems that I cannot write short answers.

Ciao,
Dscho

  reply	other threads:[~2018-03-26 21:16 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-25 20:51 [PATCH v7 0/3] RUNTIME_PREFIX relocatable Git Dan Jacques
2018-03-25 20:51 ` [PATCH v7 1/3] Makefile: generate Perl header from template file Dan Jacques
2018-03-25 20:51 ` [PATCH v7 2/3] Makefile: add Perl runtime prefix support Dan Jacques
2018-03-25 20:51 ` [PATCH v7 3/3] exec_cmd: RUNTIME_PREFIX on some POSIX systems Dan Jacques
2018-03-25 21:15 ` [PATCH v7 0/3] RUNTIME_PREFIX relocatable Git Ævar Arnfjörð Bjarmason
2018-03-26 13:03   ` Daniel Jacques
2018-03-26 14:08     ` Ævar Arnfjörð Bjarmason
2018-03-26 14:55       ` Daniel Jacques
2018-03-26  6:01 ` Junio C Hamano
2018-03-26 13:00   ` Daniel Jacques
2018-03-26 21:16     ` Johannes Schindelin [this message]
2018-03-26 21:31 ` [PATCH 0/2] Add Windows support to the new RUNTIME_PREFIX design Johannes Schindelin
2018-03-27 14:37   ` Daniel Jacques
2018-03-27 15:54     ` Johannes Schindelin
2018-03-27 16:05       ` Daniel Jacques
2018-03-27 16:28         ` Johannes Schindelin
2018-03-28 17:12         ` Junio C Hamano
2018-03-29 14:54           ` Johannes Schindelin
2018-03-26 21:31 ` [PATCH 1/2] exec_cmd: provide a new-style RUNTIME_PREFIX helper for Windows Johannes Schindelin
2018-03-26 21:31 ` [PATCH 2/2] mingw/msvc: use the new-style RUNTIME_PREFIX helper Johannes Schindelin

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

* 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.1803262305010.77@ZVAVAG-6OXH6DA.rhebcr.pbec.zvpebfbsg.pbz \
    --to=johannes.schindelin@gmx.de \
    --cc=avarab@gmail.com \
    --cc=dnj@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.