From a5228ac76572463a52072fbbc5913bbe0e092ec0 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 23 Jun 2018 18:16:37 -0400 Subject: [PATCH 1/4] Support configuring remote.web.annex-cost and remote.bittorrent.annex-cost Seems that has never worked before due to oversight. --- CHANGELOG | 3 +++ Remote/BitTorrent.hs | 6 ++++-- Remote/Web.hs | 6 ++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 25da6e4afe..f694af942b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ + + * Support configuring remote.web.annex-cost and remote.bittorrent.annex-cost + git-annex (6.20180530) UNRELEASED; urgency=medium * Fix build with ghc 8.4+, which broke due to the Semigroup Monoid change. diff --git a/Remote/BitTorrent.hs b/Remote/BitTorrent.hs index 8cc559d917..3246153c4a 100644 --- a/Remote/BitTorrent.hs +++ b/Remote/BitTorrent.hs @@ -14,6 +14,7 @@ import Types.Remote import qualified Annex import qualified Git import qualified Git.Construct +import Config import Config.Cost import Logs.Web import Types.UrlContents @@ -51,10 +52,11 @@ list _autoinit = do return [r] gen :: Git.Repo -> UUID -> RemoteConfig -> RemoteGitConfig -> Annex (Maybe Remote) -gen r _ c gc = +gen r _ c gc = do + cst <- remoteCost gc expensiveRemoteCost return $ Just Remote { uuid = bitTorrentUUID - , cost = expensiveRemoteCost + , cost = cst , name = Git.repoDescribe r , storeKey = uploadKey , retrieveKeyFile = downloadKey diff --git a/Remote/Web.hs b/Remote/Web.hs index 03cbe706d5..0cff68ceba 100644 --- a/Remote/Web.hs +++ b/Remote/Web.hs @@ -15,6 +15,7 @@ import qualified Git import qualified Git.Construct import Annex.Content import Config.Cost +import Config import Logs.Web import Annex.UUID import Messages.Progress @@ -40,10 +41,11 @@ list _autoinit = do return [r] gen :: Git.Repo -> UUID -> RemoteConfig -> RemoteGitConfig -> Annex (Maybe Remote) -gen r _ c gc = +gen r _ c gc = do + cst <- remoteCost gc expensiveRemoteCost return $ Just Remote { uuid = webUUID - , cost = expensiveRemoteCost + , cost = cst , name = Git.repoDescribe r , storeKey = uploadKey , retrieveKeyFile = downloadKey From 6091b7b9dbf8f749d51964270565cbbc87b7dd4f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 24 Jun 2018 17:38:18 -0400 Subject: [PATCH 2/4] info: Display uuid and description when a repository is identified by uuid, and for "here". --- CHANGELOG | 3 ++- Command/Info.hs | 39 +++++++++++++++++++++++---------------- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index f694af942b..7b67a65a9e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,6 @@ - * Support configuring remote.web.annex-cost and remote.bittorrent.annex-cost + * info: Display uuid and description when a repository is identified by + uuid, and for "here". git-annex (6.20180530) UNRELEASED; urgency=medium diff --git a/Command/Info.hs b/Command/Info.hs index 9e7e527296..37b25a557a 100644 --- a/Command/Info.hs +++ b/Command/Info.hs @@ -209,13 +209,16 @@ fileInfo o file k = showCustom (unwords ["info", file]) $ do remoteInfo :: InfoOptions -> Remote -> Annex () remoteInfo o r = showCustom (unwords ["info", Remote.name r]) $ do i <- map (\(k, v) -> simpleStat k (pure v)) <$> Remote.getInfo r - l <- selStats (remote_fast_stats r ++ i) (uuid_slow_stats (Remote.uuid r)) + let u = Remote.uuid r + l <- selStats + (uuid_fast_stats u ++ remote_fast_stats r ++ i) + (uuid_slow_stats u) evalStateT (mapM_ showStat l) (emptyStatInfo o) return True uuidInfo :: InfoOptions -> UUID -> Annex () uuidInfo o u = showCustom (unwords ["info", fromUUID u]) $ do - l <- selStats [] ((uuid_slow_stats u)) + l <- selStats (uuid_fast_stats u) (uuid_slow_stats u) evalStateT (mapM_ showStat l) (emptyStatInfo o) return True @@ -277,17 +280,21 @@ file_stats f k = remote_fast_stats :: Remote -> [Stat] remote_fast_stats r = map (\s -> s r) [ remote_name - , remote_description - , remote_uuid , remote_trust , remote_cost , remote_type ] +uuid_fast_stats :: UUID -> [Stat] +uuid_fast_stats u = map (\s -> s u) + [ repo_uuid + , repo_description + ] + uuid_slow_stats :: UUID -> [Stat] uuid_slow_stats u = map (\s -> s u) - [ remote_annex_keys - , remote_annex_size + [ repo_annex_keys + , repo_annex_size ] stat :: String -> (String -> StatState String) -> Stat @@ -353,13 +360,11 @@ file_name file = simpleStat "file" $ pure file remote_name :: Remote -> Stat remote_name r = simpleStat "remote" $ pure (Remote.name r) -remote_description :: Remote -> Stat -remote_description r = simpleStat "description" $ lift $ - Remote.prettyUUID (Remote.uuid r) +repo_description :: UUID -> Stat +repo_description = simpleStat "description" . lift . Remote.prettyUUID -remote_uuid :: Remote -> Stat -remote_uuid r = simpleStat "uuid" $ pure $ - fromUUID $ Remote.uuid r +repo_uuid :: UUID -> Stat +repo_uuid = simpleStat "uuid" . pure . fromUUID remote_trust :: Remote -> Stat remote_trust r = simpleStat "trust" $ lift $ @@ -381,12 +386,14 @@ local_annex_size :: Stat local_annex_size = simpleStat "local annex size" $ showSizeKeys =<< cachedPresentData -remote_annex_keys :: UUID -> Stat -remote_annex_keys u = stat "remote annex keys" $ json show $ +-- "remote" is in the name for JSON backwards-compatibility +repo_annex_keys :: UUID -> Stat +repo_annex_keys u = stat "remote annex keys" $ json show $ countKeys <$> cachedRemoteData u -remote_annex_size :: UUID -> Stat -remote_annex_size u = simpleStat "remote annex size" $ +-- "remote" is in the name for JSON backwards-compatibility +repo_annex_size :: UUID -> Stat +repo_annex_size u = simpleStat "remote annex size" $ showSizeKeys =<< cachedRemoteData u known_annex_files :: Bool -> Stat From fd725a0bb1557c32b7f918ff7098eaa3bf769cfd Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Wed, 23 May 2018 22:15:25 -0400 Subject: [PATCH 3/4] NF: a standalone-no-LOCPATH patch for the Debian standalone build --- debian/patches/series.standalone-build | 1 + debian/patches/standalone-no-LOCPATH | 53 ++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 debian/patches/standalone-no-LOCPATH diff --git a/debian/patches/series.standalone-build b/debian/patches/series.standalone-build index 9dc994164d..d70ec8b86a 100644 --- a/debian/patches/series.standalone-build +++ b/debian/patches/series.standalone-build @@ -1 +1,2 @@ standalone-build +standalone-no-LOCPATH diff --git a/debian/patches/standalone-no-LOCPATH b/debian/patches/standalone-no-LOCPATH new file mode 100644 index 0000000000..fde005d3aa --- /dev/null +++ b/debian/patches/standalone-no-LOCPATH @@ -0,0 +1,53 @@ +From 71cbc1012941495ec20a7cb11dad3da638aae2cf Mon Sep 17 00:00:00 2001 +From: Yaroslav Halchenko +Date: Tue, 22 May 2018 22:57:26 -0400 +Subject: BF: do not bother changing/setting LOCPATH + +Some of the initial reasoning and discussion is at + + https://github.com/datalad/datalad/pull/1921 + +but overall summary is that a typical standalone build relies on +user having RW permissions into its installation so locales are +generated upon initial use. For NeuroDebian standalone: + - built/installed by root + - locales are likely to be installed and be compatible +thus patching of LOCPATH seems to resolve some issues, primarily +with custom remotes which are ran by annex, thus provided with +LOCPATH + +--- + standalone/linux/skel/runshell | 10 ++-------- + 1 file changed, 2 insertions(+), 8 deletions(-) + +--- a/standalone/linux/skel/runshell ++++ b/standalone/linux/skel/runshell +@@ -118,12 +118,6 @@ export ORIG_MANPATH + MANPATH="$base/usr/share/man:$MANPATH" + export MANPATH + +-# Avoid using system locales, which may interact badly with bundled libc. +-ORIG_LOCPATH="$LOCPATH" +-export ORIG_LOCPATH +-LOCPATH="$base/locales" +-export LOCPATH +- + # LD_PRELOAD may interact badly with the bundled libc and other libraries, + # which may have a different subarchitecture than the preloaded library. + unset LD_PRELOAD +@@ -180,13 +174,13 @@ case "$os" in + GIT_ANNEX_TMP_DIR="$TMPDIR" + export GIT_ANNEX_TMP_DIR + +- GIT_ANNEX_STANDLONE_ENV="PATH GCONV_PATH MANPATH LOCPATH" ++ GIT_ANNEX_STANDLONE_ENV="PATH GCONV_PATH MANPATH" + export GIT_ANNEX_STANDLONE_ENV + ;; + *) + # Indicate which variables were exported above and should be cleaned + # when running non-bundled programs. +- GIT_ANNEX_STANDLONE_ENV="PATH GCONV_PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR MANPATH LOCPATH" ++ GIT_ANNEX_STANDLONE_ENV="PATH GCONV_PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR MANPATH" + export GIT_ANNEX_STANDLONE_ENV + ;; + esac From 74890e1457a94062cf4ba34246e4587a94cd2c88 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 25 Jun 2018 21:50:38 -0400 Subject: [PATCH 4/4] set 6.20180626 as urgent upgrade This causes the webapp to tell the user's it's an urgent upgrade, which this security fix is. --- Build/DistributionUpdate.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Build/DistributionUpdate.hs b/Build/DistributionUpdate.hs index 67433c5c5f..920cadb3e8 100644 --- a/Build/DistributionUpdate.hs +++ b/Build/DistributionUpdate.hs @@ -126,7 +126,7 @@ makeinfos updated version = do , distributionKey = k , distributionVersion = bv , distributionReleasedate = now - , distributionUrgentUpgrade = Nothing + , distributionUrgentUpgrade = Just "6.20180626" } liftIO $ writeFile infofile $ formatInfoFile d void $ inRepo $ runBool [Param "add", File infofile]