From a7dcac672f042f1f39a01a2d2c137639fc4fe1da Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Fri, 8 Oct 2021 16:22:30 +0300 Subject: [PATCH] Fix RenameOp compatibility with macfuse 4.x Closed-source macfuse 4.x has broken compatibility with osxfuse 3.x: it passes an additional 64-bit field (flags) after RenameIn regardless that we don't enable the support for RENAME_SWAP/RENAME_EXCL. The simplest fix is just to check for the presence of all-zero flags and strip them when they're present. --- conversions.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/conversions.go b/conversions.go index 6750369..9f2590f 100644 --- a/conversions.go +++ b/conversions.go @@ -207,6 +207,15 @@ func convertInMessage( } names := inMsg.ConsumeBytes(inMsg.Len()) + // closed-source macfuse 4.x has broken compatibility with osxfuse 3.x: + // it passes an additional 64-bit field (flags) after RenameIn regardless + // that we don't enable the support for RENAME_SWAP/RENAME_EXCL + // the simplest fix is just to check for the presence of all-zero flags + if len(names) >= 8 && + names[0] == 0 && names[1] == 0 && names[2] == 0 && names[3] == 0 && + names[4] == 0 && names[5] == 0 && names[6] == 0 && names[7] == 0 { + names = names[8 : ] + } // names should be "old\x00new\x00" if len(names) < 4 { return nil, errors.New("Corrupt OpRename")