Skip to content

testing/asserting case sensitivity

4 messages · Ben Bolker, Kirill Müller, Taras Zakharko +1 more

#
I have a problem/annoyance with students who are working on MacOS and 
sharing Git repositories with data file and code where the strings used 
in their code to designate the data files are not case-matched to the 
actual names of the files on disk.  They don't notice this because 
they're using a case-insensitive file system on MacOS, but it bites me 
when I try to run the code on my Linux system.

   I can of course tell them to be more careful, but: is there any kind 
of programmatic check for this that they could use when testing their 
code before submission? (Students are not super-technically savvy, so 
telling them to adjust the properties of their file systems, even if 
it's something that's possible, is not a realistic option; neither is 
telling them to use GitHub Actions to run checks elsewhere ...)

   I'm imagining (ideally) some kind of _CHECK_CASE_STRICTLY_ 
environment variable/options setting/etc., but I'd be interested in any 
creative solutions.

   Tangentially related:

https://www.reddit.com/r/MacOS/comments/1ha36y5/macos_apfs_caseinsensitive_and_handling_git_repo/

   cheers
    Ben Bolker
#
Would it be an option for you to use a case-insensitive 
mount/subdirectory on your Linux system?


Best regards

Kirill
On 17.01.2026 21:57, Ben Bolker wrote:
#
Ben,

The way I approach these things is using Github Classrooms and pre-configured Actions. Takes a bit of extra work to set up initially but saves so much time in the long run.

Otherwise, the "classical" solution would be to mandate that all files should have lowercase naming in your rubrics and dock points for violations ? One could provide them with a script that checks that everything in the project folder follows the naming conventions.

I am less convinced that a feasible solution can be found from within R itself.

Best,

Taras
#
Ben,

I don't think there is anything possible on the R side, because R itself just relies on the system calls and there are just way too many ways to access files so it?s impossible to cover them all. The thing you are looking for is when opening an existing file to check if the name on disk matches the name that is open - which in theory you could do if you hijacked the most common syscalls like open/fopen and routed them through that extra logic, but macOS security protection measures are trying to prevent you from doing things like that.

The best I can think of is to give them a script they can run on their Mac which will check out the repo in a case-sensitive temporary volume and run their code there:

# create 256Mb case-sensitive ram disk "GitTest"
diskutil erasevolume APFSX GitTest $(hdiutil attach -nomount ram://524288)

## do the test there
cd /Volumes/GitTest
git clone git at github.com:student/myAssignment.git
cd myAssignment
Rscript -e 'rmardown::render("assignment.Rmd")'

## go home and eject
cd
hdiutil eject /Volumes/GitTest

RAM disk is convenient since you can script it fully, but may be tricky if your data/analysis is very big.

Cheers,
Simon