summaryrefslogtreecommitdiff
path: root/t/t0001-init.sh
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2021-07-30 16:18:14 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-07-30 17:18:27 (GMT)
commit482e1488a9b549cbf7466f4ee5396f93bb4588d6 (patch)
treeafadb2266db0663f43774c5548fcd094d1b831a2 /t/t0001-init.sh
parentebf3c04b262aa27fbb97f8a0156c2347fecafafb (diff)
downloadgit-482e1488a9b549cbf7466f4ee5396f93bb4588d6.zip
git-482e1488a9b549cbf7466f4ee5396f93bb4588d6.tar.gz
git-482e1488a9b549cbf7466f4ee5396f93bb4588d6.tar.bz2
t0001: fix broken not-quite getcwd(3) test in bed67874e2
With a54e938e5b (strbuf: support long paths w/o read rights in strbuf_getcwd() on FreeBSD, 2017-03-26) we had t0001 break on systems like OpenBSD and AIX whose getcwd(3) has standard (but not like glibc et al) behavior. This was partially fixed in bed67874e2 (t0001: skip test with restrictive permissions if getpwd(3) respects them, 2017-08-07). The problem with that fix is that while its analysis of the problem is correct, it doesn't actually call getcwd(3), instead it invokes "pwd -P". There is no guarantee that "pwd -P" is going to call getcwd(3), as opposed to e.g. being a shell built-in. On AIX under both bash and ksh this test breaks because "pwd -P" will happily display the current working directory, but getcwd(3) called by the "git init" we're testing here will fail to get it. I checked whether clobbering the $PWD environment variable would affect it, and it didn't. Presumably these shells keep track of their working directory internally. There's possible follow-up work here in teaching strbuf_getcwd() to get the working directory with whatever method "pwd" uses on these platforms. See [1] for a discussion of that, but let's take the easy way out here and just skip these tests by fixing the GETCWD_IGNORES_PERMS prerequisite to match the limitations of strbuf_getcwd(). 1. https://lore.kernel.org/git/b650bef5-d739-d98d-e9f1-fa292b6ce982@web.de/ Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t0001-init.sh')
-rwxr-xr-xt/t0001-init.sh5
1 files changed, 4 insertions, 1 deletions
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index acd662e..df544bb 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -356,7 +356,10 @@ test_lazy_prereq GETCWD_IGNORES_PERMS '
chmod 100 $base ||
BUG "cannot prepare $base"
- (cd $base/dir && /bin/pwd -P)
+ (
+ cd $base/dir &&
+ test-tool getcwd
+ )
status=$?
chmod 700 $base &&