From 2dd780aaeeaa422565e5df99f445b9bd4eab226c Mon Sep 17 00:00:00 2001 From: Ngie Cooper Date: Sun, 2 Apr 2017 10:30:19 -0700 Subject: [PATCH 1/4] Fix building/execution on OSX Only define HAS_MKFIFOAT/HAS_MKNODAT if not using OSX. Fixes issue # 5 --- pjdfstest.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pjdfstest.c b/pjdfstest.c index 4c39e28f..aff8d78f 100644 --- a/pjdfstest.c +++ b/pjdfstest.c @@ -96,8 +96,10 @@ #define HAS_FSTATAT #define HAS_LINKAT #define HAS_MKDIRAT +#ifndef __APPLE__ #define HAS_MKFIFOAT #define HAS_MKNODAT +#endif #define HAS_OPENAT #define HAS_READLINKAT #define HAS_RENAMEAT From 75a5d0095666918bdaff3bd89fedfdad3c4be207 Mon Sep 17 00:00:00 2001 From: Ngie Cooper Date: Sun, 2 Apr 2017 10:50:30 -0700 Subject: [PATCH 2/4] Fix get_mountpoint(..) for OSX Print out the last column in the df output, instead of column # 6 --- tests/conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/conf b/tests/conf index 6f7f85db..f51f8f1f 100644 --- a/tests/conf +++ b/tests/conf @@ -13,8 +13,8 @@ unsupported_os() get_mountpoint() { case "${os}" in - FreeBSD|Darwin) - df . | tail -1 | awk '{print $6}' + Darwin|FreeBSD) + df . | tail -1 | awk '{print $NF}' ;; *) unsupported_os From 78c038ecf7d3ab28fc3b242c672e6b9cd1879dd3 Mon Sep 17 00:00:00 2001 From: Ngie Cooper Date: Sun, 2 Apr 2017 11:16:04 -0700 Subject: [PATCH 3/4] Correct the $fs/$mountpoint checks for Darwin This makes pjdfstest work for me on 10.11.6 (El Capitan) --- tests/conf | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/conf b/tests/conf index f51f8f1f..856ebf50 100644 --- a/tests/conf +++ b/tests/conf @@ -23,7 +23,13 @@ get_mountpoint() } case "${os}" in -FreeBSD|Darwin) +Darwin) + GREP=grep + #fs=`df -T . | tail -1 | awk '{print $2}'` + mountpoint="`get_mountpoint`" + fs=`mount | grep "on $mountpoint" | sed -e 's/.*(//' -e 's/,.*//g' | tr '[:lower:]' '[:upper:]'` + ;; +FreeBSD) GREP=grep #fs=`df -T . | tail -1 | awk '{print $2}'` mountpoint="`get_mountpoint`" From b9a5cb6f2e7db9a7187058b9a020510f79fa7728 Mon Sep 17 00:00:00 2001 From: Ngie Cooper Date: Sun, 2 Apr 2017 11:42:21 -0700 Subject: [PATCH 4/4] Fill in the per-OS checks for Darwin Darwin functions like Linux/Solaris, not FreeBSD --- tests/chmod/11.t | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/chmod/11.t b/tests/chmod/11.t index 94c5e5f4..5907f043 100644 --- a/tests/chmod/11.t +++ b/tests/chmod/11.t @@ -63,6 +63,12 @@ for type in regular fifo block char socket symlink; do create_file ${type} ${n1} 0640 65534 65534 expect 0 symlink ${n1} ${n2} case "${os}" in + Darwin) + expect 0 -u 65534 -g 65534 chmod ${n1} 01644 + expect 01644 stat ${n1} mode + expect 0 -u 65534 -g 65534 chmod ${n2} 01640 + expect 01640 stat ${n1} mode + ;; FreeBSD) expect EFTYPE -u 65534 -g 65534 chmod ${n1} 01644 expect 0640 stat ${n1} mode @@ -93,6 +99,10 @@ for type in regular fifo block char socket symlink; do if supported lchmod; then create_file ${type} ${n1} 0640 65534 65534 case "${os}" in + Darwin) + expect 0 -u 65534 -g 65534 lchmod ${n1} 01644 + expect 01644 lstat ${n1} mode + ;; FreeBSD) expect EFTYPE -u 65534 -g 65534 lchmod ${n1} 01644 expect 0640 lstat ${n1} mode