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

[PATCH] Makefile: Fix CDPATH problem

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Mar 19, 2010, 23:40 UTC
Message-ID
<20100319234033.GA18035@progeny.tock>
In-Reply-To
<d557014b1003191525m490d1bfam4e8ce40681ff2214@mail.gmail.com>

CDPATH takes scripts to unexpected places. For example, with a CDPATH including a blt directory:

 make -C templates DESTDIR='' install
 make[1]: Entering directory `/users/e477610/exptool/src/git-1.7.0.2/templates'
 install -d -m 755 '/home/e477610/exptool/share/git-core/templates'
 (cd blt && gtar cf - .) | \
	(cd '/home/e477610/exptool/share/git-core/templates' && umask 022 && gtar xof -)
 gtar: This does not look like a tar archive

The CDPATH mechanism does not implicitly add "." at the beginning of CDPATH, which is the most irritating part.

Most git scripts already protect against use of CDPATH through git-sh-setup, but the Makefile doesn’t.

Reported-by: Michael Cox <mhcox@bluezoosoftware.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
I wouldn’t have guessed that.  Thanks, Junio.
Michael Cox wrote:
> That fixed the build problem.  Thank you!
Here’s a patch to prevent it from happening again.
 Makefile |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile
index 4387d42..c1f4161 100644
--- a/Makefile
+++ b/Makefile
@@ -317,6 +317,12 @@ SCRIPT_PYTHON =
 SCRIPT_SH =
 TEST_PROGRAMS =
 
+# Having this variable in your environment would break scripts because
+# you would cause "cd" to be taken to unexpected places.  If you
+# like CDPATH, define it for your interactive shell sessions without
+# exporting it.
+unexport CDPATH
+
 SCRIPT_SH += git-am.sh
 SCRIPT_SH += git-bisect.sh
 SCRIPT_SH += git-difftool--helper.sh
-- 
1.7.0.2.468.g1637
Previous: Michael CoxNext: Junio C Hamano
Message 6 of 8 in “Error building installing on Redhat Linux Server release 5.3 (Tikanga)”
  1. Michael CoxMar 19, 2010
  2. Jonathan NiederMar 19, 2010
  3. Jonathan NiederMar 19, 2010
  4. Michael CoxMar 19, 2010
  5. Michael CoxMar 19, 2010
  6. Makefile: Fix CDPATH problemJonathan Nieder, Mar 19, 2010
  7. Junio C HamanoMar 19, 2010
  8. Makefile: Fix CDPATH problemJonathan Nieder, Mar 20, 2010

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.