@matheusbsbs / matheus-bagliano / commits / 46bac90458
Fork 0

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 <peff@peff.net> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jonathan Nieder committed Jan 31, 2010 at 11:46 UTC 46bac904581798eaf0f07f91701c2c72219e207f
3 files changed +28 -14
Makefile
+28 -14
@@ -341,6 +341,7 @@ PROGRAMS =
341 SCRIPT_PERL =
342 SCRIPT_PYTHON =
343 SCRIPT_SH =
344 +SCRIPT_LIB =
345 TEST_PROGRAMS =
346
347 SCRIPT_SH += git-am.sh
@@ -352,20 +353,21 @@ SCRIPT_SH += git-merge-octopus.sh
353 SCRIPT_SH += git-merge-one-file.sh
354 SCRIPT_SH += git-merge-resolve.sh
355 SCRIPT_SH += git-mergetool.sh
355 -SCRIPT_SH += git-mergetool--lib.sh
356 SCRIPT_SH += git-notes.sh
357 -SCRIPT_SH += git-parse-remote.sh
357 SCRIPT_SH += git-pull.sh
358 SCRIPT_SH += git-quiltimport.sh
359 SCRIPT_SH += git-rebase--interactive.sh
360 SCRIPT_SH += git-rebase.sh
361 SCRIPT_SH += git-repack.sh
362 SCRIPT_SH += git-request-pull.sh
364 -SCRIPT_SH += git-sh-setup.sh
363 SCRIPT_SH += git-stash.sh
364 SCRIPT_SH += git-submodule.sh
365 SCRIPT_SH += git-web--browse.sh
366
367 +SCRIPT_LIB += git-mergetool--lib
368 +SCRIPT_LIB += git-parse-remote
369 +SCRIPT_LIB += git-sh-setup
370 +
371 SCRIPT_PERL += git-add--interactive.perl
372 SCRIPT_PERL += git-difftool.perl
373 SCRIPT_PERL += git-archimport.perl
@@ -1454,7 +1456,7 @@ export TAR INSTALL DESTDIR SHELL_PATH
1456
1457 SHELL = $(SHELL_PATH)
1458
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
1460 ifneq (,$X)
1461 $(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';)
1462 endif
@@ -1505,17 +1507,25 @@ common-cmds.h: ./generate-cmdlist.sh command-list.txt
1507 common-cmds.h: $(wildcard Documentation/git-*.txt)
1508 $(QUIET_GEN)./generate-cmdlist.sh > $@+ && mv $@+ $@
1509
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 + $@.sh >$@+
1518 +endef
1519 +
1520 $(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) && \
1522 chmod +x $@+ && \
1523 mv $@+ $@
1524
1525 +$(SCRIPT_LIB) : % : %.sh
1526 + $(QUIET_GEN)$(cmd_munge_script) && \
1527 + mv $@+ $@
1528 +
1529 ifndef NO_PERL
1530 $(patsubst %.perl,%,$(SCRIPT_PERL)): perl/perl.mak
1531
@@ -1866,6 +1876,7 @@ install: all
1876 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
1877 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
1878 $(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
1879 + $(INSTALL) -m 644 $(SCRIPT_LIB) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
1880 $(INSTALL) $(install_bindir_programs) '$(DESTDIR_SQ)$(bindir_SQ)'
1881 $(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
1882 ifndef NO_PERL
@@ -1985,7 +1996,7 @@ distclean: clean
1996 clean:
1997 $(RM) *.o block-sha1/*.o ppc/*.o compat/*.o compat/*/*.o xdiff/*.o \
1998 $(LIB_FILE) $(XDIFF_LIB)
1988 - $(RM) $(ALL_PROGRAMS) $(BUILT_INS) git$X
1999 + $(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
2000 $(RM) $(TEST_PROGRAMS)
2001 $(RM) -r bin-wrappers
2002 $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h TAGS tags cscope*
@@ -2017,7 +2028,7 @@ endif
2028 ### Check documentation
2029 #
2030 check-docs::
2020 - @(for v in $(ALL_PROGRAMS) $(BUILT_INS) git gitk; \
2031 + @(for v in $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git gitk; \
2032 do \
2033 case "$$v" in \
2034 git-merge-octopus | git-merge-ours | git-merge-recursive | \
@@ -2060,9 +2071,12 @@ check-docs::
2071 documented,gitrepository-layout | \
2072 documented,gittutorial | \
2073 documented,gittutorial-2 | \
2074 + documented,git-bisect-lk2009 | \
2075 + documented.git-remote-helpers | \
2076 + documented,gitworkflows | \
2077 sentinel,not,matching,is,ok ) continue ;; \
2078 esac; \
2065 - case " $(ALL_PROGRAMS) $(BUILT_INS) git gitk " in \
2079 + case " $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git gitk " in \
2080 *" $$cmd "*) ;; \
2081 *) echo "removed but $$how: $$cmd" ;; \
2082 esac; \
git-parse-remote.sh
git-sh-setup.sh