git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix cygwin install issues
@ 2005-10-10  8:52 Jonas Fonseca
  2005-10-10  9:03 ` Jonas Fonseca
  2005-10-10  9:09 ` Junio C Hamano
  0 siblings, 2 replies; 9+ messages in thread
From: Jonas Fonseca @ 2005-10-10  8:52 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Support installing to paths including spaces.
Remove any old .exe files so ln will succeed.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>

---

diff --git a/Makefile b/Makefile
index ac384c7..9ae0dfd 100644
--- a/Makefile
+++ b/Makefile
@@ -397,13 +397,13 @@ check:
 ### Installation rules
 
 install: $(PROGRAMS) $(SCRIPTS)
-	$(INSTALL) -d -m755 $(DESTDIR)$(bindir)
-	$(INSTALL) $(PROGRAMS) $(SCRIPTS) $(DESTDIR)$(bindir)
-	$(INSTALL) git-revert $(DESTDIR)$(bindir)/git-cherry-pick
-	sh ./cmd-rename.sh $(DESTDIR)$(bindir)
+	$(INSTALL) -d -m755 "$(DESTDIR)$(bindir)"
+	$(INSTALL) $(PROGRAMS) $(SCRIPTS) "$(DESTDIR)$(bindir)"
+	$(INSTALL) git-revert "$(DESTDIR)$(bindir)/git-cherry-pick"
+	sh ./cmd-rename.sh "$(DESTDIR)$(bindir)" "$X"
 	$(MAKE) -C templates install
-	$(INSTALL) -d -m755 $(DESTDIR)$(GIT_PYTHON_DIR)
-	$(INSTALL) $(PYMODULES) $(DESTDIR)$(GIT_PYTHON_DIR)
+	$(INSTALL) -d -m755 "$(DESTDIR)$(GIT_PYTHON_DIR)"
+	$(INSTALL) $(PYMODULES) "$(DESTDIR)$(GIT_PYTHON_DIR)"
 
 install-doc:
 	$(MAKE) -C Documentation install
diff --git a/cmd-rename.sh b/cmd-rename.sh
index 34e7f49..c9d3171 100755
--- a/cmd-rename.sh
+++ b/cmd-rename.sh
@@ -1,9 +1,10 @@
 #!/bin/sh
 d="$1"
+X="$2"
 test -d "$d" || exit
 while read old new
 do
-	rm -f "$d/$old"
+	rm -f "$d/$old" "$d/$old$X"
 	if test -f "$d/$new"
 	then
 		ln -s "$new" "$d/$old" || exit
-- 
Jonas Fonseca

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

* Re: [PATCH] Fix cygwin install issues
  2005-10-10  8:52 [PATCH] Fix cygwin install issues Jonas Fonseca
@ 2005-10-10  9:03 ` Jonas Fonseca
  2005-10-10  9:09 ` Junio C Hamano
  1 sibling, 0 replies; 9+ messages in thread
From: Jonas Fonseca @ 2005-10-10  9:03 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Jonas Fonseca <fonseca@diku.dk> wrote Mon, Oct 10, 2005:
> Support installing to paths including spaces.
> Remove any old .exe files so ln will succeed.

I see that there are problems in the git porcelain commands that needs
to also be fixed so please ignore this for now.

Instead, is this something that should be supported? (It is quite
absurd, although it is required for 'make install' to work out of the
box on some systems).

-- 
Jonas Fonseca

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

* Re: [PATCH] Fix cygwin install issues
  2005-10-10  8:52 [PATCH] Fix cygwin install issues Jonas Fonseca
  2005-10-10  9:03 ` Jonas Fonseca
@ 2005-10-10  9:09 ` Junio C Hamano
  2005-10-10  9:26   ` [PATCH] git.sh: quote all paths Jonas Fonseca
  2005-10-10 15:02   ` [PATCH] Fix cygwin install issues H. Peter Anvin
  1 sibling, 2 replies; 9+ messages in thread
From: Junio C Hamano @ 2005-10-10  9:09 UTC (permalink / raw)
  To: Jonas Fonseca; +Cc: git

Jonas Fonseca <fonseca@diku.dk> writes:

> Support installing to paths including spaces.
> Remove any old .exe files so ln will succeed.
>

This is not a complaint but I am just wondering if:

> -	$(INSTALL) -d -m755 $(DESTDIR)$(bindir)
> +	$(INSTALL) -d -m755 "$(DESTDIR)$(bindir)"

this is the right way to quote things.  I suspect it might be
the responsibility of the user to quote them if she chooses to
set bindir or DESTDIR to a funky value, like this:

    $ make bindir="'My Documents\Programs'"

Because depending on how funky the values of bindir and DESTDIR
are, we cannot say double-quote you are giving them is even the
right quoting (think double-quote itself as part of the name).

The other "$X" change to cmd-renames is a good change (I thought
I heard HPA talking about that; maybe he sent one to me and I
dropped it on the floor by mistake, I dunno).  Thanks.

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

* [PATCH] git.sh: quote all paths
  2005-10-10  9:09 ` Junio C Hamano
@ 2005-10-10  9:26   ` Jonas Fonseca
  2005-10-10  9:32     ` Jonas Fonseca
  2005-10-10 15:02   ` [PATCH] Fix cygwin install issues H. Peter Anvin
  1 sibling, 1 reply; 9+ messages in thread
From: Jonas Fonseca @ 2005-10-10  9:26 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

This makes it handle spaces in paths.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>

---

Junio C Hamano <junkio@cox.net> wrote Mon, Oct 10, 2005:
> Jonas Fonseca <fonseca@diku.dk> writes:
> 
> > Support installing to paths including spaces.
> > Remove any old .exe files so ln will succeed.
> >
> 
> This is not a complaint but I am just wondering if:
> 
> > -	$(INSTALL) -d -m755 $(DESTDIR)$(bindir)
> > +	$(INSTALL) -d -m755 "$(DESTDIR)$(bindir)"
> 
> this is the right way to quote things.  I suspect it might be
> the responsibility of the user to quote them if she chooses to
> set bindir or DESTDIR to a funky value, like this:
> 
>     $ make bindir="'My Documents\Programs'"
> 
> Because depending on how funky the values of bindir and DESTDIR
> are, we cannot say double-quote you are giving them is even the
> right quoting (think double-quote itself as part of the name).

Yeah, ok, it could end up very wrong. I hope that this patch is
acceptable. I've tested it lightly, and the core commands seems to work,
there might be other git scripts that needs to be changed.

> The other "$X" change to cmd-renames is a good change (I thought
> I heard HPA talking about that; maybe he sent one to me and I
> dropped it on the floor by mistake, I dunno).  Thanks.

I also sent a 'disguised' patch in <20051005131631.GA9442@diku.dk> ...

---
diff --git a/git.sh b/git.sh
index 7400c16..19f89d8 100755
--- a/git.sh
+++ b/git.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 cmd=
-path=$(dirname $0)
+path=$(dirname "$0")
 case "$#" in
 0)	;;
 *)	cmd="$1"
@@ -12,13 +12,13 @@ case "$#" in
 		exit 0 ;;
 	esac
 	
-	test -x $path/git-$cmd && exec $path/git-$cmd "$@"
+	test -x "$path/git-$cmd" && exec "$path/git-$cmd" "$@"
 	
 	case '@@X@@' in
 	    '')
 		;;
 	    *)
-		test -x $path/git-$cmd@@X@@ && exec $path/git-$cmd@@X@@ "$@"
+		test -x "$path/git-$cmd.exe" && exec "$path/git-$cmd.exe" "$@"
 		;;
 	esac
 	;;
-- 
Jonas Fonseca

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

* [PATCH] git.sh: quote all paths
  2005-10-10  9:26   ` [PATCH] git.sh: quote all paths Jonas Fonseca
@ 2005-10-10  9:32     ` Jonas Fonseca
  0 siblings, 0 replies; 9+ messages in thread
From: Jonas Fonseca @ 2005-10-10  9:32 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

This makes it handle spaces in paths.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>

---

Sorry I am so sloppy: s/.exe/@@X@@/ ...

diff --git a/git.sh b/git.sh
index 7400c16..b424055 100755
--- a/git.sh
+++ b/git.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 cmd=
-path=$(dirname $0)
+path=$(dirname "$0")
 case "$#" in
 0)	;;
 *)	cmd="$1"
@@ -12,13 +12,13 @@ case "$#" in
 		exit 0 ;;
 	esac
 	
-	test -x $path/git-$cmd && exec $path/git-$cmd "$@"
+	test -x "$path/git-$cmd" && exec "$path/git-$cmd" "$@"
 	
 	case '@@X@@' in
 	    '')
 		;;
 	    *)
-		test -x $path/git-$cmd@@X@@ && exec $path/git-$cmd@@X@@ "$@"
+		test -x "$path/git-$cmd.exe" && exec "$path/git-$cmd@@X@@" "$@"
 		;;
 	esac
 	;;
-- 
Jonas Fonseca

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

* Re: [PATCH] Fix cygwin install issues
  2005-10-10  9:09 ` Junio C Hamano
  2005-10-10  9:26   ` [PATCH] git.sh: quote all paths Jonas Fonseca
@ 2005-10-10 15:02   ` H. Peter Anvin
  2005-10-10 16:51     ` Junio C Hamano
  1 sibling, 1 reply; 9+ messages in thread
From: H. Peter Anvin @ 2005-10-10 15:02 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jonas Fonseca, git

Junio C Hamano wrote:
> Jonas Fonseca <fonseca@diku.dk> writes:
> 
> 
>>Support installing to paths including spaces.
>>Remove any old .exe files so ln will succeed.
>>
> 
> This is not a complaint but I am just wondering if:
> 
> 
>>-	$(INSTALL) -d -m755 $(DESTDIR)$(bindir)
>>+	$(INSTALL) -d -m755 "$(DESTDIR)$(bindir)"
> 
> this is the right way to quote things.  I suspect it might be
> the responsibility of the user to quote them if she chooses to
> set bindir or DESTDIR to a funky value, like this:
> 
>     $ make bindir="'My Documents\Programs'"

I don't think that's the right approach.

	$(INSTALL) -d -m755 '$(DESTDIR)$(bindir)'

... at least handles everything except embedded single quotes.  Note 
that the single quote is not a special character for make.

> Because depending on how funky the values of bindir and DESTDIR
> are, we cannot say double-quote you are giving them is even the
> right quoting (think double-quote itself as part of the name).
> 
> The other "$X" change to cmd-renames is a good change (I thought
> I heard HPA talking about that; maybe he sent one to me and I
> dropped it on the floor by mistake, I dunno).  Thanks.

If I dropped it on the floor, it was mentally :-/

	-hpa

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

* Re: [PATCH] Fix cygwin install issues
  2005-10-10 15:02   ` [PATCH] Fix cygwin install issues H. Peter Anvin
@ 2005-10-10 16:51     ` Junio C Hamano
  2005-10-10 17:09       ` H. Peter Anvin
  0 siblings, 1 reply; 9+ messages in thread
From: Junio C Hamano @ 2005-10-10 16:51 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: git

"H. Peter Anvin" <hpa@zytor.com> writes:

>> ...  I suspect it might be
>> the responsibility of the user to quote them if she chooses to
>> set bindir or DESTDIR to a funky value, like this:
>>     $ make bindir="'My Documents\Programs'"
>
> I don't think that's the right approach.
>
> 	$(INSTALL) -d -m755 '$(DESTDIR)$(bindir)'
>
> ... at least handles everything except embedded single quotes.

OK.  It is better than dq, and the user can still work it around
like this if she really wanted to:

	make bindir="Anna'\\''s Home/bin"

I wish we had $(shellquote $(DESTDIR)$(bindir)) in make ;-).

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

* Re: [PATCH] Fix cygwin install issues
  2005-10-10 16:51     ` Junio C Hamano
@ 2005-10-10 17:09       ` H. Peter Anvin
  2005-10-10 20:52         ` Deal with $(bindir) and friends with whitespaces Junio C Hamano
  0 siblings, 1 reply; 9+ messages in thread
From: H. Peter Anvin @ 2005-10-10 17:09 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Junio C Hamano wrote:
> 
> OK.  It is better than dq, and the user can still work it around
> like this if she really wanted to:
> 
> 	make bindir="Anna'\\''s Home/bin"
> 
> I wish we had $(shellquote $(DESTDIR)$(bindir)) in make ;-).

Hmm... let's think about this for a second...

shellquote = '$(subst ','\'',$(1))'

$(call shellquote,$(whatever))

... seems to work just fine.

(No need to worry about ! since Make commands are always /bin/sh.)

	-hpa

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

* Deal with $(bindir) and friends with whitespaces.
  2005-10-10 17:09       ` H. Peter Anvin
@ 2005-10-10 20:52         ` Junio C Hamano
  0 siblings, 0 replies; 9+ messages in thread
From: Junio C Hamano @ 2005-10-10 20:52 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: git

... using HPA's shellquote macro.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---

 I only tested that this passes "Anna's Home" test:

	make	HOME="/tmp/Anna's Home" \
		PERL_PATH="Anna's Home/Program Directory/perl"  \
		PYTHON_PATH="Anna's Home/Program Directory/python" \
		test install

 Makefile               |   34 ++++++++++++++++++++--------------
 git-merge-recursive.py |    2 +-
 t/Makefile             |    8 +++++++-
 templates/Makefile     |   10 ++++++++--
 4 files changed, 36 insertions(+), 18 deletions(-)

applies-to: a35b27b04d18022ea4731941ea2a1bedce998092
8f77be8002b9e254ccb5cc3ed3ad1b9240289f7c
diff --git a/Makefile b/Makefile
index ac384c7..f7eee47 100644
--- a/Makefile
+++ b/Makefile
@@ -163,6 +163,12 @@ LIB_OBJS = \
 LIBS = $(LIB_FILE)
 LIBS += -lz
 
+# Shell quote;
+# Result of this needs to be placed inside ''
+shq = $(subst ','\'',$(1))
+# This has surrounding ''
+shellquote = '$(call shq,$(1))'
+
 #
 # Platform specific tweaks
 #
@@ -235,7 +241,7 @@ ifndef NO_OPENSSL
 		OPENSSL_LINK =
 	endif
 else
-	DEFINES += '-DNO_OPENSSL'
+	DEFINES += -DNO_OPENSSL
 	MOZILLA_SHA1 = 1
 	OPENSSL_LIBSSL =
 endif
@@ -294,7 +300,7 @@ endif
 endif
 endif
 
-DEFINES += '-DSHA1_HEADER=$(SHA1_HEADER)'
+DEFINES += -DSHA1_HEADER=$(call shellquote,$(SHA1_HEADER))
 
 SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \
 	  $(patsubst %.perl,%,$(SCRIPT_PERL)) \
@@ -311,7 +317,7 @@ all:
 
 git: git.sh Makefile
 	rm -f $@+ $@
-	sed -e '1s|#!.*/sh|#!$(SHELL_PATH)|' \
+	sed -e '1s|#!.*/sh|#!$(call shq,$(SHELL_PATH))|' \
 	    -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
 	    -e 's/@@X@@/$(X)/g' \
 	    $(GIT_LIST_TWEAK) <$@.sh >$@+
@@ -320,22 +326,22 @@ git: git.sh Makefile
 
 $(filter-out git,$(patsubst %.sh,%,$(SCRIPT_SH))) : % : %.sh
 	rm -f $@
-	sed -e '1s|#!.*/sh|#!$(SHELL_PATH)|' \
+	sed -e '1s|#!.*/sh|#!$(call shq,$(SHELL_PATH))|' \
 	    -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
 	    $@.sh >$@
 	chmod +x $@
 
 $(patsubst %.perl,%,$(SCRIPT_PERL)) : % : %.perl
 	rm -f $@
-	sed -e '1s|#!.*perl|#!$(PERL_PATH)|' \
+	sed -e '1s|#!.*perl|#!$(call shq,$(PERL_PATH))|' \
 	    -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
 	    $@.perl >$@
 	chmod +x $@
 
 $(patsubst %.py,%,$(SCRIPT_PYTHON)) : % : %.py
 	rm -f $@
-	sed -e '1s|#!.*python|#!$(PYTHON_PATH)|' \
-	    -e 's|@@GIT_PYTHON_PATH@@|$(GIT_PYTHON_DIR)|g' \
+	sed -e '1s|#!.*python|#!$(call shq,$(PYTHON_PATH))|' \
+	    -e 's|@@GIT_PYTHON_PATH@@|$(call shq,$(GIT_PYTHON_DIR))|g' \
 	    -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
 	    $@.py >$@
 	chmod +x $@
@@ -365,7 +371,7 @@ git-rev-list$X: LIBS += $(OPENSSL_LIBSSL
 
 init-db.o: init-db.c
 	$(CC) -c $(ALL_CFLAGS) \
-		-DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir)"' $*.c
+		-DDEFAULT_GIT_TEMPLATE_DIR=$(call shellquote,"$(template_dir)") $*.c
 
 $(LIB_OBJS): $(LIB_H)
 $(patsubst git-%$X,%.o,$(PROGRAMS)): $(LIB_H)
@@ -397,13 +403,13 @@ check:
 ### Installation rules
 
 install: $(PROGRAMS) $(SCRIPTS)
-	$(INSTALL) -d -m755 $(DESTDIR)$(bindir)
-	$(INSTALL) $(PROGRAMS) $(SCRIPTS) $(DESTDIR)$(bindir)
-	$(INSTALL) git-revert $(DESTDIR)$(bindir)/git-cherry-pick
-	sh ./cmd-rename.sh $(DESTDIR)$(bindir)
+	$(INSTALL) -d -m755 $(call shellquote,$(DESTDIR)$(bindir))
+	$(INSTALL) $(PROGRAMS) $(SCRIPTS) $(call shellquote,$(DESTDIR)$(bindir))
+	$(INSTALL) git-revert $(call shellquote,$(DESTDIR)$(bindir)/git-cherry-pick)
+	sh ./cmd-rename.sh $(call shellquote,$(DESTDIR)$(bindir))
 	$(MAKE) -C templates install
-	$(INSTALL) -d -m755 $(DESTDIR)$(GIT_PYTHON_DIR)
-	$(INSTALL) $(PYMODULES) $(DESTDIR)$(GIT_PYTHON_DIR)
+	$(INSTALL) -d -m755 $(call shellquote,$(DESTDIR)$(GIT_PYTHON_DIR))
+	$(INSTALL) $(PYMODULES) $(call shellquote,$(DESTDIR)$(GIT_PYTHON_DIR))
 
 install-doc:
 	$(MAKE) -C Documentation install
diff --git a/git-merge-recursive.py b/git-merge-recursive.py
index b80a860..626d854 100755
--- a/git-merge-recursive.py
+++ b/git-merge-recursive.py
@@ -4,7 +4,7 @@ import sys, math, random, os, re, signal
 from heapq import heappush, heappop
 from sets import Set
 
-sys.path.append('@@GIT_PYTHON_PATH@@')
+sys.path.append('''@@GIT_PYTHON_PATH@@''')
 from gitMergeCommon import *
 
 originalIndexFile = os.environ.get('GIT_INDEX_FILE',
diff --git a/t/Makefile b/t/Makefile
index e71da77..5c76aff 100644
--- a/t/Makefile
+++ b/t/Makefile
@@ -7,10 +7,16 @@
 SHELL_PATH ?= $(SHELL)
 TAR ?= $(TAR)
 
+# Shell quote;
+# Result of this needs to be placed inside ''
+shq = $(subst ','\'',$(1))
+# This has surrounding ''
+shellquote = '$(call shq,$(1))'
+
 T = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh)
 
 all:
-	@$(foreach t,$T,echo "*** $t ***"; $(SHELL_PATH) $t $(GIT_TEST_OPTS) || exit; )
+	@$(foreach t,$T,echo "*** $t ***"; $(call shellquote,$(SHELL_PATH)) $t $(GIT_TEST_OPTS) || exit; )
 	@rm -fr trash
 
 clean:
diff --git a/templates/Makefile b/templates/Makefile
index c23aee8..07e928e 100644
--- a/templates/Makefile
+++ b/templates/Makefile
@@ -6,6 +6,12 @@ prefix ?= $(HOME)
 template_dir ?= $(prefix)/share/git-core/templates/
 # DESTDIR=
 
+# Shell quote;
+# Result of this needs to be placed inside ''
+shq = $(subst ','\'',$(1))
+# This has surrounding ''
+shellquote = '$(call shq,$(1))'
+
 all: boilerplates.made custom
 	find blt
 
@@ -38,6 +44,6 @@ clean:
 	rm -rf blt boilerplates.made
 
 install: all
-	$(INSTALL) -d -m755 $(DESTDIR)$(template_dir)
+	$(INSTALL) -d -m755 $(call shellquote,$(DESTDIR)$(template_dir))
 	(cd blt && $(TAR) cf - .) | \
-	(cd $(DESTDIR)$(template_dir) && $(TAR) xf -)
+	(cd $(call shellquote,$(DESTDIR)$(template_dir)) && $(TAR) xf -)
---
0.99.8.GIT

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

end of thread, other threads:[~2005-10-10 20:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-10  8:52 [PATCH] Fix cygwin install issues Jonas Fonseca
2005-10-10  9:03 ` Jonas Fonseca
2005-10-10  9:09 ` Junio C Hamano
2005-10-10  9:26   ` [PATCH] git.sh: quote all paths Jonas Fonseca
2005-10-10  9:32     ` Jonas Fonseca
2005-10-10 15:02   ` [PATCH] Fix cygwin install issues H. Peter Anvin
2005-10-10 16:51     ` Junio C Hamano
2005-10-10 17:09       ` H. Peter Anvin
2005-10-10 20:52         ` Deal with $(bindir) and friends with whitespaces Junio C Hamano

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