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.
This commit is contained in:
Joey Hess 2025-09-05 12:44:46 -04:00
commit fe67756197
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 15 additions and 4 deletions

View file

@ -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

View file

@ -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 <id@joeyh.name> Fri, 29 Aug 2025 12:34:06 -0400

View file

@ -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

View file

@ -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