generic/398 contains workarounds to allow for renames of encrypted files
to fail with different error codes. However, these error codes were
fixed up by kernel commits
f5e55e777cc9 ("fscrypt: return -EXDEV for
incompatible rename or link into encrypted dir") and
0c1ad5242d4f
("ubifs: switch to fscrypt_prepare_rename()").
It's been long enough, so update the test to expect the correct behavior
only, so we don't accidentally reintroduce the wrong behavior.
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
-# The error code for incompatible rename or link into an encrypted directory was
-# changed from EPERM to EXDEV in Linux v5.1, to allow tools like 'mv' to work.
-# See kernel commit f5e55e777cc9 ("fscrypt: return -EXDEV for incompatible
-# rename or link into encrypted dir"). Accept both errors for now.
-filter_eperm_to_exdev()
-{
- sed -e 's/Operation not permitted/Invalid cross-device link/'
-}
-
-# The error code for incompatible cross-rename without the key has been ENOKEY
-# on all filesystems since Linux v4.16. Previously it was EPERM on some
-# filesystems. Accept both errors for now.
-filter_eperm_to_enokey()
-{
- sed -e 's/Operation not permitted/Required key not available/'
-}
-
# get standard environment, filters and checks
. ./common/rc
. ./common/filter
# get standard environment, filters and checks
. ./common/rc
. ./common/filter
# different encryption policy. Should fail with EXDEV.
echo -e "\n*** Link encrypted <= encrypted ***"
# different encryption policy. Should fail with EXDEV.
echo -e "\n*** Link encrypted <= encrypted ***"
-ln $edir1/efile1 $edir2/efile1 |& _filter_scratch | filter_eperm_to_exdev
+ln $edir1/efile1 $edir2/efile1 |& _filter_scratch
echo -e "\n*** Rename encrypted => encrypted ***"
echo -e "\n*** Rename encrypted => encrypted ***"
-$here/src/renameat2 $edir1/efile1 $edir2/efile1 |& filter_eperm_to_exdev
+$here/src/renameat2 $edir1/efile1 $edir2/efile1
# Test linking and renaming an unencrypted file into an encrypted directory.
# Should fail with EXDEV.
echo -e "\n\n*** Link unencrypted <= encrypted ***"
# Test linking and renaming an unencrypted file into an encrypted directory.
# Should fail with EXDEV.
echo -e "\n\n*** Link unencrypted <= encrypted ***"
-ln $udir/ufile $edir1/ufile |& _filter_scratch | filter_eperm_to_exdev
+ln $udir/ufile $edir1/ufile |& _filter_scratch
echo -e "\n*** Rename unencrypted => encrypted ***"
echo -e "\n*** Rename unencrypted => encrypted ***"
-$here/src/renameat2 $udir/ufile $edir1/ufile |& filter_eperm_to_exdev
+$here/src/renameat2 $udir/ufile $edir1/ufile
# Test linking and renaming an encrypted file into an unencrypted directory.
# Test linking and renaming an encrypted file into an unencrypted directory.
# rename) operation. Should fail with EXDEV.
echo -e "\n\n*** Exchange encrypted <=> encrypted ***"
# rename) operation. Should fail with EXDEV.
echo -e "\n\n*** Exchange encrypted <=> encrypted ***"
-$here/src/renameat2 -x $edir1/efile1 $edir2/efile2 |& filter_eperm_to_exdev
+$here/src/renameat2 -x $edir1/efile1 $edir2/efile2
echo -e "\n*** Exchange unencrypted <=> encrypted ***"
echo -e "\n*** Exchange unencrypted <=> encrypted ***"
-$here/src/renameat2 -x $udir/ufile $edir1/efile1 |& filter_eperm_to_exdev
+$here/src/renameat2 -x $udir/ufile $edir1/efile1
echo -e "\n*** Exchange encrypted <=> unencrypted ***"
echo -e "\n*** Exchange encrypted <=> unencrypted ***"
-$here/src/renameat2 -x $edir1/efile1 $udir/ufile |& filter_eperm_to_exdev
+$here/src/renameat2 -x $edir1/efile1 $udir/ufile
# Test a file with a special type, i.e. not regular, directory, or symlink.
# Test a file with a special type, i.e. not regular, directory, or symlink.
efile2=$(find $edir2 -type f)
echo -e "\n\n*** Exchange encrypted <=> encrypted without key ***"
efile2=$(find $edir2 -type f)
echo -e "\n\n*** Exchange encrypted <=> encrypted without key ***"
-$here/src/renameat2 -x $efile1 $efile2 |& filter_eperm_to_enokey
+$here/src/renameat2 -x $efile1 $efile2
echo -e "\n*** Exchange encrypted <=> unencrypted without key ***"
echo -e "\n*** Exchange encrypted <=> unencrypted without key ***"
-$here/src/renameat2 -x $efile1 $udir/ufile |& filter_eperm_to_enokey
+$here/src/renameat2 -x $efile1 $udir/ufile
# success, all done
status=0
# success, all done
status=0