git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Seiderer <ps.report@gmx.net>
To: git@vger.kernel.org
Subject: Meson build leaks host 'sh' path to target build when cross-compiled
Date: Sun, 9 Feb 2025 13:30:27 +0100	[thread overview]
Message-ID: <20250209133027.64a865aa@gmx.net> (raw)

What did you do before the bug happened? (Steps to reproduce your issue)

  Cross compile git from source (git-2.48.1) using the meson build system
  (Buildroot package experimental converted from autoconf to meson).

What did you expect to happen? (Expected behavior)

  Execute command 'git fetch' on the target without failure.

What happened instead? (Actual behavior)

  Command 'git fetch' on the target failed.

What's different between what you expected and what actually happened?

  Debug with strace showed the following difference:

  - o.k (autoconf):

    679   execve("/bin/sh", ["/bin/sh", "-c", "git-upload-pack '/home/git-repo"..., "git-upload-pack '/home/git-repo"...], 0x55c342ce4420 /* 17 vars */ <unfinished ...>

  - failure (meson build):

    6861  execve("/usr/bin/sh", ["/usr/bin/sh", "-c", "git-upload-pack '/home/git-repo"..., "git-upload-pack '/home/git-repo"...], 0x5639ab382210 /* 17 vars */) = -1 ENOENT (No such file or directory)

  The meson build tries to execute the non-existent '/usr/bin/sh' (instead of
  '/bin/sh' as the autoconf build), 'which sh' on the host returns
  '/usr/bin/sh'...

  From meson.build

   [...]
   186 shell = find_program('sh', dirs: program_path)
   [...]
   685   '-DSHELL_PATH="' + fs.as_posix(shell.full_path()) + '"',

  Do not use the result of 'find_program('sh',...)' for '-DSHELL_PATH='
  (at least not for cross-compile), use fix '/bin/sh' instead or make it
  configurable via a meson option?

Regards,
Peter


[System Info]
git version:
git version 2.48.1
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
libcurl: 8.11.1
OpenSSL: OpenSSL 3.2.3 3 Sep 2024
zlib: 1.3.1
uname: Linux 6.13.1-1-default #1 SMP PREEMPT_DYNAMIC Mon Feb  3 05:33:25 UTC 2025 (1918d13) x86_64
compiler info: gnuc: 14.2
libc info: glibc: 2.40
$SHELL (typically, interactive shell): /bin/bash


[Enabled Hooks]
not run from a git repository - no hooks to show

             reply	other threads:[~2025-02-09 12:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-09 12:30 Peter Seiderer [this message]
2025-02-10  7:41 ` Meson build leaks host 'sh' path to target build when cross-compiled Patrick Steinhardt
2025-02-10 11:26   ` Peter Seiderer
2025-02-18 11:47     ` Patrick Steinhardt
2025-02-18 14:41       ` Eli Schwartz
2025-02-10 16:18   ` Junio C Hamano
2025-02-10 16:43     ` Peter Seiderer
2025-02-10 19:54       ` Junio C Hamano
2025-02-11  8:55         ` Peter Seiderer

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=20250209133027.64a865aa@gmx.net \
    --to=ps.report@gmx.net \
    --cc=git@vger.kernel.org \
    /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 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 NNTP newsgroup(s).