summaryrefslogtreecommitdiff
path: root/t/t1308-config-set.sh
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2017-05-03 10:16:48 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-05-26 03:33:55 (GMT)
commite2d90fd1c33ae57e4a6da5729ae53876107b3463 (patch)
tree791930780c62dfb945dd262f1a2c2692d3f9a68e /t/t1308-config-set.sh
parent02912f477586befaf46e0db4f7c47b52081d5b6d (diff)
downloadgit-e2d90fd1c33ae57e4a6da5729ae53876107b3463.zip
git-e2d90fd1c33ae57e4a6da5729ae53876107b3463.tar.gz
git-e2d90fd1c33ae57e4a6da5729ae53876107b3463.tar.bz2
config.mak.uname: set FREAD_READS_DIRECTORIES for Linux and FreeBSD
This variable is added [1] with the assumption that on a sane system, fopen(<dir>, "r") should return NULL. Linux and FreeBSD do not meet this expectation while at least Windows and AIX do. Let's make sure they behave the same way. I only tested one version on Linux (4.7.0 with glibc 2.22) and FreeBSD (11.0) but since GNU/kFreeBSD is fbsd kernel with gnu userspace, I'm pretty sure it shares the same problem. [1] cba22528fa (Add compat/fopen.c which returns NULL on attempt to open directory - 2008-02-08) Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1308-config-set.sh')
-rwxr-xr-xt/t1308-config-set.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/t/t1308-config-set.sh b/t/t1308-config-set.sh
index ff50960..72d5f1f 100755
--- a/t/t1308-config-set.sh
+++ b/t/t1308-config-set.sh
@@ -183,6 +183,14 @@ test_expect_success 'proper error on non-existent files' '
test_cmp expect actual
'
+test_expect_success 'proper error on directory "files"' '
+ echo "Error (-1) reading configuration file a-directory." >expect &&
+ mkdir a-directory &&
+ test_expect_code 2 test-config configset_get_value foo.bar a-directory 2>output &&
+ grep "^Error" output >actual &&
+ test_cmp expect actual
+'
+
test_expect_success POSIXPERM,SANITY 'proper error on non-accessible files' '
chmod -r .git/config &&
test_when_finished "chmod +r .git/config" &&