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

Re: [PATCH] diff: "S_IFREG | 0644" to "(S_IFREG | 0644)" to avoid warning

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Oct 4, 2010, 10:35 UTC
Message-ID
<20101004103550.GA4738@burratino>
In-Reply-To
<AANLkTim+QH6=XJikOsZs=qt9ZFHjP7gWz0zo9n4vz+gk@mail.gmail.com>
Ævar Arnfjörð Bjarmason wrote:
Show 5 quoted lines
> But tests on NetBSD with /bin/sh still fail since we use cd -P, but we
> have unapplied patches for that so I didn't pursue it:
> 
>     http://article.gmane.org/gmane.comp.version-control.git/136561/match=
>     http://article.gmane.org/gmane.comp.version-control.git/136562/match=
Aren't these v1.7.0-rc0~76^2 and v1.7.0-rc0~76^2^?

Here's a patch for the more important of the remaining problems. I'm just guessing here; untested, of course.

-- 8< --
Subject: tests: use pwd -P to simulate cd -P for portability

NetBSD supports pwd -P but not cd -P. POSIX has required both for a while, so this should not be an issue for most Unix-like platforms.

The test harness uses cd -P to ensure $PWD and $(pwd) agree; cd $(pwd -P) should do that, too.

If pwd -P fails on some platform, with this patch, the test harness will die with 'FATAL: Unexpected exit with code 1'.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 t/test-lib.sh |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 830e5e7..184bf84 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -916,9 +916,10 @@ rm -fr "$test" || {
 }
 
 test_create_repo "$test"
-# Use -P to resolve symlinks in our working directory so that the cwd
-# in subprocesses like git equals our $PWD (for pathname comparisons).
-cd -P "$test" || exit 1
+cd "$test" || exit 1
+# Resolve symlinks in our working directory so that the cwd in
+# subprocesses like git equals our $PWD (for pathname comparisons).
+dir=$(pwd -P) && cd "$dir" || exit 1
 
 HOME=$(pwd)
 export HOME
-- 
1.7.2.3
Previous: Ævar Arnfjörð BjarmasonNext: Jonathan Nieder
Message 7 of 13 in “diff: "S_IFREG | 0644" to "(S_IFREG | 0644)" to avoid warning”
  1. diff: "S_IFREG | 0644" to "(S_IFREG | 0644)" to avoid warningÆvar Arnfjörð Bjarmason, Oct 4, 2010
  2. Jonathan NiederOct 4, 2010
  3. Ævar Arnfjörð BjarmasonOct 4, 2010
  4. Junio C HamanoOct 4, 2010
  5. cache.h: work around broken NetBSD system headersÆvar Arnfjörð Bjarmason, Oct 4, 2010
  6. Ævar Arnfjörð BjarmasonOct 4, 2010
  7. Jonathan NiederOct 4, 2010
  8. Jonathan NiederOct 4, 2010
  9. René ScharfeOct 4, 2010
  10. Matthieu MoyOct 4, 2010
  11. Junio C HamanoOct 4, 2010
  12. René ScharfeOct 4, 2010
  13. yj2133011Oct 4, 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.