diff --git a/cbits/HsUnix.c b/cbits/HsUnix.c
--- a/cbits/HsUnix.c
+++ b/cbits/HsUnix.c
@@ -36,9 +36,9 @@
  * GNU glibc 2.23 and later deprecate `readdir_r` in favour of plain old
  * `readdir` which in some upcoming POSIX standard is going to required to be
  * re-entrant.
- * Eventually we want to drop `readder_r` all together, but want to be
+ * Eventually we want to drop `readdir_r` all together, but want to be
  * compatible with older unixen which may not have a re-entrant `readdir`.
- * Solution is to make systems with *known* re-entrant `readir` use that and use
+ * Solution is to make systems with *known* re-entrant `readdir` use that and use
  * `readdir_r` wherever we have it and don't *know* that `readdir` is
  * re-entrant.
  */
@@ -106,7 +106,7 @@
 
 char __hscore_d_type( struct dirent* d )
 {
-#ifdef HAVE_DIRENT_D_TYPE
+#ifdef HAVE_STRUCT_DIRENT_D_TYPE
   return (d->d_type);
 #else
   return CONST_DT_UNKNOWN;
diff --git a/changelog.md b/changelog.md
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,9 @@
 # Changelog for [`unix` package](http://hackage.haskell.org/package/unix)
 
+## 2.8.8.0 *May 2025*
+
+  * fix `dirEntType` always returning `UnknownType` wrt [#347](https://github.com/haskell/unix/issues/347) by @sjshuck
+
 ## 2.8.7.0 *May 2025*
 
   * Add portable support for file open with data caching supressed/eliminated wrt [#322](https://github.com/haskell/unix/issues/322)
diff --git a/config.guess b/config.guess
--- a/config.guess
+++ b/config.guess
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
-#   Copyright 1992-2023 Free Software Foundation, Inc.
+#   Copyright 1992-2022 Free Software Foundation, Inc.
 
 # shellcheck disable=SC2006,SC2268 # see below for rationale
 
-timestamp='2023-08-22'
+timestamp='2022-05-25'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -47,7 +47,7 @@
 usage="\
 Usage: $0 [OPTION]
 
-Output the configuration name of the system '$me' is run on.
+Output the configuration name of the system \`$me' is run on.
 
 Options:
   -h, --help         print this help, then exit
@@ -60,13 +60,13 @@
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright 1992-2023 Free Software Foundation, Inc.
+Copyright 1992-2022 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
 
 help="
-Try '$me --help' for more information."
+Try \`$me --help' for more information."
 
 # Parse command line
 while test $# -gt 0 ; do
@@ -102,8 +102,8 @@
 # temporary files to be created and, as you can see below, it is a
 # headache to deal with in a portable fashion.
 
-# Historically, 'CC_FOR_BUILD' used to be named 'HOST_CC'. We still
-# use 'HOST_CC' if defined, but it is deprecated.
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
 
 # Portable tmp directory creation inspired by the Autoconf team.
 
@@ -155,9 +155,6 @@
 
 	set_cc_for_build
 	cat <<-EOF > "$dummy.c"
-	#if defined(__ANDROID__)
-	LIBC=android
-	#else
 	#include <features.h>
 	#if defined(__UCLIBC__)
 	LIBC=uclibc
@@ -172,7 +169,6 @@
 	LIBC=musl
 	#endif
 	#endif
-	#endif
 	EOF
 	cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
 	eval "$cc_set_libc"
@@ -463,7 +459,7 @@
 		UNAME_RELEASE=`uname -v`
 		;;
 	esac
-	# Japanese Language versions have a version number like '4.1.3-JL'.
+	# Japanese Language versions have a version number like `4.1.3-JL'.
 	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
 	GUESS=sparc-sun-sunos$SUN_REL
 	;;
@@ -908,7 +904,7 @@
 	fi
 	;;
     *:FreeBSD:*:*)
-	UNAME_PROCESSOR=`uname -p`
+	UNAME_PROCESSOR=`/usr/bin/uname -p`
 	case $UNAME_PROCESSOR in
 	    amd64)
 		UNAME_PROCESSOR=x86_64 ;;
@@ -970,37 +966,11 @@
 	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
 	GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
 	;;
-    x86_64:[Mm]anagarm:*:*|i?86:[Mm]anagarm:*:*)
-	GUESS="$UNAME_MACHINE-pc-managarm-mlibc"
-	;;
-    *:[Mm]anagarm:*:*)
-	GUESS="$UNAME_MACHINE-unknown-managarm-mlibc"
-	;;
     *:Minix:*:*)
 	GUESS=$UNAME_MACHINE-unknown-minix
 	;;
     aarch64:Linux:*:*)
-	set_cc_for_build
-	CPU=$UNAME_MACHINE
-	LIBCABI=$LIBC
-	if test "$CC_FOR_BUILD" != no_compiler_found; then
-	    ABI=64
-	    sed 's/^	    //' << EOF > "$dummy.c"
-	    #ifdef __ARM_EABI__
-	    #ifdef __ARM_PCS_VFP
-	    ABI=eabihf
-	    #else
-	    ABI=eabi
-	    #endif
-	    #endif
-EOF
-	    cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'`
-	    eval "$cc_set_abi"
-	    case $ABI in
-		eabi | eabihf) CPU=armv8l; LIBCABI=$LIBC$ABI ;;
-	    esac
-	fi
-	GUESS=$CPU-unknown-linux-$LIBCABI
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
 	;;
     aarch64_be:Linux:*:*)
 	UNAME_MACHINE=aarch64_be
@@ -1066,16 +1036,7 @@
     k1om:Linux:*:*)
 	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
 	;;
-    kvx:Linux:*:*)
-	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
-	;;
-    kvx:cos:*:*)
-	GUESS=$UNAME_MACHINE-unknown-cos
-	;;
-    kvx:mbr:*:*)
-	GUESS=$UNAME_MACHINE-unknown-mbr
-	;;
-    loongarch32:Linux:*:* | loongarch64:Linux:*:*)
+    loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*)
 	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
 	;;
     m32r*:Linux:*:*)
@@ -1230,7 +1191,7 @@
 	GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
 	;;
     i*86:OS/2:*:*)
-	# If we were able to find 'uname', then EMX Unix compatibility
+	# If we were able to find `uname', then EMX Unix compatibility
 	# is probably installed.
 	GUESS=$UNAME_MACHINE-pc-os2-emx
 	;;
@@ -1371,7 +1332,7 @@
 		GUESS=ns32k-sni-sysv
 	fi
 	;;
-    PENTIUM:*:4.0*:*)	# Unisys 'ClearPath HMP IX 4000' SVR4/MP effort
+    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
 			# says <Richard.M.Bartel@ccMail.Census.GOV>
 	GUESS=i586-unisys-sysv4
 	;;
diff --git a/config.sub b/config.sub
--- a/config.sub
+++ b/config.sub
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Configuration validation subroutine script.
-#   Copyright 1992-2023 Free Software Foundation, Inc.
+#   Copyright 1992-2022 Free Software Foundation, Inc.
 
 # shellcheck disable=SC2006,SC2268 # see below for rationale
 
-timestamp='2023-09-19'
+timestamp='2022-01-03'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -76,13 +76,13 @@
 version="\
 GNU config.sub ($timestamp)
 
-Copyright 1992-2023 Free Software Foundation, Inc.
+Copyright 1992-2022 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
 
 help="
-Try '$me --help' for more information."
+Try \`$me --help' for more information."
 
 # Parse command line
 while test $# -gt 0 ; do
@@ -130,7 +130,7 @@
 # Separate into logical components for further validation
 case $1 in
 	*-*-*-*-*)
-		echo "Invalid configuration '$1': more than four components" >&2
+		echo Invalid configuration \`"$1"\': more than four components >&2
 		exit 1
 		;;
 	*-*-*-*)
@@ -145,8 +145,7 @@
 			nto-qnx* | linux-* | uclinux-uclibc* \
 			| uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \
 			| netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \
-			| storm-chaos* | os2-emx* | rtmk-nova* | managarm-* \
-			| windows-* )
+			| storm-chaos* | os2-emx* | rtmk-nova*)
 				basic_machine=$field1
 				basic_os=$maybe_os
 				;;
@@ -944,7 +943,7 @@
 EOF
 		IFS=$saved_IFS
 		;;
-	# We use 'pc' rather than 'unknown'
+	# We use `pc' rather than `unknown'
 	# because (1) that's what they normally are, and
 	# (2) the word "unknown" tends to confuse beginning users.
 	i*86 | x86_64)
@@ -1076,7 +1075,7 @@
 	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
 		cpu=i586
 		;;
-	pentiumpro-* | p6-* | 6x86-* | athlon-* | athlon_*-*)
+	pentiumpro-* | p6-* | 6x86-* | athlon-* | athalon_*-*)
 		cpu=i686
 		;;
 	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
@@ -1181,7 +1180,7 @@
 		case $cpu in
 			1750a | 580 \
 			| a29k \
-			| aarch64 | aarch64_be | aarch64c | arm64ec \
+			| aarch64 | aarch64_be \
 			| abacus \
 			| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \
 			| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \
@@ -1191,7 +1190,7 @@
 			| arc | arceb | arc32 | arc64 \
 			| arm | arm[lb]e | arme[lb] | armv* \
 			| avr | avr32 \
-			| asmjs \
+			| asmjs | javascript \
 			| ba \
 			| be32 | be64 \
 			| bfin | bpf | bs2000 \
@@ -1200,23 +1199,45 @@
 			| d10v | d30v | dlx | dsp16xx \
 			| e2k | elxsi | epiphany \
 			| f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \
-			| javascript \
 			| h8300 | h8500 \
 			| hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
 			| hexagon \
 			| i370 | i*86 | i860 | i960 | ia16 | ia64 \
 			| ip2k | iq2000 \
 			| k1om \
-			| kvx \
 			| le32 | le64 \
 			| lm32 \
-			| loongarch32 | loongarch64 \
+			| loongarch32 | loongarch64 | loongarchx32 \
 			| m32c | m32r | m32rle \
 			| m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \
 			| m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \
 			| m88110 | m88k | maxq | mb | mcore | mep | metag \
 			| microblaze | microblazeel \
-			| mips* \
+			| mips | mipsbe | mipseb | mipsel | mipsle \
+			| mips16 \
+			| mips64 | mips64eb | mips64el \
+			| mips64octeon | mips64octeonel \
+			| mips64orion | mips64orionel \
+			| mips64r5900 | mips64r5900el \
+			| mips64vr | mips64vrel \
+			| mips64vr4100 | mips64vr4100el \
+			| mips64vr4300 | mips64vr4300el \
+			| mips64vr5000 | mips64vr5000el \
+			| mips64vr5900 | mips64vr5900el \
+			| mipsisa32 | mipsisa32el \
+			| mipsisa32r2 | mipsisa32r2el \
+			| mipsisa32r3 | mipsisa32r3el \
+			| mipsisa32r5 | mipsisa32r5el \
+			| mipsisa32r6 | mipsisa32r6el \
+			| mipsisa64 | mipsisa64el \
+			| mipsisa64r2 | mipsisa64r2el \
+			| mipsisa64r3 | mipsisa64r3el \
+			| mipsisa64r5 | mipsisa64r5el \
+			| mipsisa64r6 | mipsisa64r6el \
+			| mipsisa64sb1 | mipsisa64sb1el \
+			| mipsisa64sr71k | mipsisa64sr71kel \
+			| mipsr5900 | mipsr5900el \
+			| mipstx39 | mipstx39el \
 			| mmix \
 			| mn10200 | mn10300 \
 			| moxie \
@@ -1264,7 +1285,7 @@
 				;;
 
 			*)
-				echo "Invalid configuration '$1': machine '$cpu-$vendor' not recognized" 1>&2
+				echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2
 				exit 1
 				;;
 		esac
@@ -1285,12 +1306,11 @@
 
 # Decode manufacturer-specific aliases for certain operating systems.
 
-if test x"$basic_os" != x
+if test x$basic_os != x
 then
 
 # First recognize some ad-hoc cases, or perhaps split kernel-os, or else just
 # set os.
-obj=
 case $basic_os in
 	gnu/linux*)
 		kernel=linux
@@ -1321,10 +1341,6 @@
 		kernel=linux
 		os=`echo "$basic_os" | sed -e 's|linux|gnu|'`
 		;;
-	managarm*)
-		kernel=managarm
-		os=`echo "$basic_os" | sed -e 's|managarm|mlibc|'`
-		;;
 	*)
 		kernel=
 		os=$basic_os
@@ -1490,16 +1506,10 @@
 			os=eabi
 			;;
 		    *)
-			os=
-			obj=elf
+			os=elf
 			;;
 		esac
 		;;
-	aout* | coff* | elf* | pe*)
-		# These are machine code file formats, not OSes
-		obj=$os
-		os=
-		;;
 	*)
 		# No normalization, but not necessarily accepted, that comes below.
 		;;
@@ -1518,15 +1528,12 @@
 # system, and we'll never get to this point.
 
 kernel=
-obj=
 case $cpu-$vendor in
 	score-*)
-		os=
-		obj=elf
+		os=elf
 		;;
 	spu-*)
-		os=
-		obj=elf
+		os=elf
 		;;
 	*-acorn)
 		os=riscix1.2
@@ -1536,35 +1543,28 @@
 		os=gnu
 		;;
 	arm*-semi)
-		os=
-		obj=aout
+		os=aout
 		;;
 	c4x-* | tic4x-*)
-		os=
-		obj=coff
+		os=coff
 		;;
 	c8051-*)
-		os=
-		obj=elf
+		os=elf
 		;;
 	clipper-intergraph)
 		os=clix
 		;;
 	hexagon-*)
-		os=
-		obj=elf
+		os=elf
 		;;
 	tic54x-*)
-		os=
-		obj=coff
+		os=coff
 		;;
 	tic55x-*)
-		os=
-		obj=coff
+		os=coff
 		;;
 	tic6x-*)
-		os=
-		obj=coff
+		os=coff
 		;;
 	# This must come before the *-dec entry.
 	pdp10-*)
@@ -1586,24 +1586,19 @@
 		os=sunos3
 		;;
 	m68*-cisco)
-		os=
-		obj=aout
+		os=aout
 		;;
 	mep-*)
-		os=
-		obj=elf
+		os=elf
 		;;
 	mips*-cisco)
-		os=
-		obj=elf
+		os=elf
 		;;
 	mips*-*)
-		os=
-		obj=elf
+		os=elf
 		;;
 	or32-*)
-		os=
-		obj=coff
+		os=coff
 		;;
 	*-tti)	# must be before sparc entry or we get the wrong os.
 		os=sysv3
@@ -1612,8 +1607,7 @@
 		os=sunos4.1.1
 		;;
 	pru-*)
-		os=
-		obj=elf
+		os=elf
 		;;
 	*-be)
 		os=beos
@@ -1694,12 +1688,10 @@
 		os=uxpv
 		;;
 	*-rom68k)
-		os=
-		obj=coff
+		os=coff
 		;;
 	*-*bug)
-		os=
-		obj=coff
+		os=coff
 		;;
 	*-apple)
 		os=macos
@@ -1717,10 +1709,13 @@
 
 fi
 
-# Now, validate our (potentially fixed-up) individual pieces (OS, OBJ).
-
+# Now, validate our (potentially fixed-up) OS.
 case $os in
-	# Sometimes we do "kernel-libc", so those need to count as OSes.
+        # GHC specific: added for JS backend support
+        js | ghcjs)
+                ;;
+
+	# Sometimes we do "kernel-abi", so those need to count as OSes.
 	musl* | newlib* | relibc* | uclibc*)
 		;;
 	# Likewise for "kernel-abi"
@@ -1729,9 +1724,6 @@
 	# VxWorks passes extra cpu info in the 4th filed.
 	simlinux | simwindows | spe)
 		;;
-	# See `case $cpu-$os` validation below
-	ghcjs)
-		;;
 	# Now accept the basic system types.
 	# The portable systems comes first.
 	# Each alternative MUST end in a * to match a version number.
@@ -1740,7 +1732,7 @@
 	     | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
 	     | sym* |  plan9* | psp* | sim* | xray* | os68k* | v88r* \
 	     | hiux* | abug | nacl* | netware* | windows* \
-	     | os9* | macos* | osx* | ios* | tvos* | watchos* \
+	     | os9* | macos* | osx* | ios* \
 	     | mpw* | magic* | mmixware* | mon960* | lnews* \
 	     | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
 	     | aos* | aros* | cloudabi* | sortix* | twizzler* \
@@ -1749,11 +1741,11 @@
 	     | mirbsd* | netbsd* | dicos* | openedition* | ose* \
 	     | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \
 	     | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \
-	     | bosx* | nextstep* | cxux* | oabi* \
-	     | ptx* | ecoff* | winnt* | domain* | vsta* \
+	     | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \
+	     | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \
 	     | udi* | lites* | ieee* | go32* | aux* | hcos* \
 	     | chorusrdb* | cegcc* | glidix* | serenity* \
-	     | cygwin* | msys* | moss* | proelf* | rtems* \
+	     | cygwin* | msys* | pe* | moss* | proelf* | rtems* \
 	     | midipix* | mingw32* | mingw64* | mint* \
 	     | uxpv* | beos* | mpeix* | udk* | moxiebox* \
 	     | interix* | uwin* | mks* | rhapsody* | darwin* \
@@ -1766,7 +1758,7 @@
 	     | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
 	     | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
 	     | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \
-	     | fiwix* | mlibc* | cos* | mbr* )
+	     | fiwix* )
 		;;
 	# This one is extra strict with allowed versions
 	sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
@@ -1774,99 +1766,41 @@
 		;;
 	none)
 		;;
-	kernel* | msvc* )
-		# Restricted further below
-		;;
-	'')
-		if test x"$obj" = x
-		then
-			echo "Invalid configuration '$1': Blank OS only allowed with explicit machine code file format" 1>&2
-		fi
-		;;
 	*)
-		echo "Invalid configuration '$1': OS '$os' not recognized" 1>&2
-		exit 1
-		;;
-esac
-
-case $obj in
-	aout* | coff* | elf* | pe*)
-		;;
-	'')
-		# empty is fine
-		;;
-	*)
-		echo "Invalid configuration '$1': Machine code format '$obj' not recognized" 1>&2
-		exit 1
-		;;
-esac
-
-# Here we handle the constraint that a (synthetic) cpu and os are
-# valid only in combination with each other and nowhere else.
-case $cpu-$os in
-	# The "javascript-unknown-ghcjs" triple is used by GHC; we
-	# accept it here in order to tolerate that, but reject any
-	# variations.
-	javascript-ghcjs)
-		;;
-	javascript-* | *-ghcjs)
-		echo "Invalid configuration '$1': cpu '$cpu' is not valid with os '$os$obj'" 1>&2
+		echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2
 		exit 1
 		;;
 esac
 
 # As a final step for OS-related things, validate the OS-kernel combination
 # (given a valid OS), if there is a kernel.
-case $kernel-$os-$obj in
-	linux-gnu*- | linux-dietlibc*- | linux-android*- | linux-newlib*- \
-		   | linux-musl*- | linux-relibc*- | linux-uclibc*- | linux-mlibc*- )
-		;;
-	uclinux-uclibc*- )
-		;;
-	managarm-mlibc*- | managarm-kernel*- )
+case $kernel-$os in
+	linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \
+		   | linux-musl* | linux-relibc* | linux-uclibc* )
 		;;
-	windows*-msvc*-)
+	uclinux-uclibc* )
 		;;
-	-dietlibc*- | -newlib*- | -musl*- | -relibc*- | -uclibc*- | -mlibc*- )
+	-dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* )
 		# These are just libc implementations, not actual OSes, and thus
 		# require a kernel.
-		echo "Invalid configuration '$1': libc '$os' needs explicit kernel." 1>&2
-		exit 1
-		;;
-	-kernel*- )
-		echo "Invalid configuration '$1': '$os' needs explicit kernel." 1>&2
-		exit 1
-		;;
-	*-kernel*- )
-		echo "Invalid configuration '$1': '$kernel' does not support '$os'." 1>&2
-		exit 1
-		;;
-	*-msvc*- )
-		echo "Invalid configuration '$1': '$os' needs 'windows'." 1>&2
+		echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2
 		exit 1
 		;;
-	kfreebsd*-gnu*- | kopensolaris*-gnu*-)
-		;;
-	vxworks-simlinux- | vxworks-simwindows- | vxworks-spe-)
+	kfreebsd*-gnu* | kopensolaris*-gnu*)
 		;;
-	nto-qnx*-)
+	vxworks-simlinux | vxworks-simwindows | vxworks-spe)
 		;;
-	os2-emx-)
+	nto-qnx*)
 		;;
-	*-eabi*- | *-gnueabi*-)
+	os2-emx)
 		;;
-	none--*)
-		# None (no kernel, i.e. freestanding / bare metal),
-		# can be paired with an machine code file format
+	*-eabi* | *-gnueabi*)
 		;;
-	-*-)
+	-*)
 		# Blank kernel with real OS is always fine.
 		;;
-	--*)
-		# Blank kernel and OS with real machine code file format is always fine.
-		;;
-	*-*-*)
-		echo "Invalid configuration '$1': Kernel '$kernel' not known to work with OS '$os'." 1>&2
+	*-*)
+		echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2
 		exit 1
 		;;
 esac
@@ -1949,7 +1883,7 @@
 		;;
 esac
 
-echo "$cpu-$vendor${kernel:+-$kernel}${os:+-$os}${obj:+-$obj}"
+echo "$cpu-$vendor-${kernel:+$kernel-}$os"
 exit
 
 # Local variables:
diff --git a/tests/DirEnt.hsc b/tests/DirEnt.hsc
new file mode 100644
--- /dev/null
+++ b/tests/DirEnt.hsc
@@ -0,0 +1,38 @@
+{-# LANGUAGE LambdaCase #-}
+
+#include "HsUnixConfig.h"
+
+module Main (main) where
+#if !defined(HAVE_STRUCT_DIRENT_D_TYPE)
+main :: IO ()
+main = do
+    putStrLn "Skipping DirEnt test, since the system doesn't support d_type"
+#else
+
+import Control.Exception                (bracket, finally)
+import Foreign.C.String                 (peekCString)
+import System.Exit
+import System.Posix.Directory
+import System.Posix.Directory.Internals
+
+peekDirEnt :: DirEnt -> IO (String, DirType)
+peekDirEnt dirEnt = do
+    dName <- dirEntName dirEnt >>= peekCString
+    dType <- dirEntType dirEnt
+    return (dName, dType)
+
+testDirTypeOfDot :: DirStream -> IO ()
+testDirTypeOfDot dirStream = go where
+    go = readDirStreamWith peekDirEnt dirStream >>= \case
+        Just (".", DirectoryType) -> do
+            putStrLn "Got DirectoryType for . dir"
+            exitSuccess
+        Just (".", dType) -> die $ "Got " ++ show dType ++ " for . dir!"
+        Just _ -> go
+        Nothing -> die "Read cwd in Haskell and didn't find . dir!"
+
+main :: IO ()
+main = do
+    putStrLn "Running Haskell test of dirEntType"
+    bracket (openDirStream ".") closeDirStream testDirTypeOfDot
+#endif
diff --git a/unix.cabal b/unix.cabal
--- a/unix.cabal
+++ b/unix.cabal
@@ -1,6 +1,6 @@
 cabal-version:  1.12
 name:           unix
-version:        2.8.7.0
+version:        2.8.8.0
 -- NOTE: Don't forget to update ./changelog.md
 
 license:        BSD3
@@ -53,6 +53,11 @@
   default: False
   manual: False
 
+flag non-portable-tests
+  description: Run tests that may not be portable across all systems, but are guaranteed to succeed in our own CI
+  default: False
+  manual: True
+
 source-repository head
     type:     git
     location: https://github.com/haskell/unix.git
@@ -77,9 +82,9 @@
         buildable: False
 
     build-depends:
-        base        >= 4.12.0.0  && < 4.22,
+        base        >= 4.12.0.0  && < 4.23,
         bytestring  >= 0.9.2     && < 0.13,
-        time        >= 1.9.1     && < 1.15
+        time        >= 1.9.1     && < 1.16
 
     if flag(os-string)
       build-depends: filepath >= 1.5.0.0, os-string >= 2.0.0
@@ -382,3 +387,15 @@
     else
       build-depends: filepath >= 1.4.100.0 && < 1.5.0.0
     ghc-options: -Wall
+
+test-suite DirEnt
+    hs-source-dirs: tests
+    main-is: DirEnt.hs
+    type: exitcode-stdio-1.0
+    default-language: Haskell2010
+    build-depends: base, unix
+    ghc-options: -Wall
+    if !flag(non-portable-tests)
+        build-depends: unbuildable<0
+        buildable: False
+
