Safename: restricting “dangerous” file names
lwn.net
lwn.net
Not to mention the error handling:
Any attempt to create a file name that fails the tests will be rejected with an EPERM error
So the user will get a "permission denied" error when trying to save a file instead of "the file name contained invalid characters, which are...".
For example, what about Unicode normalization? It's enforced on OS X. Maybe I want to block anything that differs according to normalization form.
I might want to limit characters to 2 accents at most. (this covers Vietnamese)
I might want only left-to-right characters or LGC characters.
I might want to block confusing look-alike characters, particularly those the non-ASCII ones that look like ASCII.
mkdir some-test
cd some-test
mkdir some-dir
echo foo > some-dir/some-file
echo bar > -Rf
ls -l
rm *
ls -l