How can I simulate a FAT12 filesystem with uppercase 8.3 filenames?

Solution 1:

You seem to struggle with presence of long names on FS you suppose to restrict by pure MSDOS conventions. Then use "-t msdos" rather than "-t vfat". Otherwise, VFAT will only store long names for "impossible" files along with constructing short alternatives to them.

You'll have to remove "shortname" option as "msdos" FS is not aware what "short names" mean for.

BTW, there's another error in your script making it unworkable as you intend: you missed "loop" option in mount command, hence it'll report in error and all further operations will happen in ${MOUNTPOINT} directory of underlying FS rather than the tested FS in your test file. You seemed to edit your script / output before posting because there's an obvious mistyped backslash "\" before your "sudo mount" command. So, the correct mount command will be like that:

sudo mount ${IMAGE} ${MOUNTPOINT} -t msdos -o loop,fat=12,check=strict,uid=1000,gid=1000,debug

One more note: in MSDOS mode, names on disk are stored only in uppercase. So, "msdos" FS Linux developers took decision to convert and display all names only to/from lowercase while storing them still in uppercase. That means your tests for cases will work the opposite: allowing only names all in lowercase but reject any uppercase chars. While it may cause inconveniences for your tests, the names in your file will always be created correctly and all mixed duplicates rejected (as well as other non-8.3 anomalies), so I believe you'll be able to adapt your situation to this particular peculiarity of mounting MSDOS FS in Linux.