threads / patch / 8555

patchAvoid double-slash in path names that depend on $(sharedir).

Subject: [PATCH] Avoid double-slash in path names that depend on $(sharedir).

## tl;dr

3 messages between Jun 11, 2007 and Jun 11, 2007. Diffs are folded; open one to read it.

replies: 2people: 2as markdown or json

Johannes Sixt· Jun 11, 2007, 08:02 UTC · lore

Recent git-gui has the ability to determine the location of its library files relative to the --exec-dir. Its Makefile enables this capability depending on the install paths that are specified. However, without this fix there is an extra slash in a path specification, so that the Makefile does not recognize the equivalence of two paths that it compares.

A side-effect is that all "standard" builds (which do not set $(sharedir) explicitly) now exploit above mentioned gut-gui feature.

Another side-effect is that an ugly compiled-in double-slash in $(template_dir) is avoided.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
---
 Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Show changes to Makefile +1 −1
diff --git a/Makefile b/Makefile
index af84af9..c23031c 100644
--- a/Makefile
+++ b/Makefile
@@ -144,7 +144,7 @@ STRIP ?= strip
 prefix = $(HOME)
 bindir = $(prefix)/bin
 gitexecdir = $(bindir)
-sharedir = $(prefix)/share/
+sharedir = $(prefix)/share
 template_dir = $(sharedir)/git-core/templates/
 ifeq ($(prefix),/usr)
 sysconfdir = /etc
-- 
1.5.2.1.120.gd732
Junio C Hamano· Jun 11, 2007, 08:18 UTC · re: Johannes Sixt · lore

Re: [PATCH] Avoid double-slash in path names that depend on $(sharedir).

Johannes Sixt <johannes.sixt@telecom.at> writes:
Show 13 quoted lines
> diff --git a/Makefile b/Makefile
> index af84af9..c23031c 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -144,7 +144,7 @@ STRIP ?= strip
>  prefix = $(HOME)
>  bindir = $(prefix)/bin
>  gitexecdir = $(bindir)
> -sharedir = $(prefix)/share/
> +sharedir = $(prefix)/share
>  template_dir = $(sharedir)/git-core/templates/
>  ifeq ($(prefix),/usr)
>  sysconfdir = /etc

This suggests that we would also want to drop the trailing slash from template_dir, doesn't it?

I took a brief look at builtin-init-db.c but it seems that the code is safe with or without the trailing slash there.

Johannes Sixt· Jun 11, 2007, 09:10 UTC · re: Junio C Hamano · lore

Re: [PATCH] Avoid double-slash in path names that depend on $(sharedir).

Junio C Hamano wrote:
Show 22 quoted lines
> 
> Johannes Sixt <johannes.sixt@telecom.at> writes:
> 
> > diff --git a/Makefile b/Makefile
> > index af84af9..c23031c 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -144,7 +144,7 @@ STRIP ?= strip
> >  prefix = $(HOME)
> >  bindir = $(prefix)/bin
> >  gitexecdir = $(bindir)
> > -sharedir = $(prefix)/share/
> > +sharedir = $(prefix)/share
> >  template_dir = $(sharedir)/git-core/templates/
> >  ifeq ($(prefix),/usr)
> >  sysconfdir = /etc
> 
> This suggests that we would also want to drop the trailing slash
> from template_dir, doesn't it?
> 
> I took a brief look at builtin-init-db.c but it seems that the
> code is safe with or without the trailing slash there.

It amounts to this on top of my other patch. It's not worth it, if you ask me.

--- 8< ---
From: Johannes Sixt <johannes.sixt@telecom.at>
Subject: [PATCH] Remove trailing slash from $(template_dir).

This is just a consistency cleanup. sharedir is defined a line above template_dir and doesn't have the trailing slash, either.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
---
 Makefile           |    2 +-
 builtin-init-db.c  |    2 +-
 templates/Makefile |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
Show changes to 3 files +3 −3

Makefile, builtin-init-db.c, templates/Makefile

diff --git a/Makefile b/Makefile
index c23031c..7091a4b 100644
--- a/Makefile
+++ b/Makefile
@@ -145,7 +145,7 @@ prefix = $(HOME)
 bindir = $(prefix)/bin
 gitexecdir = $(bindir)
 sharedir = $(prefix)/share
-template_dir = $(sharedir)/git-core/templates/
+template_dir = $(sharedir)/git-core/templates
 ifeq ($(prefix),/usr)
 sysconfdir = /etc
 else
diff --git a/builtin-init-db.c b/builtin-init-db.c
index 4df9fd0..0be2d2e 100644
--- a/builtin-init-db.c
+++ b/builtin-init-db.c
@@ -7,7 +7,7 @@
 #include "builtin.h"
 
 #ifndef DEFAULT_GIT_TEMPLATE_DIR
-#define DEFAULT_GIT_TEMPLATE_DIR "/usr/share/git-core/templates/"
+#define DEFAULT_GIT_TEMPLATE_DIR "/usr/share/git-core/templates"
 #endif
 
 #ifdef NO_TRUSTABLE_FILEMODE
diff --git a/templates/Makefile b/templates/Makefile
index b8352e7..aaa39d3 100644
--- a/templates/Makefile
+++ b/templates/Makefile
@@ -7,7 +7,7 @@ endif
 INSTALL ?= install
 TAR ?= tar
 prefix ?= $(HOME)
-template_dir ?= $(prefix)/share/git-core/templates/
+template_dir ?= $(prefix)/share/git-core/templates
 # DESTDIR=
 
 # Shell quote (do not use $(call) to accommodate ancient setups);
-- 
1.5.2.1.176.g7084-dirty

← back to recent threads