From 57a749b308a07e26452a794533b4854d70212499 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Mon, 17 Feb 2025 14:41:29 -0800 Subject: Fix non-constant format string passed to errors.Wrapf() Do not pass a path as the format string argument to errors.Wrapf(), as this causes it to be misinterpreted as a format string, causing an unexpected message if the path contains something like '%s'. Instead use errors.Wrap(). This was diagnosed by Go 1.24. Fixes https://github.com/google/fscrypt/issues/422 --- cmd/fscrypt/commands.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/fscrypt/commands.go b/cmd/fscrypt/commands.go index 30aa3a7..3fc68a9 100644 --- a/cmd/fscrypt/commands.go +++ b/cmd/fscrypt/commands.go @@ -414,7 +414,7 @@ func unlockAction(c *cli.Context) error { if policy.IsProvisionedByTargetUser() { log.Printf("policy %s is already provisioned by %v", policy.Descriptor(), ctx.TargetUser.Username) - return newExitError(c, errors.Wrapf(ErrDirAlreadyUnlocked, path)) + return newExitError(c, errors.Wrap(ErrDirAlreadyUnlocked, path)) } if err := policy.Unlock(optionFn, existingKeyFn); err != nil { @@ -521,7 +521,7 @@ func lockAction(c *cli.Context) error { // locking the directory by dropping caches again. if !policy.NeedsUserKeyring() || !isDirUnlockedHeuristic(path) { log.Printf("policy %s is already fully deprovisioned", policy.Descriptor()) - return newExitError(c, errors.Wrapf(ErrDirAlreadyLocked, path)) + return newExitError(c, errors.Wrap(ErrDirAlreadyLocked, path)) } } -- cgit v1.2.3