avoid using cp --reflink=auto on windows

Sponsored-by: Dartmouth College's Datalad project
This commit is contained in:
Joey Hess 2021-06-28 12:51:40 -04:00
parent b8e32e200e
commit 9cb5ed2446
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 39 additions and 1 deletions

View file

@ -1,6 +1,7 @@
{- Checks system configuration and generates Build/SysConfig and Build/Version. -} {- Checks system configuration and generates Build/SysConfig and Build/Version. -}
{-# OPTIONS_GHC -fno-warn-tabs #-} {-# OPTIONS_GHC -fno-warn-tabs #-}
{-# LANGUAGE CPP #-}
module Build.Configure where module Build.Configure where
@ -23,7 +24,7 @@ tests =
, testCp "cp_a" "-a" , testCp "cp_a" "-a"
, testCp "cp_p" "-p" , testCp "cp_p" "-p"
, testCp "cp_preserve_timestamps" "--preserve=timestamps" , testCp "cp_preserve_timestamps" "--preserve=timestamps"
, testCp "cp_reflink_supported" "--reflink=auto" , testCpReflinkAuto
, TestCase "xargs -0" $ testCmd "xargs_0" "xargs -0 </dev/null" , TestCase "xargs -0" $ testCmd "xargs_0" "xargs -0 </dev/null"
, TestCase "rsync" $ testCmd "rsync" "rsync --version >/dev/null" , TestCase "rsync" $ testCmd "rsync" "rsync --version >/dev/null"
, TestCase "curl" $ testCmd "curl" "curl --version >/dev/null" , TestCase "curl" $ testCmd "curl" "curl --version >/dev/null"
@ -51,6 +52,16 @@ testCp k option = TestCase cmd $ testCmd k cmdline
cmd = "cp " ++ option cmd = "cp " ++ option
cmdline = cmd ++ " " ++ testFile ++ " " ++ testFile ++ ".new" cmdline = cmd ++ " " ++ testFile ++ " " ++ testFile ++ ".new"
testCpReflinkAuto :: TestCase
#ifdef mingw32_HOST_OS
-- Windows does not support reflink so don't even try to use the option.
testCpReflinkAuto = TestCase k (Config k (BoolConfig False))
#else
testCpReflinkAuto = testCp k "--reflink=auto"
#endif
where
k = "cp_reflink_supported"
getUpgradeLocation :: Test getUpgradeLocation :: Test
getUpgradeLocation = do getUpgradeLocation = do
e <- getEnv "UPGRADE_LOCATION" e <- getEnv "UPGRADE_LOCATION"

View file

@ -41,3 +41,5 @@ Meanwhile I will see if there is some sensible way to get more uptodate coreutil
[[!meta author=yoh]] [[!meta author=yoh]]
[[!tag projects/datalad]] [[!tag projects/datalad]]
> [[done]](ish) --[[Joey]]

View file

@ -0,0 +1,25 @@
[[!comment format=mdwn
username="joey"
subject="""comment 10"""
date="2021-06-28T16:34:31Z"
content="""
Since this bug was opened, some uses of cp have been converted to git-annex
doing the copy itself without cp, first probing for CoW support.
I do not think that the places mentioned in this bug report where cp fails
are ones that have been converted yet.
The most likely way to fix this bug would be to convert them. But the need
to remember what directory combinations it's probed for CoW support in and
so avoid probing for CoW support every time complicates that conversion.
See related: [[todo/support_macOS__39___cp_-c___40__cp_--reflink_equivalent__41__]]
But I don't think git-annex will ever stop relying on programs bundled with
it (when not packaged with a package manager that supports deps). It's much
easier to reimplement cp than gpg or ssh. So these version skews are always
a potential problem, when people are doing things that put other programs
ahead of the ones bundled with git-annex in PATH. So the benefit of
avoiding external cp entirely just doesn't seem compelling.
I've disabled using --reflink=auto on windows. Going to close this with
that.
"""]]