Disable normalization implicitly when setting "utf8only=off". #12038
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation and Context
When creating a new zfs file system and
-o utf8only=offis passed as a parameter, the option could silently be overridden and switched to the on state due to the parent dataset having a normalization value != none. This is counter-intuitive and potentially harmful as it may go unnoticed until a non-UTF8 conforming file name is attempted to be created, at which moment the normal error about an invalid UTF8 sequence will be returned.The zfsprops(8) manpage for utf8only has language already that might imply this: "If this property is explicitly set to off, the normalization property must either not be explicitly set or be set to none."
I describe the issue in #11892 with an example sequence of commands that triggers the bad behavior.
Description
lib/libzfs/libzfs_dataset.calready has code that detects when the normalization property is set and switches utf8only to on. Added another conditional to set normalization to none when utf8only is set to off.How Has This Been Tested?
Compiled a version of ZFS with this change, ran my sample commands as I presented in the open issue, and checked the utf8only and normalization properties to make sure they are set as appropriate.
Types of changes
Checklist:
Signed-off-by.