Ending the scourge of spaces and control characters in filenames

Viewed 48

I hate spaces in filenames. It's a bad plan. I just don't want 'em.

They make shell scripting tedious, cause security problems, and are just generally annoying.

At one point, I wrote a fuse filesystem which I could mount over my home directory to protect it from this menace, and it worked pretty well. Each entry which took a pathname simply replaced anything that triggered isspace(ch) with either an underscore or a %\d\d\d sequence like urlencoding. It worked fine, though it was a little slow, and surprisingly did not break programs like chrome and firefox (the worse offenders). They kept asking for and creating filenames with spaces, and I kept giving them filenames without.

That code got lost in the mists of time, and now I've got a wild hair about it again. This time, I'd like to hack the kernel itself, rather than using fuse.

So the question is, what is the best way to attack the problem if I am going to hack the kernel itself? I'm looking at functions like kern_path and file_lookup, and making some sense of them, but it's a lot more complex than my fuse driver, which simply took its arguments, debauched them, and passed them on.

0 Answers
Related