diff mbox series

[3/3] common/encrypt: accept '-' character in no-key names

Message ID 20210718190658.61621-4-ebiggers@kernel.org (mailing list archive)
State New, archived
Headers show
Series xfstests: fscrypt no-key name updates | expand

Commit Message

Eric Biggers July 18, 2021, 7:06 p.m. UTC
From: Eric Biggers <ebiggers@google.com>

Add the '-' character to the regex that generic/{419,429} use to match
no-key filenames.  This is needed to prevent these tests from failing
after the kernel is changed to use a more standard variant of Base64
(https://lkml.kernel.org/r/20210718000125.59701-1-ebiggers@kernel.org).

Note that despite breaking these tests, the kernel change is not
expected to break any real users, as the fscrypt no-key name encoding
has always been considered an implementation detail.  So it is
appropriate to just update these tests.

Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 common/encrypt | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/common/encrypt b/common/encrypt
index 766a6d81..f90c4ef0 100644
--- a/common/encrypt
+++ b/common/encrypt
@@ -935,5 +935,8 @@  _filter_nokey_filenames()
 {
 	local dir=$1
 
-	sed "s|${dir}${dir:+/}[A-Za-z0-9+,_]\+|${dir}${dir:+/}NOKEY_NAME|g"
+	# The no-key name format is a filesystem implementation detail that has
+	# varied slightly over time.  Just look for names that consist entirely
+	# of characters that have ever been used in such names.
+	sed "s|${dir}${dir:+/}[A-Za-z0-9+,_-]\+|${dir}${dir:+/}NOKEY_NAME|g"
 }