kubo: 0.34.1 -> 0.35.0 (#410858)

This commit is contained in:
Matthias Beyer
2025-07-06 13:51:16 +02:00
committed by GitHub
3 changed files with 50 additions and 10 deletions
@@ -161,7 +161,7 @@ in
autoMount = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Whether Kubo should try to mount /ipfs and /ipns at startup.";
description = "Whether Kubo should try to mount /ipfs, /ipns and /mfs at startup.";
};
autoMigrate = lib.mkOption {
@@ -236,6 +236,12 @@ in
default = "/ipns";
description = "Where to mount the IPNS namespace to";
};
Mounts.MFS = lib.mkOption {
type = lib.types.str;
default = "/mfs";
description = "Where to mount the MFS namespace to";
};
};
};
description = ''
@@ -356,6 +362,7 @@ in
${cfg.dataDir}.d = defaultConfig;
${cfg.settings.Mounts.IPFS}.d = lib.mkIf (cfg.autoMount) defaultConfig;
${cfg.settings.Mounts.IPNS}.d = lib.mkIf (cfg.autoMount) defaultConfig;
${cfg.settings.Mounts.MFS}.d = lib.mkIf (cfg.autoMount) defaultConfig;
};
# The hardened systemd unit breaks the fuse-mount function according to documentation in the unit file itself
@@ -401,8 +408,8 @@ in
ipfs --offline config replace -
'';
postStop = lib.mkIf cfg.autoMount ''
# After an unclean shutdown the fuse mounts at cfg.settings.Mounts.IPFS and cfg.settings.Mounts.IPNS are locked
umount --quiet '${cfg.settings.Mounts.IPFS}' '${cfg.settings.Mounts.IPNS}' || true
# After an unclean shutdown the fuse mounts at cfg.settings.Mounts.IPFS, cfg.settings.Mounts.IPNS and cfg.settings.Mounts.MFS are locked
umount --quiet '${cfg.settings.Mounts.IPFS}' '${cfg.settings.Mounts.IPNS}' '${cfg.settings.Mounts.MFS}' || true
'';
serviceConfig = {
ExecStart = [
+38 -5
View File
@@ -27,8 +27,12 @@
testScript = ''
start_all()
with subtest("FUSE mountpoint"):
machine.fail("echo a | su bob -l -c 'ipfs add --quieter'")
with subtest("Create a file for testing"):
machine.succeed("echo 'fnord3' > /tmp/test.txt")
with subtest("/ipfs/ FUSE mountpoint"):
machine.fail("su bob -l -c 'ipfs add --quieter' < /tmp/test.txt")
# The FUSE mount functionality is broken as of v0.13.0. This is still the case with v0.29.0.
# See https://github.com/ipfs/kubo/issues/9044.
# Workaround: using CID Version 1 avoids that.
@@ -36,13 +40,42 @@
"echo fnord3 | su alice -l -c 'ipfs add --quieter --cid-version=1'"
).strip()
machine.succeed(f"cat /ipfs/{ipfs_hash} | grep fnord3")
machine.succeed(f"diff /tmp/test.txt /ipfs/{ipfs_hash}")
with subtest("Unmounting of /ipns and /ipfs"):
with subtest("/mfs/ FUSE mountpoint"):
with subtest("Write the test file in three different ways"):
machine.succeed("cp /tmp/test.txt /mfs/test-1.txt")
machine.succeed("su alice -c 'ipfs files write --create /test-2.txt < /tmp/test.txt'")
machine.succeed(f"ipfs files cp /ipfs/{ipfs_hash} /test-3.txt")
with subtest("Show the files (for debugging)"):
# Different hashes for the different ways of adding the file to the MFS probably come from different linking structures of the merkle tree. Copying the file to /mfs with `cp` is even non-deterministic.
machine.succeed("ipfs files ls --long >&2")
machine.succeed("ls -l /mfs >&2")
with subtest("Check that everyone has permission to read the file (because of Mounts.FuseAllowOther)"):
machine.succeed("su alice -c 'cat /mfs/test-1.txt' | grep fnord3")
machine.succeed("su bob -c 'cat /mfs/test-1.txt' | grep fnord3")
with subtest("Check the file contents"):
machine.succeed("diff /tmp/test.txt /mfs/test-1.txt")
machine.succeed("diff /tmp/test.txt /mfs/test-2.txt")
machine.succeed("diff /tmp/test.txt /mfs/test-3.txt")
with subtest("Check the CID extended attribute"):
output = machine.succeed(
"getfattr --only-values --name=ipfs_cid /mfs/test-3.txt"
).strip()
assert ipfs_hash == output, f"Expected {ipfs_hash} but got {output}"
with subtest("Unmounting of /ipns, /ipfs and /mfs"):
# Force Kubo to crash and wait for it to restart
machine.systemctl("kill --signal=SIGKILL ipfs.service")
machine.wait_for_unit("ipfs.service", timeout = 30)
machine.succeed(f"cat /ipfs/{ipfs_hash} | grep fnord3")
machine.succeed(f"diff /tmp/test.txt /ipfs/{ipfs_hash}")
machine.succeed("diff /tmp/test.txt /mfs/test-3.txt")
'';
}
+2 -2
View File
@@ -8,7 +8,7 @@
buildGoModule rec {
pname = "kubo";
version = "0.34.1"; # When updating, also check if the repo version changed and adjust repoVersion below
version = "0.35.0"; # When updating, also check if the repo version changed and adjust repoVersion below
rev = "v${version}";
passthru.repoVersion = "16"; # Also update kubo-migrator when changing the repo version
@@ -16,7 +16,7 @@ buildGoModule rec {
# Kubo makes changes to its source tarball that don't match the git source.
src = fetchurl {
url = "https://github.com/ipfs/kubo/releases/download/${rev}/kubo-source.tar.gz";
hash = "sha256-wrAnmPfls7LFO3gQBISSmn4ucuUVmzvYEoz+eVc/A5M=";
hash = "sha256-OubXaa2JWbEaakDV6pExm5PkiZ5XPd9uG+S4KwWb0xQ=";
};
# tarball contains multiple files/directories