From 9cb5ed24461c306b6fb05c4de725c07c7ec6e6d5 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 28 Jun 2021 12:51:40 -0400 Subject: [PATCH] avoid using cp --reflink=auto on windows Sponsored-by: Dartmouth College's Datalad project --- Build/Configure.hs | 13 +++++++++- ...1___cp_from_coreutils_lacks_--reflink.mdwn | 2 ++ ..._53714ec51d6ae4769f6c4dd9ee46ebae._comment | 25 +++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 doc/bugs/old__40__er__41___cp_from_coreutils_lacks_--reflink/comment_10_53714ec51d6ae4769f6c4dd9ee46ebae._comment diff --git a/Build/Configure.hs b/Build/Configure.hs index 6efd593c33..a22112507a 100644 --- a/Build/Configure.hs +++ b/Build/Configure.hs @@ -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 "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" diff --git a/doc/bugs/old__40__er__41___cp_from_coreutils_lacks_--reflink.mdwn b/doc/bugs/old__40__er__41___cp_from_coreutils_lacks_--reflink.mdwn index 619f316c5c..bf2593f8c8 100644 --- a/doc/bugs/old__40__er__41___cp_from_coreutils_lacks_--reflink.mdwn +++ b/doc/bugs/old__40__er__41___cp_from_coreutils_lacks_--reflink.mdwn @@ -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 index 0000000000..1d3818d985 --- /dev/null +++ b/doc/bugs/old__40__er__41___cp_from_coreutils_lacks_--reflink/comment_10_53714ec51d6ae4769f6c4dd9ee46ebae._comment @@ -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. +"""]]