From c1ecb8071608ea50c85a39890fce96abec09b5c1 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 23 Jan 2025 10:27:18 -0400 Subject: [PATCH 1/8] update --- doc/todo/RawFilePath_conversion.mdwn | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/todo/RawFilePath_conversion.mdwn b/doc/todo/RawFilePath_conversion.mdwn index a452c41dca..6268d93164 100644 --- a/doc/todo/RawFilePath_conversion.mdwn +++ b/doc/todo/RawFilePath_conversion.mdwn @@ -25,6 +25,7 @@ status. not yet used, and would eliminate a lot of fromRawFilePaths. Make Utility.SystemDirectory import it when built with OsPath, and the remaining 6 hours or work will explain itself.. + This has been started in the `ospath` branch. [[!tag confirmed]] From f0b5fce5ab2eb2ce5992bd2f11731afebb98330d Mon Sep 17 00:00:00 2001 From: yarikoptic Date: Thu, 23 Jan 2025 15:53:39 +0000 Subject: [PATCH 2/8] Added a comment --- ...comment_1_704469f0deb075d0b3c70c73708cd456._comment | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 doc/git-annex-dead/comment_1_704469f0deb075d0b3c70c73708cd456._comment diff --git a/doc/git-annex-dead/comment_1_704469f0deb075d0b3c70c73708cd456._comment b/doc/git-annex-dead/comment_1_704469f0deb075d0b3c70c73708cd456._comment new file mode 100644 index 0000000000..11cd23cf15 --- /dev/null +++ b/doc/git-annex-dead/comment_1_704469f0deb075d0b3c70c73708cd456._comment @@ -0,0 +1,10 @@ +[[!comment format=mdwn + username="yarikoptic" + avatar="http://cdn.libravatar.org/avatar/f11e9c84cb18d26a1748c33b48c924b4" + subject="comment 1" + date="2025-01-23T15:53:39Z" + content=""" +is there `git annex undead` to easily mitigate users doing what they should have not done? ;-) + +Would it be sufficient to just remove the corresponding `X` line from `trust.log`? +"""]] From e8f984598aa4161319a2056ceb79b1482ba1d673 Mon Sep 17 00:00:00 2001 From: yarikoptic Date: Thu, 23 Jan 2025 16:12:18 +0000 Subject: [PATCH 3/8] complaining about dead --- ..._clone_easily_dead_when_not_intended_.mdwn | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 doc/bugs/dead_clone_easily_dead_when_not_intended_.mdwn diff --git a/doc/bugs/dead_clone_easily_dead_when_not_intended_.mdwn b/doc/bugs/dead_clone_easily_dead_when_not_intended_.mdwn new file mode 100644 index 0000000000..c6b79764cf --- /dev/null +++ b/doc/bugs/dead_clone_easily_dead_when_not_intended_.mdwn @@ -0,0 +1,34 @@ +### Please describe the problem. + +Current syntax of `dead` online at git annex dead [repository ...] [--key somekey ...] says + +`git annex dead [repository ...] [--key somekey ...]` + +which is also incorrect rendering I think since it is + +``` +[d31548v@ndoli tmp]$ git annex dead --help +git-annex dead - hide a lost repository or key + +Usage: git-annex dead [[REPOSITORY ...] | [--key KEY]] + +``` + +so it is EITHER to announce REPOSITORY or a KEY. + +Naive/new/quick users, since many annex commands take file paths as arguments could provide `dead` with both - repository and local paths, e.g. `git annex dead here */*.nii.gz` or alike. But then annex proceeds with marking `here` dead while then erroring out on paths: + +```shell +(datalad-dev) [d78092t@ndoli 1080_wasabi]$ git-annex dead here sub-SID000743/ses-01/func/*.nii +dead here (recording state in git...) +ok +git-annex: there is no available git remote named "sub-SID000743/ses-01/func/sub-SID000743_ses-01_task-hyperalignment_acq-mb8_run-04_bold.nii" +``` + +which is correct/expected behavior given the fact that if RTFM then those are to be taken as repositories. + +But I wondered if may be `git annex` could/should become more "protective" and fail early if any of provided repositories is "not available"? + + +[[!meta author=yoh]] +[[!tag projects/openneuro]] From 103ec0123fb3a74cbea47e832b36388a111b4130 Mon Sep 17 00:00:00 2001 From: yarikoptic Date: Thu, 23 Jan 2025 21:33:26 +0000 Subject: [PATCH 4/8] Added a comment --- .../comment_2_4da905b6b8c0c0ba31f4379bf6d940e0._comment | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 doc/git-annex-dead/comment_2_4da905b6b8c0c0ba31f4379bf6d940e0._comment diff --git a/doc/git-annex-dead/comment_2_4da905b6b8c0c0ba31f4379bf6d940e0._comment b/doc/git-annex-dead/comment_2_4da905b6b8c0c0ba31f4379bf6d940e0._comment new file mode 100644 index 0000000000..9e736aefaf --- /dev/null +++ b/doc/git-annex-dead/comment_2_4da905b6b8c0c0ba31f4379bf6d940e0._comment @@ -0,0 +1,8 @@ +[[!comment format=mdwn + username="yarikoptic" + avatar="http://cdn.libravatar.org/avatar/f11e9c84cb18d26a1748c33b48c924b4" + subject="comment 2" + date="2025-01-23T21:33:25Z" + content=""" +d'oh -- it is `git annex semitrust here` to return the \"trust\" into a dead beast ;) +"""]] From f1b64f0415da605ebaf12a1b6586c864b9d63f8d Mon Sep 17 00:00:00 2001 From: "beryllium@5bc3c32eb8156390f96e363e4ba38976567425ec" Date: Fri, 24 Jan 2025 08:04:27 +0000 Subject: [PATCH 5/8] Added a comment --- ...t_4_2270f72a453d8a75a2e050c82561e4ae._comment | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 doc/git-annex-whereused/comment_4_2270f72a453d8a75a2e050c82561e4ae._comment diff --git a/doc/git-annex-whereused/comment_4_2270f72a453d8a75a2e050c82561e4ae._comment b/doc/git-annex-whereused/comment_4_2270f72a453d8a75a2e050c82561e4ae._comment new file mode 100644 index 0000000000..a469b42363 --- /dev/null +++ b/doc/git-annex-whereused/comment_4_2270f72a453d8a75a2e050c82561e4ae._comment @@ -0,0 +1,16 @@ +[[!comment format=mdwn + username="beryllium@5bc3c32eb8156390f96e363e4ba38976567425ec" + nickname="beryllium" + avatar="http://cdn.libravatar.org/avatar/62b67d68e918b381e7e9dd6a96c16137" + subject="comment 4" + date="2025-01-24T08:04:27Z" + content=""" +I don't know if this is expected behaviour, but for some files I imported from an importtree, when I use git-annex whereused --key with the correct key, nothing is shown unless I also add --historical + +And then I am shown the importtree branch information. It doesn't seem to make sense to me. The file is definitely present, and git-annex whereis confirms this, as does git-annex lock/unlock + +Willing to add more context if this is a little too vague + +Shaddy Baddah (beryllium at shaddybaddah dot name) + +"""]] From 21731b7d3a02e9c71df3c907d2ba8d8998042a28 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 24 Jan 2025 11:32:26 -0400 Subject: [PATCH 6/8] remove a few unused imports on windows --- Utility/Directory/Stream.hs | 2 +- Utility/FileIO.hs | 1 - Utility/FileSize.hs | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Utility/Directory/Stream.hs b/Utility/Directory/Stream.hs index 509abb68de..a74416d2f8 100644 --- a/Utility/Directory/Stream.hs +++ b/Utility/Directory/Stream.hs @@ -19,7 +19,6 @@ module Utility.Directory.Stream ( import Control.Monad import Control.Concurrent -import qualified Data.ByteString as B import Data.Maybe import Prelude @@ -27,6 +26,7 @@ import Prelude import qualified System.Win32 as Win32 import System.FilePath #else +import qualified Data.ByteString as B import qualified System.Posix.Directory.ByteString as Posix #endif diff --git a/Utility/FileIO.hs b/Utility/FileIO.hs index 5a8f661ce5..f3bd23ad71 100644 --- a/Utility/FileIO.hs +++ b/Utility/FileIO.hs @@ -36,7 +36,6 @@ import System.File.OsPath import Utility.Path.Windows import Utility.OsPath import System.IO (IO, Handle, IOMode) -import System.OsPath (OsPath) import qualified System.File.OsPath as O import qualified Data.ByteString as B import qualified Data.ByteString.Lazy as L diff --git a/Utility/FileSize.hs b/Utility/FileSize.hs index ad23647606..4858b0bdff 100644 --- a/Utility/FileSize.hs +++ b/Utility/FileSize.hs @@ -17,7 +17,6 @@ module Utility.FileSize ( #ifdef mingw32_HOST_OS import Control.Exception (bracket) import System.IO -import Utility.FileSystemEncoding import qualified Utility.FileIO as F import Utility.OsPath #else From f0c206cea67107ca2e4618239a7d29d1d391e930 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 24 Jan 2025 11:33:50 -0400 Subject: [PATCH 7/8] avoid build warning on windows --- Utility/LockFile/Windows.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Utility/LockFile/Windows.hs b/Utility/LockFile/Windows.hs index c8e7c1bf52..9f35ec1129 100644 --- a/Utility/LockFile/Windows.hs +++ b/Utility/LockFile/Windows.hs @@ -75,9 +75,9 @@ openLock sharemode f = do return $ if h == iNVALID_HANDLE_VALUE then Nothing else Just h -#endif where security_attributes = maybePtr Nothing +#endif dropLock :: LockHandle -> IO () dropLock = closeHandle From f0b9b46cb24d0cd729d52a44ba2e21ded6b29d56 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 24 Jan 2025 11:37:17 -0400 Subject: [PATCH 8/8] windows and osx build fixes for recent ByteString conversion work --- Utility/Daemon.hs | 2 +- Utility/DirWatcher/FSEvents.hs | 3 ++- Utility/DirWatcher/Win32Notify.hs | 3 ++- Utility/Gpg.hs | 4 ++-- Utility/StatelessOpenPGP.hs | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Utility/Daemon.hs b/Utility/Daemon.hs index c2a3d1bde7..38f8d09aee 100644 --- a/Utility/Daemon.hs +++ b/Utility/Daemon.hs @@ -189,6 +189,6 @@ winLockFile pid pidfile = do prefix = pidfile ++ "." suffix = ".lck" cleanstale = mapM_ (void . tryIO . removeFile) =<< - (filter iswinlockfile <$> dirContents (fromRawFilePath (parentDir (toRawFilePath pidfile)))) + (filter iswinlockfile . map fromRawFilePath <$> dirContents (parentDir (toRawFilePath pidfile))) iswinlockfile f = suffix `isSuffixOf` f && prefix `isPrefixOf` f #endif diff --git a/Utility/DirWatcher/FSEvents.hs b/Utility/DirWatcher/FSEvents.hs index 7b6be6f13b..da2b3194bc 100644 --- a/Utility/DirWatcher/FSEvents.hs +++ b/Utility/DirWatcher/FSEvents.hs @@ -70,7 +70,8 @@ watchDir dir ignored scanevents hooks = do scan d = unless (ignoredPath ignored d) $ -- Do not follow symlinks when scanning. -- This mirrors the inotify startup scan behavior. - mapM_ go =<< emptyWhenDoesNotExist (dirContentsRecursiveSkipping (const False) False d) + mapM_ (go . fromRawFilePath) =<< emptyWhenDoesNotExist + (dirContentsRecursiveSkipping (const False) False (toRawFilePath d)) where go f | ignoredPath ignored f = noop diff --git a/Utility/DirWatcher/Win32Notify.hs b/Utility/DirWatcher/Win32Notify.hs index e5ce316ce6..5f53c13bf5 100644 --- a/Utility/DirWatcher/Win32Notify.hs +++ b/Utility/DirWatcher/Win32Notify.hs @@ -43,7 +43,8 @@ watchDir dir ignored scanevents hooks = do runhook h s = maybe noop (\a -> a (filePath evt) s) (h hooks) scan d = unless (ignoredPath ignored d) $ - mapM_ go =<< emptyWhenDoesNotExist (dirContentsRecursiveSkipping (const False) False d) + mapM_ (go . fromRawFilePath) =<< emptyWhenDoesNotExist + (dirContentsRecursiveSkipping (const False) False (toRawFilePath d)) where go f | ignoredPath ignored f = noop diff --git a/Utility/Gpg.hs b/Utility/Gpg.hs index 19dd7f5395..763028e7dc 100644 --- a/Utility/Gpg.hs +++ b/Utility/Gpg.hs @@ -179,10 +179,10 @@ feedRead cmd params passphrase feeder reader = do go (passphrasefd ++ params) #else -- store the passphrase in a temp file for gpg - withTmpFile "gpg" $ \tmpfile h -> do + withTmpFile (toOsPath "gpg") $ \tmpfile h -> do liftIO $ B.hPutStr h passphrase liftIO $ hClose h - let passphrasefile = [Param "--passphrase-file", File tmpfile] + let passphrasefile = [Param "--passphrase-file", File (fromosPath tmpfile)] go $ passphrasefile ++ params #endif where diff --git a/Utility/StatelessOpenPGP.hs b/Utility/StatelessOpenPGP.hs index 6150bce633..874ed84e19 100644 --- a/Utility/StatelessOpenPGP.hs +++ b/Utility/StatelessOpenPGP.hs @@ -163,7 +163,7 @@ feedRead cmd subcmd params password emptydirectory feeder reader = do withTmpFile (toOsPath "sop") $ \tmpfile h -> do liftIO $ B.hPutStr h password liftIO $ hClose h - let passwordfile = [Param $ "--with-password="++tmpfile] + let passwordfile = [Param $ "--with-password=" ++ fromOsPath tmpfile] -- Don't need to pass emptydirectory since @FD is not used, -- and so tmpfile also does not need to be made absolute. case emptydirectory of