Skip to content

Commit 46bac90

Browse files
jrngitster
authored andcommitted
Do not install shell libraries executable
Some scripts are expected to be sourced instead of executed on their own. Avoid some confusion by not marking them executable. The executable bit was confusing the valgrind support of our test scripts, which assumed that any executable without a #!-line should be intercepted and run through valgrind. So during valgrind-enabled tests, any script sourcing these files actually sourced the valgrind interception script instead. Reported-by: Jeff King <[email protected]> Signed-off-by: Jonathan Nieder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b0883aa commit 46bac90

File tree

3 files changed

+28
-14
lines changed

3 files changed

+28
-14
lines changed

Makefile

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ PROGRAMS =
341341
SCRIPT_PERL =
342342
SCRIPT_PYTHON =
343343
SCRIPT_SH =
344+
SCRIPT_LIB =
344345
TEST_PROGRAMS =
345346

346347
SCRIPT_SH += git-am.sh
@@ -352,20 +353,21 @@ SCRIPT_SH += git-merge-octopus.sh
352353
SCRIPT_SH += git-merge-one-file.sh
353354
SCRIPT_SH += git-merge-resolve.sh
354355
SCRIPT_SH += git-mergetool.sh
355-
SCRIPT_SH += git-mergetool--lib.sh
356356
SCRIPT_SH += git-notes.sh
357-
SCRIPT_SH += git-parse-remote.sh
358357
SCRIPT_SH += git-pull.sh
359358
SCRIPT_SH += git-quiltimport.sh
360359
SCRIPT_SH += git-rebase--interactive.sh
361360
SCRIPT_SH += git-rebase.sh
362361
SCRIPT_SH += git-repack.sh
363362
SCRIPT_SH += git-request-pull.sh
364-
SCRIPT_SH += git-sh-setup.sh
365363
SCRIPT_SH += git-stash.sh
366364
SCRIPT_SH += git-submodule.sh
367365
SCRIPT_SH += git-web--browse.sh
368366

367+
SCRIPT_LIB += git-mergetool--lib
368+
SCRIPT_LIB += git-parse-remote
369+
SCRIPT_LIB += git-sh-setup
370+
369371
SCRIPT_PERL += git-add--interactive.perl
370372
SCRIPT_PERL += git-difftool.perl
371373
SCRIPT_PERL += git-archimport.perl
@@ -1454,7 +1456,7 @@ export TAR INSTALL DESTDIR SHELL_PATH
14541456

14551457
SHELL = $(SHELL_PATH)
14561458

1457-
all:: shell_compatibility_test $(ALL_PROGRAMS) $(BUILT_INS) $(OTHER_PROGRAMS) GIT-BUILD-OPTIONS
1459+
all:: shell_compatibility_test $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) $(OTHER_PROGRAMS) GIT-BUILD-OPTIONS
14581460
ifneq (,$X)
14591461
$(QUIET_BUILT_IN)$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), test -d '$p' -o '$p' -ef '$p$X' || $(RM) '$p';)
14601462
endif
@@ -1505,17 +1507,25 @@ common-cmds.h: ./generate-cmdlist.sh command-list.txt
15051507
common-cmds.h: $(wildcard Documentation/git-*.txt)
15061508
$(QUIET_GEN)./generate-cmdlist.sh > $@+ && mv $@+ $@
15071509

1510+
define cmd_munge_script
1511+
$(RM) $@ $@+ && \
1512+
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
1513+
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
1514+
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
1515+
-e 's/@@NO_CURL@@/$(NO_CURL)/g' \
1516+
-e $(BROKEN_PATH_FIX) \
1517+
1518+
endef
1519+
15081520
$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
1509-
$(QUIET_GEN)$(RM) $@ $@+ && \
1510-
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
1511-
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
1512-
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
1513-
-e 's/@@NO_CURL@@/$(NO_CURL)/g' \
1514-
-e $(BROKEN_PATH_FIX) \
1515-
$@.sh >$@+ && \
1521+
$(QUIET_GEN)$(cmd_munge_script) && \
15161522
chmod +x $@+ && \
15171523
mv $@+ $@
15181524

1525+
$(SCRIPT_LIB) : % : %.sh
1526+
$(QUIET_GEN)$(cmd_munge_script) && \
1527+
mv $@+ $@
1528+
15191529
ifndef NO_PERL
15201530
$(patsubst %.perl,%,$(SCRIPT_PERL)): perl/perl.mak
15211531

@@ -1866,6 +1876,7 @@ install: all
18661876
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
18671877
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
18681878
$(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
1879+
$(INSTALL) -m 644 $(SCRIPT_LIB) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
18691880
$(INSTALL) $(install_bindir_programs) '$(DESTDIR_SQ)$(bindir_SQ)'
18701881
$(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
18711882
ifndef NO_PERL
@@ -1985,7 +1996,7 @@ distclean: clean
19851996
clean:
19861997
$(RM) *.o block-sha1/*.o ppc/*.o compat/*.o compat/*/*.o xdiff/*.o \
19871998
$(LIB_FILE) $(XDIFF_LIB)
1988-
$(RM) $(ALL_PROGRAMS) $(BUILT_INS) git$X
1999+
$(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
19892000
$(RM) $(TEST_PROGRAMS)
19902001
$(RM) -r bin-wrappers
19912002
$(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h TAGS tags cscope*
@@ -2017,7 +2028,7 @@ endif
20172028
### Check documentation
20182029
#
20192030
check-docs::
2020-
@(for v in $(ALL_PROGRAMS) $(BUILT_INS) git gitk; \
2031+
@(for v in $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git gitk; \
20212032
do \
20222033
case "$$v" in \
20232034
git-merge-octopus | git-merge-ours | git-merge-recursive | \
@@ -2060,9 +2071,12 @@ check-docs::
20602071
documented,gitrepository-layout | \
20612072
documented,gittutorial | \
20622073
documented,gittutorial-2 | \
2074+
documented,git-bisect-lk2009 | \
2075+
documented.git-remote-helpers | \
2076+
documented,gitworkflows | \
20632077
sentinel,not,matching,is,ok ) continue ;; \
20642078
esac; \
2065-
case " $(ALL_PROGRAMS) $(BUILT_INS) git gitk " in \
2079+
case " $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git gitk " in \
20662080
*" $$cmd "*) ;; \
20672081
*) echo "removed but $$how: $$cmd" ;; \
20682082
esac; \

git-parse-remote.sh

100755100644
File mode changed.

git-sh-setup.sh

100755100644
File mode changed.

0 commit comments

Comments
 (0)