From 6d29e0ed981d97f6aef5688bde8bad986f57a828 Mon Sep 17 00:00:00 2001
From: Julian Ospald <hasufell@posteo.de>
Date: Tue, 19 Nov 2024 23:30:07 +0800
Subject: [PATCH 01/10] Add missing changelog entry

---
 changelog.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/changelog.md b/changelog.md
index b344f42..9cdbc05 100644
--- a/changelog.md
+++ b/changelog.md
@@ -3,6 +3,7 @@
 ## 2.8.6.0 *Nov 2024*
 
   * add `readDirStreamWith` and `readDirStreamWithPtr` to `System.Posix.Directory.Internals` wrt [#251](https://github.com/haskell/unix/pull/251)
+  * Fix CTimeVal definition for platforms where time_t isn't CLong, wrt [#252](https://github.com/haskell/unix/pull/252)
 
 ## 2.8.5.1 *Apr 2024*
 

From 061733be820cfaf2ad2131a87e01ec1b8d08edf0 Mon Sep 17 00:00:00 2001
From: Andreas Abel <andreas.abel@ifi.lmu.de>
Date: Tue, 19 Nov 2024 20:44:37 +0100
Subject: [PATCH 02/10] CI: try centos:9 container

---
 .github/workflows/ci.yml | 16 ++++++++--------
 .gitignore               |  2 ++
 cabal.haskell-ci         | 13 -------------
 3 files changed, 10 insertions(+), 21 deletions(-)
 delete mode 100644 cabal.haskell-ci

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index a84e917..c57ab57 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -15,8 +15,8 @@ jobs:
     strategy:
       fail-fast: true
       matrix:
-        os: [ubuntu-22.04, macOS-latest]
-        ghc: ['9.8', '9.6', '9.4', '9.2', '9.0', '8.10', '8.8', '8.6']
+        os: [ubuntu-24.04, macOS-latest]
+        ghc: ['9.10', '9.8', '9.6', '9.4', '9.2', '9.0', '8.10', '8.8', '8.6']
         exclude:
           - os: macos-latest
             ghc: '9.0'
@@ -42,7 +42,8 @@ jobs:
         path: |
           ~/.cabal/store
           dist-newstyle
-        key: ${{ runner.os }}-${{ matrix.ghc }}
+        key: ${{ runner.os }}-${{ matrix.ghc }}-${{ github.sha }}
+        restore-keys: ${{ runner.os }}-${{ matrix.ghc }}-
     - name: Build
       run: |
         . ~/.ghcup/env
@@ -61,16 +62,15 @@ jobs:
         cabal haddock --disable-documentation
 
   centos7:
-    runs-on: ubuntu-latest
+    runs-on: ubuntu-24.04
     container:
-      image: centos:7
+      image: centos:9
     steps:
     - name: Install
       run: |
         yum install -y gcc gmp gmp-devel make ncurses ncurses-compat-libs xz perl autoconf
-        curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_GHC_VERSION=9.2.8 sh
-    - uses: actions/checkout@v3
-        # actions/checkout@v4 (using node20) does not run on image: centos:7
+        curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_GHC_VERSION=9.4.8 sh
+    - uses: actions/checkout@v4
     - name: Test
       run: |
         source ~/.ghcup/env
diff --git a/.gitignore b/.gitignore
index 1abc4c0..b9644ab 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,6 +16,8 @@ dist-newstyle/
 ghc.mk
 include/HsUnixConfig.h
 include/HsUnixConfig.h.in
+.stack-work/
+stack*.yaml.lock
 unix.buildinfo
 tests/.hpc.*
 tests/*.eventlog
diff --git a/cabal.haskell-ci b/cabal.haskell-ci
deleted file mode 100644
index 6726f15..0000000
--- a/cabal.haskell-ci
+++ /dev/null
@@ -1,13 +0,0 @@
-unconstrained: False
-
-constraint-set bytestring-0.11
-  ghc: == 8.10.2
-  constraints: bytestring >=0.11 && <0.12
-
-constraint-set time-1.10
-  ghc: == 8.8.4
-  constraints: time >=1.10 && <1.11
-
-constraint-set time-1.11
-  ghc: == 8.6.5
-  constraints: time >=1.11 && <1.12

From 15f3bf88537371b55eeec6bf1bd7700682b0b397 Mon Sep 17 00:00:00 2001
From: Andreas Abel <andreas.abel@ifi.lmu.de>
Date: Tue, 19 Nov 2024 21:04:31 +0100
Subject: [PATCH 03/10] CI: try redhat/ubi9:latest instead of centos:7

---
 .github/workflows/ci.yml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index c57ab57..efb979c 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -61,10 +61,10 @@ jobs:
         . ~/.ghcup/env
         cabal haddock --disable-documentation
 
-  centos7:
+  redhat-ubi9:
     runs-on: ubuntu-24.04
     container:
-      image: centos:9
+      image: redhat/ubi9:latest
     steps:
     - name: Install
       run: |
@@ -110,7 +110,7 @@ jobs:
         apt-get update -y
         apt-get install -y autoconf build-essential zlib1g-dev libgmp-dev curl
         curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_INSTALL_NO_STACK=1 sh
-    - uses: actions/checkout@v1
+    - uses: actions/checkout@v4
     - name: Test
       run: |
         source ~/.ghcup/env

From 0f188d53f7c1726236c9a611ede9467d2b6d1f46 Mon Sep 17 00:00:00 2001
From: Andreas Abel <andreas.abel@ifi.lmu.de>
Date: Tue, 19 Nov 2024 21:13:56 +0100
Subject: [PATCH 04/10] CI: redhat/ubi9 does not have ncurses-compat-libs

---
 .github/workflows/ci.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index efb979c..20464fe 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -68,7 +68,7 @@ jobs:
     steps:
     - name: Install
       run: |
-        yum install -y gcc gmp gmp-devel make ncurses ncurses-compat-libs xz perl autoconf
+        yum install -y gcc gmp gmp-devel make ncurses xz perl autoconf
         curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_GHC_VERSION=9.4.8 sh
     - uses: actions/checkout@v4
     - name: Test
@@ -110,7 +110,7 @@ jobs:
         apt-get update -y
         apt-get install -y autoconf build-essential zlib1g-dev libgmp-dev curl
         curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_INSTALL_NO_STACK=1 sh
-    - uses: actions/checkout@v4
+    - uses: actions/checkout@v3
     - name: Test
       run: |
         source ~/.ghcup/env

From a735ac06c680a549f15dd88529b6cffca79529bb Mon Sep 17 00:00:00 2001
From: Andreas Abel <andreas.abel@ifi.lmu.de>
Date: Tue, 19 Nov 2024 21:15:59 +0100
Subject: [PATCH 05/10] CI: temporarily disable some workflows

---
 ...wasm32-wasi.yml => ci-wasm32-wasi.yml-off} |   0
 .github/workflows/ci.yml                      | 232 +++++++++---------
 2 files changed, 116 insertions(+), 116 deletions(-)
 rename .github/workflows/{ci-wasm32-wasi.yml => ci-wasm32-wasi.yml-off} (100%)

diff --git a/.github/workflows/ci-wasm32-wasi.yml b/.github/workflows/ci-wasm32-wasi.yml-off
similarity index 100%
rename from .github/workflows/ci-wasm32-wasi.yml
rename to .github/workflows/ci-wasm32-wasi.yml-off
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 20464fe..996d8eb 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,7 +1,7 @@
 name: ci
 on:
-  push:
-  pull_request:
+  push:         { branches: [master] }
+  pull_request: { branches: [master] }
   schedule:
     - cron: 0 0 * * *
 
@@ -10,56 +10,56 @@ defaults:
     shell: bash
 
 jobs:
-  build:
-    runs-on: ${{ matrix.os }}
-    strategy:
-      fail-fast: true
-      matrix:
-        os: [ubuntu-24.04, macOS-latest]
-        ghc: ['9.10', '9.8', '9.6', '9.4', '9.2', '9.0', '8.10', '8.8', '8.6']
-        exclude:
-          - os: macos-latest
-            ghc: '9.0'
-          - os: macos-latest
-            ghc: '8.10'
-          - os: macos-latest
-            ghc: '8.8'
-          - os: macos-latest
-            ghc: '8.6'
-    steps:
-    - uses: actions/checkout@v4
-    - name: Setup toolchain
-      run: |
-        curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_INSTALL_NO_STACK=1 BOOTSTRAP_HASKELL_GHC_VERSION=${{ matrix.ghc }} BOOTSTRAP_HASKELL_ADJUST_BASHRC=yes sh
+  # build:
+  #   runs-on: ${{ matrix.os }}
+  #   strategy:
+  #     fail-fast: true
+  #     matrix:
+  #       os: [ubuntu-24.04, macOS-latest]
+  #       ghc: ['9.10', '9.8', '9.6', '9.4', '9.2', '9.0', '8.10', '8.8', '8.6']
+  #       exclude:
+  #         - os: macos-latest
+  #           ghc: '9.0'
+  #         - os: macos-latest
+  #           ghc: '8.10'
+  #         - os: macos-latest
+  #           ghc: '8.8'
+  #         - os: macos-latest
+  #           ghc: '8.6'
+  #   steps:
+  #   - uses: actions/checkout@v4
+  #   - name: Setup toolchain
+  #     run: |
+  #       curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_INSTALL_NO_STACK=1 BOOTSTRAP_HASKELL_GHC_VERSION=${{ matrix.ghc }} BOOTSTRAP_HASKELL_ADJUST_BASHRC=yes sh
 
-    - if: runner.os == 'macOS'
-      name: Install system deps via brew
-      run: brew install coreutils autoconf automake
+  #   - if: runner.os == 'macOS'
+  #     name: Install system deps via brew
+  #     run: brew install coreutils autoconf automake
 
-    - uses: actions/cache@v4
-      name: Cache cabal stuff
-      with:
-        path: |
-          ~/.cabal/store
-          dist-newstyle
-        key: ${{ runner.os }}-${{ matrix.ghc }}-${{ github.sha }}
-        restore-keys: ${{ runner.os }}-${{ matrix.ghc }}-
-    - name: Build
-      run: |
-        . ~/.ghcup/env
-        ghc --version
-        cabal --version
-        cabal update
-        autoreconf --version
-        autoreconf -i
-        cabal sdist -z -o .
-        cabal get unix-*.tar.gz
-        cd unix-*/
-        cabal test all --test-show-details=direct
-    - name: Haddock
-      run: |
-        . ~/.ghcup/env
-        cabal haddock --disable-documentation
+  #   - uses: actions/cache@v4
+  #     name: Cache cabal stuff
+  #     with:
+  #       path: |
+  #         ~/.cabal/store
+  #         dist-newstyle
+  #       key: ${{ runner.os }}-${{ matrix.ghc }}-${{ github.sha }}
+  #       restore-keys: ${{ runner.os }}-${{ matrix.ghc }}-
+  #   - name: Build
+  #     run: |
+  #       . ~/.ghcup/env
+  #       ghc --version
+  #       cabal --version
+  #       cabal update
+  #       autoreconf --version
+  #       autoreconf -i
+  #       cabal sdist -z -o .
+  #       cabal get unix-*.tar.gz
+  #       cd unix-*/
+  #       cabal test all --test-show-details=direct
+  #   - name: Haddock
+  #     run: |
+  #       . ~/.ghcup/env
+  #       cabal haddock --disable-documentation
 
   redhat-ubi9:
     runs-on: ubuntu-24.04
@@ -80,25 +80,25 @@ jobs:
         autoreconf -i
         cabal test all --test-show-details=direct
 
-  fedora37:
-    runs-on: ubuntu-latest
-    container:
-      image: fedora:37
-    steps:
-    - name: Install
-      run: |
-        dnf install -y gcc gmp gmp-devel make ncurses ncurses-compat-libs xz perl autoconf
-        curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 sh
-    - uses: actions/checkout@v4
-    - name: Test
-      run: |
-        source ~/.ghcup/env
-        cabal --version
-        cabal update
-        autoreconf --version
-        autoreconf -i
-        # test filepath >= 1.5
-        cabal test --constraint='filepath >= 1.5.0.0' all --test-show-details=direct
+  # fedora37:
+  #   runs-on: ubuntu-latest
+  #   container:
+  #     image: fedora:37
+  #   steps:
+  #   - name: Install
+  #     run: |
+  #       dnf install -y gcc gmp gmp-devel make ncurses ncurses-compat-libs xz perl autoconf
+  #       curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 sh
+  #   - uses: actions/checkout@v4
+  #   - name: Test
+  #     run: |
+  #       source ~/.ghcup/env
+  #       cabal --version
+  #       cabal update
+  #       autoreconf --version
+  #       autoreconf -i
+  #       # test filepath >= 1.5
+  #       cabal test --constraint='filepath >= 1.5.0.0' all --test-show-details=direct
 
   i386:
     runs-on: ubuntu-latest
@@ -120,55 +120,55 @@ jobs:
         autoreconf -i
         cabal v2-test --constraint 'optparse-applicative -process' --constraint 'QuickCheck +old-random' --constraint 'tasty -unix' all
 
-  arm:
-    runs-on: [self-hosted, Linux, ARM64]
-    strategy:
-      fail-fast: false
-      matrix:
-        arch: [arm32v7, arm64v8]
-    steps:
-      - uses: docker://hasufell/arm64v8-ubuntu-haskell:focal
-        name: Cleanup
-        with:
-          args: "find . -mindepth 1 -maxdepth 1 -exec rm -rf -- {} +"
+  # arm:
+  #   runs-on: [self-hosted, Linux, ARM64]
+  #   strategy:
+  #     fail-fast: false
+  #     matrix:
+  #       arch: [arm32v7, arm64v8]
+  #   steps:
+  #     - uses: docker://hasufell/arm64v8-ubuntu-haskell:focal
+  #       name: Cleanup
+  #       with:
+  #         args: "find . -mindepth 1 -maxdepth 1 -exec rm -rf -- {} +"
 
-      - name: Checkout code
-        uses: actions/checkout@v4
+  #     - name: Checkout code
+  #       uses: actions/checkout@v4
 
-      - if: matrix.arch == 'arm32v7'
-        uses: docker://hasufell/arm32v7-ubuntu-haskell:focal
-        name: Run build (arm32v7 linux)
-        with:
-          args: sh -c "cabal update && autoreconf -i && cabal test all --test-show-details=direct"
+  #     - if: matrix.arch == 'arm32v7'
+  #       uses: docker://hasufell/arm32v7-ubuntu-haskell:focal
+  #       name: Run build (arm32v7 linux)
+  #       with:
+  #         args: sh -c "cabal update && autoreconf -i && cabal test all --test-show-details=direct"
 
-      - if: matrix.arch == 'arm64v8'
-        uses: docker://hasufell/arm64v8-ubuntu-haskell:focal
-        name: Run build (arm64v8 linux)
-        with:
-          args: sh -c "cabal update && autoreconf -i && cabal test all --test-show-details=direct"
+  #     - if: matrix.arch == 'arm64v8'
+  #       uses: docker://hasufell/arm64v8-ubuntu-haskell:focal
+  #       name: Run build (arm64v8 linux)
+  #       with:
+  #         args: sh -c "cabal update && autoreconf -i && cabal test all --test-show-details=direct"
 
-  freebsd:
-    runs-on: ${{ matrix.os }}
-    strategy:
-      fail-fast: false
-      matrix:
-        include:
-          - os: [self-hosted, FreeBSD, X64]
-            ghc: 9.4
-          - os: [self-hosted, FreeBSD, X64]
-            ghc: 9.6
-    steps:
-      - name: Checkout code
-        uses: actions/checkout@v4
+  # freebsd:
+  #   runs-on: ${{ matrix.os }}
+  #   strategy:
+  #     fail-fast: false
+  #     matrix:
+  #       include:
+  #         - os: [self-hosted, FreeBSD, X64]
+  #           ghc: 9.4
+  #         - os: [self-hosted, FreeBSD, X64]
+  #           ghc: 9.6
+  #   steps:
+  #     - name: Checkout code
+  #       uses: actions/checkout@v4
 
-      - name: Run build
-        run: |
-          pkg install -y curl gcc gmp gmake ncurses perl5 libffi libiconv git bash misc/compat10x misc/compat11x misc/compat12x gmake autoconf
-          . .github/scripts/env.sh
-          curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_INSTALL_NO_STACK=1 BOOTSTRAP_HASKELL_GHC_VERSION=${{ matrix.ghc }} BOOTSTRAP_HASKELL_ADJUST_BASHRC=yes sh
-          autoreconf --version
-          autoreconf -i
-          cabal sdist -z -o .
-          cabal get unix-*.tar.gz
-          cd unix-*/
-          cabal test all --test-show-details=direct
+  #     - name: Run build
+  #       run: |
+  #         pkg install -y curl gcc gmp gmake ncurses perl5 libffi libiconv git bash misc/compat10x misc/compat11x misc/compat12x gmake autoconf
+  #         . .github/scripts/env.sh
+  #         curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_INSTALL_NO_STACK=1 BOOTSTRAP_HASKELL_GHC_VERSION=${{ matrix.ghc }} BOOTSTRAP_HASKELL_ADJUST_BASHRC=yes sh
+  #         autoreconf --version
+  #         autoreconf -i
+  #         cabal sdist -z -o .
+  #         cabal get unix-*.tar.gz
+  #         cd unix-*/
+  #         cabal test all --test-show-details=direct

From 93fe466226641ab57b2ba14935d3d1709cd292ef Mon Sep 17 00:00:00 2001
From: Andreas Abel <andreas.abel@ifi.lmu.de>
Date: Tue, 19 Nov 2024 21:23:03 +0100
Subject: [PATCH 06/10] Revert "CI: temporarily disable some workflows"

This reverts commit e530dcb77d3de0a5b7bf6c163b7456f6341f5ebf.
---
 ...wasm32-wasi.yml-off => ci-wasm32-wasi.yml} |   0
 .github/workflows/ci.yml                      | 232 +++++++++---------
 2 files changed, 116 insertions(+), 116 deletions(-)
 rename .github/workflows/{ci-wasm32-wasi.yml-off => ci-wasm32-wasi.yml} (100%)

diff --git a/.github/workflows/ci-wasm32-wasi.yml-off b/.github/workflows/ci-wasm32-wasi.yml
similarity index 100%
rename from .github/workflows/ci-wasm32-wasi.yml-off
rename to .github/workflows/ci-wasm32-wasi.yml
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 996d8eb..20464fe 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,7 +1,7 @@
 name: ci
 on:
-  push:         { branches: [master] }
-  pull_request: { branches: [master] }
+  push:
+  pull_request:
   schedule:
     - cron: 0 0 * * *
 
@@ -10,56 +10,56 @@ defaults:
     shell: bash
 
 jobs:
-  # build:
-  #   runs-on: ${{ matrix.os }}
-  #   strategy:
-  #     fail-fast: true
-  #     matrix:
-  #       os: [ubuntu-24.04, macOS-latest]
-  #       ghc: ['9.10', '9.8', '9.6', '9.4', '9.2', '9.0', '8.10', '8.8', '8.6']
-  #       exclude:
-  #         - os: macos-latest
-  #           ghc: '9.0'
-  #         - os: macos-latest
-  #           ghc: '8.10'
-  #         - os: macos-latest
-  #           ghc: '8.8'
-  #         - os: macos-latest
-  #           ghc: '8.6'
-  #   steps:
-  #   - uses: actions/checkout@v4
-  #   - name: Setup toolchain
-  #     run: |
-  #       curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_INSTALL_NO_STACK=1 BOOTSTRAP_HASKELL_GHC_VERSION=${{ matrix.ghc }} BOOTSTRAP_HASKELL_ADJUST_BASHRC=yes sh
+  build:
+    runs-on: ${{ matrix.os }}
+    strategy:
+      fail-fast: true
+      matrix:
+        os: [ubuntu-24.04, macOS-latest]
+        ghc: ['9.10', '9.8', '9.6', '9.4', '9.2', '9.0', '8.10', '8.8', '8.6']
+        exclude:
+          - os: macos-latest
+            ghc: '9.0'
+          - os: macos-latest
+            ghc: '8.10'
+          - os: macos-latest
+            ghc: '8.8'
+          - os: macos-latest
+            ghc: '8.6'
+    steps:
+    - uses: actions/checkout@v4
+    - name: Setup toolchain
+      run: |
+        curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_INSTALL_NO_STACK=1 BOOTSTRAP_HASKELL_GHC_VERSION=${{ matrix.ghc }} BOOTSTRAP_HASKELL_ADJUST_BASHRC=yes sh
 
-  #   - if: runner.os == 'macOS'
-  #     name: Install system deps via brew
-  #     run: brew install coreutils autoconf automake
+    - if: runner.os == 'macOS'
+      name: Install system deps via brew
+      run: brew install coreutils autoconf automake
 
-  #   - uses: actions/cache@v4
-  #     name: Cache cabal stuff
-  #     with:
-  #       path: |
-  #         ~/.cabal/store
-  #         dist-newstyle
-  #       key: ${{ runner.os }}-${{ matrix.ghc }}-${{ github.sha }}
-  #       restore-keys: ${{ runner.os }}-${{ matrix.ghc }}-
-  #   - name: Build
-  #     run: |
-  #       . ~/.ghcup/env
-  #       ghc --version
-  #       cabal --version
-  #       cabal update
-  #       autoreconf --version
-  #       autoreconf -i
-  #       cabal sdist -z -o .
-  #       cabal get unix-*.tar.gz
-  #       cd unix-*/
-  #       cabal test all --test-show-details=direct
-  #   - name: Haddock
-  #     run: |
-  #       . ~/.ghcup/env
-  #       cabal haddock --disable-documentation
+    - uses: actions/cache@v4
+      name: Cache cabal stuff
+      with:
+        path: |
+          ~/.cabal/store
+          dist-newstyle
+        key: ${{ runner.os }}-${{ matrix.ghc }}-${{ github.sha }}
+        restore-keys: ${{ runner.os }}-${{ matrix.ghc }}-
+    - name: Build
+      run: |
+        . ~/.ghcup/env
+        ghc --version
+        cabal --version
+        cabal update
+        autoreconf --version
+        autoreconf -i
+        cabal sdist -z -o .
+        cabal get unix-*.tar.gz
+        cd unix-*/
+        cabal test all --test-show-details=direct
+    - name: Haddock
+      run: |
+        . ~/.ghcup/env
+        cabal haddock --disable-documentation
 
   redhat-ubi9:
     runs-on: ubuntu-24.04
@@ -80,25 +80,25 @@ jobs:
         autoreconf -i
         cabal test all --test-show-details=direct
 
-  # fedora37:
-  #   runs-on: ubuntu-latest
-  #   container:
-  #     image: fedora:37
-  #   steps:
-  #   - name: Install
-  #     run: |
-  #       dnf install -y gcc gmp gmp-devel make ncurses ncurses-compat-libs xz perl autoconf
-  #       curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 sh
-  #   - uses: actions/checkout@v4
-  #   - name: Test
-  #     run: |
-  #       source ~/.ghcup/env
-  #       cabal --version
-  #       cabal update
-  #       autoreconf --version
-  #       autoreconf -i
-  #       # test filepath >= 1.5
-  #       cabal test --constraint='filepath >= 1.5.0.0' all --test-show-details=direct
+  fedora37:
+    runs-on: ubuntu-latest
+    container:
+      image: fedora:37
+    steps:
+    - name: Install
+      run: |
+        dnf install -y gcc gmp gmp-devel make ncurses ncurses-compat-libs xz perl autoconf
+        curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 sh
+    - uses: actions/checkout@v4
+    - name: Test
+      run: |
+        source ~/.ghcup/env
+        cabal --version
+        cabal update
+        autoreconf --version
+        autoreconf -i
+        # test filepath >= 1.5
+        cabal test --constraint='filepath >= 1.5.0.0' all --test-show-details=direct
 
   i386:
     runs-on: ubuntu-latest
@@ -120,55 +120,55 @@ jobs:
         autoreconf -i
         cabal v2-test --constraint 'optparse-applicative -process' --constraint 'QuickCheck +old-random' --constraint 'tasty -unix' all
 
-  # arm:
-  #   runs-on: [self-hosted, Linux, ARM64]
-  #   strategy:
-  #     fail-fast: false
-  #     matrix:
-  #       arch: [arm32v7, arm64v8]
-  #   steps:
-  #     - uses: docker://hasufell/arm64v8-ubuntu-haskell:focal
-  #       name: Cleanup
-  #       with:
-  #         args: "find . -mindepth 1 -maxdepth 1 -exec rm -rf -- {} +"
+  arm:
+    runs-on: [self-hosted, Linux, ARM64]
+    strategy:
+      fail-fast: false
+      matrix:
+        arch: [arm32v7, arm64v8]
+    steps:
+      - uses: docker://hasufell/arm64v8-ubuntu-haskell:focal
+        name: Cleanup
+        with:
+          args: "find . -mindepth 1 -maxdepth 1 -exec rm -rf -- {} +"
 
-  #     - name: Checkout code
-  #       uses: actions/checkout@v4
+      - name: Checkout code
+        uses: actions/checkout@v4
 
-  #     - if: matrix.arch == 'arm32v7'
-  #       uses: docker://hasufell/arm32v7-ubuntu-haskell:focal
-  #       name: Run build (arm32v7 linux)
-  #       with:
-  #         args: sh -c "cabal update && autoreconf -i && cabal test all --test-show-details=direct"
+      - if: matrix.arch == 'arm32v7'
+        uses: docker://hasufell/arm32v7-ubuntu-haskell:focal
+        name: Run build (arm32v7 linux)
+        with:
+          args: sh -c "cabal update && autoreconf -i && cabal test all --test-show-details=direct"
 
-  #     - if: matrix.arch == 'arm64v8'
-  #       uses: docker://hasufell/arm64v8-ubuntu-haskell:focal
-  #       name: Run build (arm64v8 linux)
-  #       with:
-  #         args: sh -c "cabal update && autoreconf -i && cabal test all --test-show-details=direct"
+      - if: matrix.arch == 'arm64v8'
+        uses: docker://hasufell/arm64v8-ubuntu-haskell:focal
+        name: Run build (arm64v8 linux)
+        with:
+          args: sh -c "cabal update && autoreconf -i && cabal test all --test-show-details=direct"
 
-  # freebsd:
-  #   runs-on: ${{ matrix.os }}
-  #   strategy:
-  #     fail-fast: false
-  #     matrix:
-  #       include:
-  #         - os: [self-hosted, FreeBSD, X64]
-  #           ghc: 9.4
-  #         - os: [self-hosted, FreeBSD, X64]
-  #           ghc: 9.6
-  #   steps:
-  #     - name: Checkout code
-  #       uses: actions/checkout@v4
+  freebsd:
+    runs-on: ${{ matrix.os }}
+    strategy:
+      fail-fast: false
+      matrix:
+        include:
+          - os: [self-hosted, FreeBSD, X64]
+            ghc: 9.4
+          - os: [self-hosted, FreeBSD, X64]
+            ghc: 9.6
+    steps:
+      - name: Checkout code
+        uses: actions/checkout@v4
 
-  #     - name: Run build
-  #       run: |
-  #         pkg install -y curl gcc gmp gmake ncurses perl5 libffi libiconv git bash misc/compat10x misc/compat11x misc/compat12x gmake autoconf
-  #         . .github/scripts/env.sh
-  #         curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_INSTALL_NO_STACK=1 BOOTSTRAP_HASKELL_GHC_VERSION=${{ matrix.ghc }} BOOTSTRAP_HASKELL_ADJUST_BASHRC=yes sh
-  #         autoreconf --version
-  #         autoreconf -i
-  #         cabal sdist -z -o .
-  #         cabal get unix-*.tar.gz
-  #         cd unix-*/
-  #         cabal test all --test-show-details=direct
+      - name: Run build
+        run: |
+          pkg install -y curl gcc gmp gmake ncurses perl5 libffi libiconv git bash misc/compat10x misc/compat11x misc/compat12x gmake autoconf
+          . .github/scripts/env.sh
+          curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_INSTALL_NO_STACK=1 BOOTSTRAP_HASKELL_GHC_VERSION=${{ matrix.ghc }} BOOTSTRAP_HASKELL_ADJUST_BASHRC=yes sh
+          autoreconf --version
+          autoreconf -i
+          cabal sdist -z -o .
+          cabal get unix-*.tar.gz
+          cd unix-*/
+          cabal test all --test-show-details=direct

From 283160b25c8b5ab5623ca46170a6dfd690cb6bd4 Mon Sep 17 00:00:00 2001
From: Andreas Abel <andreas.abel@ifi.lmu.de>
Date: Tue, 19 Nov 2024 21:23:32 +0100
Subject: [PATCH 07/10] CI: i386: revert to v1 of actions/checkout

---
 .github/workflows/ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 20464fe..77e3b99 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -110,7 +110,7 @@ jobs:
         apt-get update -y
         apt-get install -y autoconf build-essential zlib1g-dev libgmp-dev curl
         curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_INSTALL_NO_STACK=1 sh
-    - uses: actions/checkout@v3
+    - uses: actions/checkout@v1
     - name: Test
       run: |
         source ~/.ghcup/env

From 9171a4d82ed8b20034649d17b08bb204345558e0 Mon Sep 17 00:00:00 2001
From: Bodigrim <andrew.lelechenko@gmail.com>
Date: Tue, 19 Nov 2024 23:20:13 +0000
Subject: [PATCH 08/10] CI: fix NetBSD job

---
 .cirrus.yml | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index 28ce7d1..123d7b8 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -12,9 +12,8 @@ task:
   name: OpenBSD
   compute_engine_instance:
     image_project: pg-ci-images
-    # OpenBSD version should match
-    # https://github.com/anarazel/pg-vm-images/blob/main/packer/openbsd.pkrvars.hcl
-    image: family/pg-ci-openbsd-vanilla-7-3
+    # See https://github.com/anarazel/pg-vm-images/blob/main/packer/openbsd.pkrvars.hcl
+    image: family/pg-ci-openbsd-vanilla
     platform: openbsd
   install_script: pkg_add ghc cabal-install git autoconf-2.71
   script:
@@ -30,9 +29,8 @@ task:
   name: NetBSD
   compute_engine_instance:
     image_project: pg-ci-images
-    # NetBSD version should match
-    # https://github.com/anarazel/pg-vm-images/blob/main/packer/netbsd.pkrvars.hcl
-    image: family/pg-ci-netbsd-vanilla-9-3
+    # See https://github.com/anarazel/pg-vm-images/blob/main/packer/netbsd.pkrvars.hcl
+    image: family/pg-ci-netbsd-vanilla
     platform: netbsd
   install_script:
     # Folders should be updated in line with

From dcf19781244a569b5b9da71e6c47f65f5c10705c Mon Sep 17 00:00:00 2001
From: Bodigrim <andrew.lelechenko@gmail.com>
Date: Sat, 21 Dec 2024 16:05:13 +0000
Subject: [PATCH 09/10] Allow base-4.21

---
 .github/workflows/ci.yml | 2 +-
 unix.cabal               | 7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 77e3b99..574c638 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -16,7 +16,7 @@ jobs:
       fail-fast: true
       matrix:
         os: [ubuntu-24.04, macOS-latest]
-        ghc: ['9.10', '9.8', '9.6', '9.4', '9.2', '9.0', '8.10', '8.8', '8.6']
+        ghc: ['9.12', '9.10', '9.8', '9.6', '9.4', '9.2', '9.0', '8.10', '8.8', '8.6']
         exclude:
           - os: macos-latest
             ghc: '9.0'
diff --git a/unix.cabal b/unix.cabal
index 3cafc4c..ed38f4f 100644
--- a/unix.cabal
+++ b/unix.cabal
@@ -11,7 +11,10 @@ bug-reports:    https://github.com/haskell/unix/issues
 synopsis:       POSIX functionality
 category:       System
 build-type:     Configure
-tested-with:    GHC==9.6.2,
+tested-with:    GHC==9.12.1,
+                GHC==9.10.1,
+                GHC==9.8.4,
+                GHC==9.6.6,
                 GHC==9.4.7,
                 GHC==9.2.8,
                 GHC==9.0.2,
@@ -74,7 +77,7 @@ library
         buildable: False
 
     build-depends:
-        base        >= 4.12.0.0  && < 4.21,
+        base        >= 4.12.0.0  && < 4.22,
         bytestring  >= 0.9.2     && < 0.13,
         time        >= 1.9.1     && < 1.15
 

From 81ebaf94121e8e52d96f22711f0d7fffc21a747b Mon Sep 17 00:00:00 2001
From: Julian Ospald <hasufell@posteo.de>
Date: Fri, 27 Dec 2024 13:16:05 +0800
Subject: [PATCH 10/10] Use ghcup-setup in CI

---
 .github/scripts/env.sh   | 31 ----------------
 .github/workflows/ci.yml | 76 +++++++++++++++++++++++++---------------
 2 files changed, 48 insertions(+), 59 deletions(-)
 delete mode 100755 .github/scripts/env.sh

diff --git a/.github/scripts/env.sh b/.github/scripts/env.sh
deleted file mode 100755
index dda1ee2..0000000
--- a/.github/scripts/env.sh
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/sh
-
-if [ "${RUNNER_OS}" = "Windows" ] ; then
-	ext=".exe"
-else
-	ext=''
-fi
-
-export DEBIAN_FRONTEND=noninteractive
-export TZ=Asia/Singapore
-
-export OS="$RUNNER_OS"
-export PATH="$HOME/.local/bin:$PATH"
-
-if [ "${RUNNER_OS}" = "Windows" ] ; then
-	# on windows use pwd to get unix style path
-	CI_PROJECT_DIR="$(pwd)"
-	export CI_PROJECT_DIR
-    export GHCUP_INSTALL_BASE_PREFIX="/c"
-    export GHCUP_BIN="$GHCUP_INSTALL_BASE_PREFIX/ghcup/bin"
-    export PATH="$GHCUP_BIN:$PATH"
-	export CABAL_DIR="C:\\Users\\runneradmin\\AppData\\Roaming\\cabal"
-else
-	export CI_PROJECT_DIR="${GITHUB_WORKSPACE}"
-    export GHCUP_INSTALL_BASE_PREFIX="$CI_PROJECT_DIR"
-    export GHCUP_BIN="$GHCUP_INSTALL_BASE_PREFIX/.ghcup/bin"
-    export PATH="$GHCUP_BIN:$PATH"
-    export CABAL_DIR="$CI_PROJECT_DIR/cabal"
-    export CABAL_CACHE="$CI_PROJECT_DIR/cabal-cache"
-fi
-
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 574c638..f44d680 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -28,9 +28,14 @@ jobs:
             ghc: '8.6'
     steps:
     - uses: actions/checkout@v4
+
+    - name: Install GHCup
+      uses: haskell/ghcup-setup@v1
+
     - name: Setup toolchain
       run: |
-        curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_INSTALL_NO_STACK=1 BOOTSTRAP_HASKELL_GHC_VERSION=${{ matrix.ghc }} BOOTSTRAP_HASKELL_ADJUST_BASHRC=yes sh
+        ghcup install ghc --set ${{ matrix.ghc }}
+        ghcup install cabal --set latest
 
     - if: runner.os == 'macOS'
       name: Install system deps via brew
@@ -46,7 +51,6 @@ jobs:
         restore-keys: ${{ runner.os }}-${{ matrix.ghc }}-
     - name: Build
       run: |
-        . ~/.ghcup/env
         ghc --version
         cabal --version
         cabal update
@@ -58,7 +62,6 @@ jobs:
         cabal test all --test-show-details=direct
     - name: Haddock
       run: |
-        . ~/.ghcup/env
         cabal haddock --disable-documentation
 
   redhat-ubi9:
@@ -66,14 +69,22 @@ jobs:
     container:
       image: redhat/ubi9:latest
     steps:
-    - name: Install
+    - name: Install prerequisites
       run: |
         yum install -y gcc gmp gmp-devel make ncurses xz perl autoconf
-        curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_GHC_VERSION=9.4.8 sh
+
+    - name: Install GHCup
+      uses: haskell/ghcup-setup@v1
+
+    - name: Setup toolchain
+      run: |
+        ghcup install ghc --set latest
+        ghcup install cabal --set latest
+
     - uses: actions/checkout@v4
+
     - name: Test
       run: |
-        source ~/.ghcup/env
         cabal --version
         cabal update
         autoreconf --version
@@ -85,14 +96,21 @@ jobs:
     container:
       image: fedora:37
     steps:
-    - name: Install
+    - name: Install prerequisites
       run: |
         dnf install -y gcc gmp gmp-devel make ncurses ncurses-compat-libs xz perl autoconf
-        curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 sh
+
+    - name: Install GHCup
+      uses: haskell/ghcup-setup@v1
+
+    - name: Setup toolchain
+      run: |
+        ghcup install ghc --set latest
+        ghcup install cabal --set latest
+
     - uses: actions/checkout@v4
     - name: Test
       run: |
-        source ~/.ghcup/env
         cabal --version
         cabal update
         autoreconf --version
@@ -102,23 +120,14 @@ jobs:
 
   i386:
     runs-on: ubuntu-latest
-    container:
-      image: i386/ubuntu:bionic
     steps:
-    - name: Install
-      run: |
-        apt-get update -y
-        apt-get install -y autoconf build-essential zlib1g-dev libgmp-dev curl
-        curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_INSTALL_NO_STACK=1 sh
-    - uses: actions/checkout@v1
-    - name: Test
-      run: |
-        source ~/.ghcup/env
-        cabal --version
-        cabal update
-        autoreconf --version
-        autoreconf -i
-        cabal v2-test --constraint 'optparse-applicative -process' --constraint 'QuickCheck +old-random' --constraint 'tasty -unix' all
+      - name: Checkout code
+        uses: actions/checkout@v4
+
+      - name: Run build (32 bit linux)
+        uses: docker://hasufell/i386-alpine-haskell:3.12
+        with:
+          args: sh -c "apk update && apk add --no-cache autoconf automake make && cabal update && autoreconf --version && autoreconf -i && cabal v2-test --constraint 'optparse-applicative -process' --constraint 'QuickCheck +old-random' --constraint 'tasty -unix' all"
 
   arm:
     runs-on: [self-hosted, Linux, ARM64]
@@ -161,14 +170,25 @@ jobs:
       - name: Checkout code
         uses: actions/checkout@v4
 
+      - name: Install prerequisites
+        run: |
+          sudo pkg install -y curl gcc gmp gmake ncurses perl5 libffi libiconv git bash misc/compat10x misc/compat11x misc/compat12x gmake autoconf
+
+      - name: Install GHCup
+        uses: haskell/ghcup-setup@v1
+
+      - name: Setup toolchain
+        run: |
+          ghcup install ghc --set ${{ matrix.ghc }}
+          ghcup install cabal --set latest
+
       - name: Run build
         run: |
-          pkg install -y curl gcc gmp gmake ncurses perl5 libffi libiconv git bash misc/compat10x misc/compat11x misc/compat12x gmake autoconf
-          . .github/scripts/env.sh
-          curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_INSTALL_NO_STACK=1 BOOTSTRAP_HASKELL_GHC_VERSION=${{ matrix.ghc }} BOOTSTRAP_HASKELL_ADJUST_BASHRC=yes sh
           autoreconf --version
           autoreconf -i
+          cabal update
           cabal sdist -z -o .
           cabal get unix-*.tar.gz
           cd unix-*/
           cabal test all --test-show-details=direct
+