From b5e72e2fc31e767e8e50f6924ac3d78e185b0947 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Mon, 10 Feb 2025 17:13:59 +0000 Subject: [PATCH] vfs: fix the cache failing to upload symlinks when --links was specified Before this change, if --vfs-cache-mode writes or above was set and --links was in use, when a symlink was saved then the VFS failed to upload it. This meant when the VFS was restarted the link wasn't there any more. This was caused by the local backend, which we use to manage the VFS cache, picking up the global --links flag. This patch makes sure that the internal instantations of the local backend in the VFS cache don't ever use the --links flag or the --local-links flag even if specified on the command line. Fixes #8367 --- vfs/vfscache/cache.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vfs/vfscache/cache.go b/vfs/vfscache/cache.go index 9e228aacf..0ffa30c76 100644 --- a/vfs/vfscache/cache.go +++ b/vfs/vfscache/cache.go @@ -227,7 +227,10 @@ func (c *Cache) createItemDir(name string) (string, error) { // getBackend gets a backend for a cache root dir func getBackend(ctx context.Context, parentPath string, name string, relativeDirPath string) (fs.Fs, error) { - path := fmt.Sprintf(":local,encoding='%v':%s/%s/%s", encoder.OS, parentPath, name, relativeDirPath) + // Make sure we turn off the global links flag as it overrides the backend specific one + ctx, ci := fs.AddConfig(ctx) + ci.Links = false + path := fmt.Sprintf(":local,encoding='%v',links=false:%s/%s/%s", encoder.OS, parentPath, name, relativeDirPath) return fscache.Get(ctx, path) }