git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Meson build leaks host 'sh' path to target build when cross-compiled
@ 2025-02-09 12:30 Peter Seiderer
  2025-02-10  7:41 ` Patrick Steinhardt
  0 siblings, 1 reply; 9+ messages in thread
From: Peter Seiderer @ 2025-02-09 12:30 UTC (permalink / raw)
  To: git

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-02-18 14:42 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-09 12:30 Meson build leaks host 'sh' path to target build when cross-compiled Peter Seiderer
2025-02-10  7:41 ` 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

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).