Ticket #1149 (closed defect: wontfix)

Opened 6 years ago

Last modified 6 years ago

No case-sensitive filenames across platforms

Reported by: albert Owned by: justinc
Priority: major Milestone:
Component: repy Version: 0.1t
Severity: Medium Keywords:
Cc: justinc Blocking:
Blocked By:

Description

Due to differences in the underlying file systems, files named AFILENAME and afilename might or might not be distinguishable on an operating system. Seattle is affected by this, too, as are other programs. Find an example at the end of this ticket.

I've validated this problem using a little Repy script (see below) on

  • Windows 7, 64 bit, German locale, using NTFS (which is strange, NTFS should work case-sensitive)
  • Mac OS X 10.6.8, 64 bit, German locale, on Mac OS Extended and Journaled (which is a known, ahem, property of the file system)
  • the FAT partition that Seattle lives in on our Android 2.3.7 (FAT is never case-sensitive on any platform)

The last point makes installs on thumb drives, SD cards etc. problematic, no matter what OS the host mounting the device runs -- these devices are often used with FAT.

By the way, testing on a couple of PlanetLab node the clearinghouse gave me indicated that Linux with ext2 (and later) does not exhibit this problem, which is expected, too.

Potential fixes:

  • Enforce single-case file names in emulfile.py, and change the API documentation accordingly.
  • Go the Lind / TryRepy! way: Map file names as used by Repy into, e.g., Base-32 encoded strings that are used as actual file names.

Test script:

if callfunc=="initialize":

  filenames = ['AFILENAME', 'afilename', 'AfiLEnaMe']
  teststrings = ['First write attempt!', 'Second attempt.', 
    'Yet another attempt; it\'s the third already...']

  # Fill the files with data
  for filename, teststring in zip(filenames, teststrings):
    print "Writing '"+teststring+"' into file '"+filename+"'..."
    file = open(filename, "w")
    file.write(teststring)
    file.flush()
    file.close()
    print "Done!"

  # Validate that different files store different things
  for filename, teststring in zip(filenames, teststrings):
    file = open(filename, "r")
    data = file.read()
    file.close()
    assert data == teststring, ("In file '" + filename + 
      "', I expected '" + teststring + "', but found '" +
      data + "'. How sad!")

  # If we ever end up here, no assertion failed. Good news!
  print "All is well. Files included the data I expected. Bye!"

Non-Seattle example on Mac OS X 10.6.8 on a Mac OS Extended/Journaled hard disk:

~ albert$ cat FILENAME
cat: FILENAME: No such file or directory
~ albert$ echo foo! >> filename
~ albert$ cat FILENAME   # clearly not the name of the file we appended to
foo!
~ albert$ rm fIlEnAmE   # not that file name, either
~ albert$ cat filename   # but it's gone:
cat: filename: No such file or directory
~ albert$ cat FILENAME
cat: FILENAME: No such file or directory

Change History

Changed 6 years ago by justinc

  • status changed from new to closed
  • resolution set to wontfix

For backwards compatibility, we're unlikely to fix this in Repy V1. It is fixed in Repy V2, however.

Changed 6 years ago by albert

Yes, Repy V2 does this right. In v2's emulfile.py, the filename is checked against a set of allowed characters ALLOWED_FILENAME_CHAR_SET which includes only lower-case letters (and digits and such).

Note: See TracTickets for help on using tickets.