git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Use SHELL_PATH from build system in run_command.c:prepare_shell_cmd

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 31, 2012, 18:04 UTC
Message-ID
<7vwr60ir3q.fsf@alter.siamese.dyndns.org>
In-Reply-To
<7v62dkk6dl.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 15 quoted lines
> Jonathan Nieder <jrnieder@gmail.com> writes:
> ...
>> -run-command.o: EXTRA_CPPFLAGS = -DSHELL_PATH='"$(SHELL_PATH_SQ)"'
>> +run-command.sp run-command.s run-command.o: EXTRA_CPPFLAGS = \
>> +	'-DSHELL_PATH="$(SHELL_PATH_SQ)"'
>>  
>>  $(BUILT_INS): git$X
>>  	$(QUIET_BUILT_IN)$(RM) $@ && \
>
> Actually, I do not think this is sufficient, and it happens that you and I
> are in the best position to realize it ;-).
>
> Look at what is done in the Makefile for DEFAULT_EDITOR and DEFAULT_PAGER,
> and compare with what the above is doing, and think why the EDITOR/PAGER
> needs to have another level of quoting.
In other words, something like this squashed into Ben's patch...
diff --git i/Makefile w/Makefile
index dea1f15..abee43e 100644
--- i/Makefile
+++ w/Makefile
@@ -1849,6 +1849,13 @@ DEFAULT_PAGER_CQ_SQ = $(subst ','\'',$(DEFAULT_PAGER_CQ))
 BASIC_CFLAGS += -DDEFAULT_PAGER='$(DEFAULT_PAGER_CQ_SQ)'
 endif
 
+ifdef SHELL_PATH
+SHELL_PATH_CQ = "$(subst ",\",$(subst \,\\,$(SHELL_PATH)))"
+SHELL_PATH_CQ_SQ = $(subst ','\'',$(SHELL_PATH_CQ))
+
+BASIC_CFLAGS += -DSHELL_PATH='$(SHELL_PATH_CQ_SQ)'
+endif
+
 ALL_CFLAGS += $(BASIC_CFLAGS)
 ALL_LDFLAGS += $(BASIC_LDFLAGS)
 
@@ -1913,8 +1920,6 @@ builtin/help.sp builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \
 	'-DGIT_MAN_PATH="$(mandir_SQ)"' \
 	'-DGIT_INFO_PATH="$(infodir_SQ)"'
 
-run-command.o: EXTRA_CPPFLAGS = -DSHELL_PATH='"$(SHELL_PATH_SQ)"'
-
 $(BUILT_INS): git$X
 	$(QUIET_BUILT_IN)$(RM) $@ && \
 	ln git$X $@ 2>/dev/null || \
Previous: Junio C HamanoNext: Johannes Sixt
Message 6 of 16 in “Use SHELL_PATH from build system in run_command.c:prepare_shell_cmd”
  1. Use SHELL_PATH from build system in run_command.c:prepare_shell_cmdBen Walton, Mar 31, 2012
  2. Jonathan NiederMar 31, 2012
  3. Junio C HamanoMar 31, 2012
  4. Jonathan NiederMar 31, 2012
  5. Junio C HamanoMar 31, 2012
  6. Junio C HamanoMar 31, 2012
  7. Do not use SHELL_PATH from build system in prepare_shell_cmd on WindowsJohannes Sixt, Apr 17, 2012
  8. Ben WaltonApr 17, 2012
  9. Johannes SixtApr 17, 2012
  10. Ben WaltonApr 17, 2012
  11. Jeff KingApr 17, 2012
  12. Johannes SixtApr 18, 2012
  13. Jeff KingApr 18, 2012
  14. Junio C HamanoApr 18, 2012
  15. Johannes SixtApr 19, 2012
  16. Junio C HamanoApr 19, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.