Single character filenames
When Steve Bourne was writing his Unix shell (which came to be known as the Bourne shell), he made a directory of 254 files with one-character names, one for each byte value except'\0'
andslash
, the two characters that cannot appear in Unix file names. He used that directory for all manner of tests of pattern-matching and tokenization. (The test directory was of course created by a program.) For years after-wards, that directory was the bane of file-tree-walking programs; it tested them to destruction.
—The Practice of Programming - p158
A program walking a directory structure of arbitrary filenames needs to be very resilient. It needs to handle any valid filename and should not expect the filenames to only be a specific subset of e.g. ASCII. Here is a small C program that takes a directory as input and creates all one byte filenames for testing. A directory containing these files should be considered at minimum and does not constitute an exhaustive test suite. You can compile it with
cc one_character_filenames.c -o one_character_filenames
and can be used like this
one_character_filenames DIRECTORY
This program is so simple that it should be considered public domain.