git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re [PATCH 1/1] exec_cmd: RUNTIME_PREFIX on some POSIX systems

From
Dan Jacques <dnj@google.com>
Date
Nov 21, 2017, 02:41 UTC
Message-ID
<20171121024102.14153-1-dnj@google.com>
In-Reply-To
<87k1ykwrfv.fsf@evledraar.booking.com>
Ævar Arnfjörð Bjarmason @ 2017-11-20 21:50 UTC suggested:
> So LeonT over at #p5p helped me with this. He believes this'll work
> (unless MakeMaker INSTALL_BASE is set, but that should break the Git
> install anyway):

I think that the problem with this approach is that it uses the local "Config" module. The primary purpose of RUNTIME_PREFIX(_PERL) is that one can build/install Git into a directory, then either move that directory somewhere else or archive it and put it on a different (binary-compatible) system altogether.

The latter case concerns me here. If the "Config" module is loading local system paths, then the relative pathing between "$Config{installsitelib}" and "$Config{siteprefixexp}" may not be consistent between systems, so an archive built from one system may not have a compatible relative directory structure when resolved with the Config module on another system.

Since we control the installation process and paths, we know that the directory structure looks someting like:

.../prefix/$GITEXECDIR/git-perl-script .../prefix/$RELPERLPATH/Git.pm

Our goal is to, given the directory that "git-perl-script" belongs to, first identify the path for ".../prefix" and then append "$RELPERLPATH" to it to generate the full library path.

The most straightforward way to do this, to me, is to:
1) Have the Makefile hard-code "$RELPERLPATH" and "$GITEXECDIR" (relative
  paths) into the header code.
2) Assert that "$FindBin::Bin" (the directory containing the script) ends
  with "$GITEXECDIR".
3) Remove "$GITEXECDIR" from the end of "$FindBin::Bin" to obtain
  ".../prefix" ($prefix). Simple string truncation is probably fine for
  this.
4) Add "File::Spec->catdir($prefix, $RELPERLPATH)" to "lib".

I don't think path separators are a problem, since the Makefile uses "/" indiscriminately. Even Git-for-Windows seems to run its PERL scripts in a POSIX environment (mingw).

Does this sound like a reasonable way to proceed?
Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 6 of 10 in “exec_cmd: RUNTIME_PREFIX on some POSIX systems”
  1. 0/1 exec_cmd: RUNTIME_PREFIX on some POSIX systemsDan Jacques, Nov 19, 2017
  2. 1/1 exec_cmd: RUNTIME_PREFIX on some POSIX systemsDan Jacques, Nov 19, 2017
  3. Junio C HamanoNov 20, 2017
  4. Ævar Arnfjörð BjarmasonNov 20, 2017
  5. Ævar Arnfjörð BjarmasonNov 20, 2017
  6. Re [PATCH 1/1] exec_cmd: RUNTIME_PREFIX on some POSIX systemsDan Jacques, Nov 21, 2017
  7. Ævar Arnfjörð BjarmasonNov 22, 2017
  8. Re [PATCH 1/1] exec_cmd: RUNTIME_PREFIX on some POSIX systemsDan Jacques, Nov 22, 2017
  9. Re(2): [PATCH 1/1] exec_cmd: RUNTIME_PREFIX on some POSIX systemsDan Jacques, Nov 20, 2017
  10. Ævar Arnfjörð BjarmasonNov 20, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.