avoid using cp --reflink=auto on windows
authorJoey Hess <joeyh@joeyh.name>
Mon, 28 Jun 2021 16:51:40 +0000 (12:51 -0400)
committerJoey Hess <joeyh@joeyh.name>
Mon, 28 Jun 2021 16:51:40 +0000 (12:51 -0400)
Sponsored-by: Dartmouth College's Datalad project
Build/Configure.hs
doc/bugs/old__40__er__41___cp_from_coreutils_lacks_--reflink.mdwn
doc/bugs/old__40__er__41___cp_from_coreutils_lacks_--reflink/comment_10_53714ec51d6ae4769f6c4dd9ee46ebae._comment [new file with mode: 0644]

index 6efd593c333370b98ac48f5544a8e3552ad74fdf..a22112507a2ce22a4c3e1b925f785210ed5fc645 100644 (file)
@@ -1,6 +1,7 @@
 {- Checks system configuration and generates Build/SysConfig and Build/Version. -}
 
 {-# OPTIONS_GHC -fno-warn-tabs #-}
+{-# LANGUAGE CPP #-}
 
 module Build.Configure where
 
@@ -23,7 +24,7 @@ tests =
        , testCp "cp_a" "-a"
        , testCp "cp_p" "-p"
        , testCp "cp_preserve_timestamps" "--preserve=timestamps"
-       , testCp "cp_reflink_supported" "--reflink=auto"
+       , testCpReflinkAuto
        , TestCase "xargs -0" $ testCmd "xargs_0" "xargs -0 </dev/null"
        , TestCase "rsync" $ testCmd "rsync" "rsync --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
        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 = do
        e <- getEnv "UPGRADE_LOCATION"
index 619f316c5c93d1da0cf83df9f0f4fec1a3dd636c..bf2593f8c874e56f702ed24457204486dd113e75 100644 (file)
@@ -41,3 +41,5 @@ Meanwhile I will see if there is some sensible way to get more uptodate coreutil
 
 [[!meta author=yoh]]
 [[!tag projects/datalad]]
+
+> [[done]](ish) --[[Joey]]
diff --git a/doc/bugs/old__40__er__41___cp_from_coreutils_lacks_--reflink/comment_10_53714ec51d6ae4769f6c4dd9ee46ebae._comment b/doc/bugs/old__40__er__41___cp_from_coreutils_lacks_--reflink/comment_10_53714ec51d6ae4769f6c4dd9ee46ebae._comment
new file mode 100644 (file)
index 0000000..1d3818d
--- /dev/null
@@ -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. 
+"""]]