bug-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#65924: git searches coreutils and util-linux commands in PATH


From: Simon Tournier
Subject: bug#65924: git searches coreutils and util-linux commands in PATH
Date: Thu, 05 Oct 2023 18:21:36 +0200

Hi,

On Wed, 04 Oct 2023 at 23:41, Maxim Cournoyer <maxim.cournoyer@gmail.com> wrote:

>> I think we should add coreutils-minimal and sed (or gash-utils?) to the
>> ‘git-submodule’ wrapper that already exists.
>
> That should work for the use case at hand, but we should scan the source
> for occurrences of the tools to see if other git commands need to be
> wrapped as well.  This doesn't also cover 'uname' from my report, which
> should be looked into as well (when is it needed? is it a fatal error if
> it's missing? etc.)

Well, ’git-submodule’ is just a shell script.  It depends on:

  + basename
  + sed
  + git-sh-setup which depends on:
     + basename
     + sed
     + uname

And all these other subcommands match ’git-sh-setup’:

Binary:

 + bin/git
 + bin/scalar
 + libexec/git-core/git
 + libexec/git-core/scalar

Scripts:

 + libexec/git-core/git-filter-branch
 + libexec/git-core/git-merge-octopus
 + libexec/git-core/git-merge-one-file
 + libexec/git-core/git-merge-resolve
 + libexec/git-core/git-mergetool
 + libexec/git-core/git-quiltimport
 + libexec/git-core/git-submodule
 + libexec/git-core/git-web--browse
 + libexec/git-core/git-web--browse

For instance, libexec/git-core/git-mergetools/emerge or
libexec/git-core/git-mergetools/tortoisemerge depends on ’basename’.

This ’git-sh-setup’ is dragged into the picture by the file
’command-list.h’ which basically provides some help.  See below.

Last, I think ’git-sh-setup’ fails if ’uname’ is missing.


Cheers,
simon

--8<---------------cut here---------------start------------->8---
# From Git checkout

$ cat git-submodule | grep -n -E '(basename|sed|uname)'
7:dashless=$(basename "$0" | sed -e 's/-/ /')
569:# parsed here as well, for backward compatibility.
613:"cmd_$(echo $command | sed -e s/-/_/g)" "$@"

$ cat git-sh-setup | grep -n -E '(basename|sed|uname)'
77:     dashless=$(basename -- "$0" | sed -e 's/-/ /')
181:            die "$(eval_gettext "fatal: \$program_name cannot be used 
without a working tree.")"
188:            die "$(eval_gettext "fatal: \$program_name cannot be used 
without a working tree.")"
230:# Generate a sed script to parse identities from a commit.
264:# Create a pick-script as above and feed it to sed. Stdout is suitable for
267:    LANG=C LC_ALL=C sed -ne "$(pick_ident_script "$@")"
292:case $(uname -s) in

$ find $(guix build git-minimal --no-grafts) -type f -exec grep -nH 
git-sh-setup {} \; | sort
grep: /gnu/store/y3vdq2pdkljrw63xxnc2vb6lz07ycar6-git-minimal-2.41.0/bin/git: 
binary file matches
grep: 
/gnu/store/y3vdq2pdkljrw63xxnc2vb6lz07ycar6-git-minimal-2.41.0/bin/scalar: 
binary file matches
grep: 
/gnu/store/y3vdq2pdkljrw63xxnc2vb6lz07ycar6-git-minimal-2.41.0/libexec/git-core/git:
 binary file matches
grep: 
/gnu/store/y3vdq2pdkljrw63xxnc2vb6lz07ycar6-git-minimal-2.41.0/libexec/git-core/scalar:
 binary file matches
/gnu/store/y3vdq2pdkljrw63xxnc2vb6lz07ycar6-git-minimal-2.41.0/libexec/git-core/git-filter-branch:109:.
 git-sh-setup
/gnu/store/y3vdq2pdkljrw63xxnc2vb6lz07ycar6-git-minimal-2.41.0/libexec/git-core/git-merge-octopus:8:.
 git-sh-setup
/gnu/store/y3vdq2pdkljrw63xxnc2vb6lz07ycar6-git-minimal-2.41.0/libexec/git-core/git-merge-one-file:26:.
 git-sh-setup
/gnu/store/y3vdq2pdkljrw63xxnc2vb6lz07ycar6-git-minimal-2.41.0/libexec/git-core/git-merge-resolve:8:.
 git-sh-setup
/gnu/store/y3vdq2pdkljrw63xxnc2vb6lz07ycar6-git-minimal-2.41.0/libexec/git-core/git-mergetool:17:.
 git-sh-setup
/gnu/store/y3vdq2pdkljrw63xxnc2vb6lz07ycar6-git-minimal-2.41.0/libexec/git-core/git-quiltimport:14:.
 git-sh-setup
/gnu/store/y3vdq2pdkljrw63xxnc2vb6lz07ycar6-git-minimal-2.41.0/libexec/git-core/git-submodule:22:.
 git-sh-setup
/gnu/store/y3vdq2pdkljrw63xxnc2vb6lz07ycar6-git-minimal-2.41.0/libexec/git-core/git-web--browse:22:#
 the vanilla git-sh-setup should not be used.
/gnu/store/y3vdq2pdkljrw63xxnc2vb6lz07ycar6-git-minimal-2.41.0/libexec/git-core/git-web--browse:24:.
 git-sh-setup

$ find . -type f -name "*.[ch]" -exec grep -nH git-sh-setup {} \;
./command-list.h:171:   { "git-sh-setup", N_("Common Git shell script setup 
code"), 0 | CAT_purehelpers },

$ find . -type f -name "*.o" -exec grep -nH git-sh-setup {} \;
grep: ./help.o: binary file matches

$ grep git-sh-setup git
grep: git: binary file matches

$ grep -B 5 -A 10 -n uname $(guix build git-minimal 
--no-grafts)/libexec/git-core/git-sh-setup
287-    expr $sz0 \< $sz1 \* 2 >/dev/null || : >"$1"
288-}
289-
290-
291-# Platform specific tweaks to work around some commands
292:case $(uname -s) in
293-*MINGW*)
294-    # Windows has its own (incompatible) sort and find
295-    sort () {
296-            /usr/bin/sort "$@"
297-    }
298-    find () {
299-            /usr/bin/find "$@"
300-    }
301-    # git sees Windows-style pwd
302-    pwd () {
--8<---------------cut here---------------end--------------->8---





reply via email to

[Prev in Thread] Current Thread [Next in Thread]