btrfs / btrfs-todo

An issues only repo to organize our TODO items
21 stars 2 forks source link

File Name restriction policy by case, whitelist and blacklist. #58

Open glowingwire opened 4 months ago

glowingwire commented 4 months ago

I would like to limit my filenames to be case preserving but prohibit files to be of alternative case, for compatibility with case insensitive operating systems.

I would also like to restrict the characters to valid unicode, and restrict characters that have control characters for terminals and characters used to trick people. I would block * \ and some other characters, and warn on some characters like - and ! and | the list is something I would like to be able to choose myself, and might compile lists or warnings based on characters being usable by terminals.

For files already on the volume, I would want to be able to let it go, throw an error or warning and possibly refactor the filename to be configurable to display these characters as escaped code/unicode reference or similar , this to be determined by arbitrary list.

I would also want to be able to artificially limit the number of characters/bytes/ in a file name.

I imagine this would be modifiable by catting settings in something like /sys/filesystem/volume/subvolume/options/caseinsensitive casepreserving error_if_differs_by_case restricttounicode errorlist warnlist escape_non_ascii maxfilenamebytes maxfilenamechars

This might be something useful for more filesystems than just BTRFS,

When Linux gets made for the everyday user, inserting a usb drive and trying to edit a file shouldn't bork the system by just having a strange but valid filename, especially ones that the user cannot type.

I've had my terminal be goofed up by doing an ls in a folder. My end users should not have to experience that, and should be willing to pay to not have to deal with that.