From fdc738fb70137613aebb4b5fcde7dcb1cde9133b Mon Sep 17 00:00:00 2001 From: greatroar <61184462+greatroar@users.noreply.github.com> Date: Sun, 13 Mar 2022 16:42:43 +0100 Subject: [PATCH] Report symlink sizes from FUSE mount Fixes #3667. --- changelog/unreleased/issue-3667 | 8 ++++++++ internal/fuse/link.go | 3 +++ 2 files changed, 11 insertions(+) create mode 100644 changelog/unreleased/issue-3667 diff --git a/changelog/unreleased/issue-3667 b/changelog/unreleased/issue-3667 new file mode 100644 index 000000000..bd2613dad --- /dev/null +++ b/changelog/unreleased/issue-3667 @@ -0,0 +1,8 @@ +Bugfix: restic mount now reports symlinks sizes + +Symlinks used to have size zero in restic mountpoints, confusing some +third-party tools. They now have a size equal to the byte length of their +target path, as required by POSIX. + +https://github.com/restic/restic/issues/3667 +https://github.com/restic/restic/pull/3668 diff --git a/internal/fuse/link.go b/internal/fuse/link.go index 23752f781..6953ecfb3 100644 --- a/internal/fuse/link.go +++ b/internal/fuse/link.go @@ -1,3 +1,4 @@ +//go:build darwin || freebsd || linux // +build darwin freebsd linux package fuse @@ -40,6 +41,8 @@ func (l *link) Attr(ctx context.Context, a *fuse.Attr) error { a.Mtime = l.node.ModTime a.Nlink = uint32(l.node.Links) + a.Size = uint64(len(l.node.LinkTarget)) + a.Blocks = 1 + a.Size/blockSize return nil }