From fe6775619758e16f3e8cb77b4ee1d0775ae7795c Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 5 Sep 2025 12:44:46 -0400 Subject: [PATCH] turn on OsPath build flag by default It was already default in stack builds, now it is default in cabal builds as well. Add build warnings when git-annex is built without the OsPath build flag. git-annex version: Report on whether it was built with the OsPath build flag. Having the flag on by default was always the plan, and this is a good time to make the change. A bit of added urgency comes from the close-on-exec leak issue. Fixing that is going to need reimplentation of things like openFile. Needing to reimplenment it twice is not very appealing, especially since the FilePath version of it has an implementation that cannot be easily copied and tweaked. If OsPath is on by default, I can start with only implementing openFile for it, and fix the bug in that build. And perhaps avoid doing the extra work that will later get thrown away when this transition finishes. Note that at this point, Debian still needs to package file-io. Hopefully, they will package it, rather than turning off the OsPath build flag. --- BuildFlags.hs | 5 +++++ CHANGELOG | 4 ++++ doc/todo/RawFilePath_conversion.mdwn | 9 +++++---- git-annex.cabal | 1 + 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/BuildFlags.hs b/BuildFlags.hs index d273c216e4..8724b94e45 100644 --- a/BuildFlags.hs +++ b/BuildFlags.hs @@ -69,6 +69,11 @@ buildFlags = filter (not . null) , "Testsuite" , "S3" , "WebDAV" +#ifdef WITH_OSPATH + , "OsPath" +#else +#warning Building without the OsPath build flag set results in slower filename manipulation and is not recommended. +#endif ] -- Not a complete list, let alone a listing transitive deps, but only diff --git a/CHANGELOG b/CHANGELOG index 379d28a732..2297edecee 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,6 +3,10 @@ git-annex (10.20250829) UNRELEASED; urgency=medium * drop: --fast support when dropping from a remote. * Fix crash operating on filenames that are exactly 21 bytes long and begin with a utf-8 character. + * git-annex.cabal: Turn on the OsPath build flag by default. + * Add build warnings when git-annex is built without the OsPath + build flag. + * version: Report on whether it was built with the OsPath build flag. -- Joey Hess Fri, 29 Aug 2025 12:34:06 -0400 diff --git a/doc/todo/RawFilePath_conversion.mdwn b/doc/todo/RawFilePath_conversion.mdwn index c10b62cf2e..b488353a60 100644 --- a/doc/todo/RawFilePath_conversion.mdwn +++ b/doc/todo/RawFilePath_conversion.mdwn @@ -12,10 +12,11 @@ But this conversion is not yet complete. This is a todo to keep track of the status. * The OsPath build flag makes git-annex build with OsPath. Otherwise, - it builds with RawFilePath. The plan is to make that build flag the - default where it is not already as time goes on. And then eventually - remove the build flag and simplify code in git-annex to not need to - support two different build methods. + it builds with RawFilePath. That build flag is now on by default, + and there is a build warning when it is not set. + +* The plan is to eventually remove the build flag and simplify code in + git-annex to not need to support two different build methods. * unix has modules that operate on RawFilePath but no OSPath versions yet. See https://github.com/haskell/unix/issues/240 diff --git a/git-annex.cabal b/git-annex.cabal index dda13f7071..484e94abfd 100644 --- a/git-annex.cabal +++ b/git-annex.cabal @@ -177,6 +177,7 @@ Flag Servant Flag OsPath Description: Use the os-string library and related libraries, for faster filename manipulation + Default: True Flag Benchmark Description: Enable benchmarking -- 2.30.2