[Git][haskell-team/DHG_packages][master] ghc: Fix 64-bit time_t issues (#1068586)
Ilias Tsitsimpis (@iliastsi)
gitlab at salsa.debian.org
Wed Apr 10 16:16:28 BST 2024
Ilias Tsitsimpis pushed to branch master at Debian Haskell Group / DHG_packages
Commits:
3b08f995 by Ilias Tsitsimpis at 2024-04-10T14:24:20+03:00
ghc: Fix 64-bit time_t issues (#1068586)
- - - - -
5 changed files:
- p/ghc/debian/changelog
- p/ghc/debian/patches/series
- + p/ghc/debian/patches/time_t-directory
- + p/ghc/debian/patches/time_t-time
- + p/ghc/debian/patches/time_t-unix
Changes:
=====================================
p/ghc/debian/changelog
=====================================
@@ -1,3 +1,10 @@
+ghc (9.4.7-5) unstable; urgency=medium
+
+ * Backport upstream patches to fix issues with 64-bit time_t (Closes:
+ #1068586)
+
+ -- Ilias Tsitsimpis <iliastsi at debian.org> Wed, 10 Apr 2024 14:24:01 +0300
+
ghc (9.4.7-4) unstable; urgency=medium
* Backport upstream patch to fix compilation with GCC 14 (Closes: #1068179)
=====================================
p/ghc/debian/patches/series
=====================================
@@ -24,3 +24,6 @@ use-modern-atomics
ppc64el-fix-clrri
dfe1c3540e4b519b62b862b5966dfec5cae9ece1.patch
fix-gcc14-ffi_arg
+time_t-directory
+time_t-time
+time_t-unix
=====================================
p/ghc/debian/patches/time_t-directory
=====================================
@@ -0,0 +1,40 @@
+From f6b288bd96fba5a955d1f73663eb52c1859ee765 Mon Sep 17 00:00:00 2001
+From: Marios Titas <redneb at gmx.com>
+Date: Sun, 2 Oct 2022 23:12:41 +0300
+Subject: [PATCH] Use capi for syscalls that break under musl's handling of
+ 64-bit time_t
+
+Closes #145.
+---
+
+Index: b/libraries/directory/System/Directory/Internal/C_utimensat.hsc
+===================================================================
+--- a/libraries/directory/System/Directory/Internal/C_utimensat.hsc
++++ b/libraries/directory/System/Directory/Internal/C_utimensat.hsc
+@@ -1,3 +1,5 @@
++{-# LANGUAGE CApiFFI #-}
++
+ module System.Directory.Internal.C_utimensat where
+ #include <HsDirectoryConfig.h>
+ #ifdef HAVE_UTIMENSAT
+@@ -41,7 +43,7 @@ toCTimeSpec t = CTimeSpec (CTime sec) (t
+ (sec, frac) = if frac' < 0 then (sec' - 1, frac' + 1) else (sec', frac')
+ (sec', frac') = properFraction (toRational t)
+
+-foreign import ccall "utimensat" c_utimensat
++foreign import capi "sys/stat.h utimensat" c_utimensat
+ :: CInt -> CString -> Ptr CTimeSpec -> CInt -> IO CInt
+
+ #endif
+Index: b/libraries/directory/directory.cabal
+===================================================================
+--- a/libraries/directory/directory.cabal
++++ b/libraries/directory/directory.cabal
+@@ -38,6 +38,7 @@ Library
+ default-language: Haskell2010
+ other-extensions:
+ CPP
++ CApiFFI
+ Trustworthy
+
+ exposed-modules:
=====================================
p/ghc/debian/patches/time_t-time
=====================================
@@ -0,0 +1,44 @@
+From d52314edb138b6ecd7e888c588f83917b0ee2c29 Mon Sep 17 00:00:00 2001
+From: Marios Titas <redneb at gmx.com>
+Date: Sun, 2 Oct 2022 23:12:43 +0300
+Subject: [PATCH] Use capi for syscalls that break under musl's handling of
+ 64-bit time_t
+
+---
+
+Index: b/libraries/time/lib/Data/Time/Clock/Internal/CTimespec.hsc
+===================================================================
+--- a/libraries/time/lib/Data/Time/Clock/Internal/CTimespec.hsc
++++ b/libraries/time/lib/Data/Time/Clock/Internal/CTimespec.hsc
+@@ -27,9 +27,9 @@ instance Storable CTimespec where
+ #{poke struct timespec, tv_sec } p s
+ #{poke struct timespec, tv_nsec} p ns
+
+-foreign import ccall unsafe "time.h clock_gettime"
++foreign import capi unsafe "time.h clock_gettime"
+ clock_gettime :: ClockID -> Ptr CTimespec -> IO CInt
+-foreign import ccall unsafe "time.h clock_getres"
++foreign import capi unsafe "time.h clock_getres"
+ clock_getres :: ClockID -> Ptr CTimespec -> IO CInt
+
+ -- | Get the resolution of the given clock.
+Index: b/libraries/time/lib/Data/Time/Clock/Internal/CTimeval.hs
+===================================================================
+--- a/libraries/time/lib/Data/Time/Clock/Internal/CTimeval.hs
++++ b/libraries/time/lib/Data/Time/Clock/Internal/CTimeval.hs
+@@ -1,5 +1,6 @@
+ {-# LANGUAGE CPP #-}
+ {-# LANGUAGE Safe #-}
++{-# LANGUAGE CApiFFI #-}
+
+ module Data.Time.Clock.Internal.CTimeval where
+
+@@ -23,7 +24,7 @@ instance Storable CTimeval where
+ pokeElemOff (castPtr p) 0 s
+ pokeElemOff (castPtr p) 1 mus
+
+-foreign import ccall unsafe "time.h gettimeofday" gettimeofday :: Ptr CTimeval -> Ptr () -> IO CInt
++foreign import capi unsafe "sys/time.h gettimeofday" gettimeofday :: Ptr CTimeval -> Ptr () -> IO CInt
+
+ -- | Get the current POSIX time from the system clock.
+ getCTimeval :: IO CTimeval
=====================================
p/ghc/debian/patches/time_t-unix
=====================================
@@ -0,0 +1,76 @@
+From e7ff902a69a90b206521de09da430b5cca6d8699 Mon Sep 17 00:00:00 2001
+From: Marios Titas <redneb at gmx.com>
+Date: Sun, 2 Oct 2022 23:12:32 +0300
+Subject: [PATCH] Use capi for syscalls that break under musl's handling of
+ 64-bit time_t
+
+---
+
+Index: b/libraries/unix/System/Posix/DynamicLinker/Prim.hsc
+===================================================================
+--- a/libraries/unix/System/Posix/DynamicLinker/Prim.hsc
++++ b/libraries/unix/System/Posix/DynamicLinker/Prim.hsc
+@@ -1,3 +1,4 @@
++{-# LANGUAGE CApiFFI #-}
+ {-# LANGUAGE Trustworthy #-}
+ #if __GLASGOW_HASKELL__ >= 709
+ {-# OPTIONS_GHC -fno-warn-trustworthy-safe #-}
+@@ -81,10 +82,10 @@ data RTLDFlags
+ | RTLD_LOCAL
+ deriving (Show, Read)
+
+-foreign import ccall unsafe "dlopen" c_dlopen :: CString -> CInt -> IO (Ptr ())
+-foreign import ccall unsafe "dlsym" c_dlsym :: Ptr () -> CString -> IO (FunPtr a)
+-foreign import ccall unsafe "dlerror" c_dlerror :: IO CString
+-foreign import ccall unsafe "dlclose" c_dlclose :: (Ptr ()) -> IO CInt
++foreign import capi unsafe "dlfcn.h dlopen" c_dlopen :: CString -> CInt -> IO (Ptr ())
++foreign import capi unsafe "dlfcn.h dlsym" c_dlsym :: Ptr () -> CString -> IO (FunPtr a)
++foreign import capi unsafe "dlfcn.h dlerror" c_dlerror :: IO CString
++foreign import capi unsafe "dlfcn.h dlclose" c_dlclose :: (Ptr ()) -> IO CInt
+
+ packRTLDFlags :: [RTLDFlags] -> CInt
+ packRTLDFlags flags = foldl (\ s f -> (packRTLDFlag f) .|. s) 0 flags
+Index: b/libraries/unix/System/Posix/Files/Common.hsc
+===================================================================
+--- a/libraries/unix/System/Posix/Files/Common.hsc
++++ b/libraries/unix/System/Posix/Files/Common.hsc
+@@ -1,3 +1,4 @@
++{-# LANGUAGE CApiFFI #-}
+ {-# LANGUAGE Trustworthy #-}
+
+ -----------------------------------------------------------------------------
+@@ -420,12 +421,12 @@ toCTimeSpec t = CTimeSpec (CTime sec) (t
+ #endif
+
+ #ifdef HAVE_UTIMENSAT
+-foreign import ccall unsafe "utimensat"
++foreign import capi unsafe "sys/stat.h utimensat"
+ c_utimensat :: CInt -> CString -> Ptr CTimeSpec -> CInt -> IO CInt
+ #endif
+
+ #if HAVE_FUTIMENS
+-foreign import ccall unsafe "futimens"
++foreign import capi unsafe "sys/stat.h futimens"
+ c_futimens :: CInt -> Ptr CTimeSpec -> IO CInt
+ #endif
+
+@@ -448,16 +449,16 @@ toCTimeVal t = CTimeVal sec (truncate $
+ (sec, frac) = if (frac' < 0) then (sec' - 1, frac' + 1) else (sec', frac')
+ (sec', frac') = properFraction $ toRational t
+
+-foreign import ccall unsafe "utimes"
++foreign import capi unsafe "sys/time.h utimes"
+ c_utimes :: CString -> Ptr CTimeVal -> IO CInt
+
+ #ifdef HAVE_LUTIMES
+-foreign import ccall unsafe "lutimes"
++foreign import capi unsafe "sys/time.h lutimes"
+ c_lutimes :: CString -> Ptr CTimeVal -> IO CInt
+ #endif
+
+ #if HAVE_FUTIMES
+-foreign import ccall unsafe "futimes"
++foreign import capi unsafe "sys/time.h futimes"
+ c_futimes :: CInt -> Ptr CTimeVal -> IO CInt
+ #endif
+
View it on GitLab: https://salsa.debian.org/haskell-team/DHG_packages/-/commit/3b08f9950cf7f485ea712530ba4b5ba2a149ac8d
--
View it on GitLab: https://salsa.debian.org/haskell-team/DHG_packages/-/commit/3b08f9950cf7f485ea712530ba4b5ba2a149ac8d
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-haskell-commits/attachments/20240410/7c61d174/attachment-0001.htm>
More information about the Pkg-haskell-commits
mailing list