-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
Describe the bug
On macOS, by default the file system is case insensitive. This can quickly lead to problems.
Imagine the following project:
Makefile
source/conf.py
source/index.rst
source/upper/A.png
source/lower/a.png
where index.rst contains:
====
Test
====
.. image:: lower/a.png
.. image:: upper/A.pngWhen building this with *html or latex on macOS (with a case-insensitive filesystem), you always end up with one file (usually a.png, having the content of source/upper/A.png) that is used twice in the rendered document. I guess the same would happen on Windows, where the filesystem is also case-insensitive by default.
My expectation would be that Sphinx uses different filenames (like a.png, A2.png) to avoid such collisions, as it does when the same filename (with the same case) is used twice for different images. Obviously this is somewhat problematic, since then you would get a different built depending on whether you're using macOS or Linux to build a docsite, if such case collisions occur.
Ideas:
-
Try to detect this and emit a warning when this happens during building. I'm not sure how easy/hard this is to implement, since the build directory is not always clean.
-
Always avoid filenames that only differ in casing. Unfortunately this is a breaking change, since for existing docsites that had such collisions but were only used on case-sensitive file systems, the image filenames suddenly change.
-
Make it configurable whether filenames differing in case should be avoided, with default being "don't avoid them" (i.e. current behavior), but when creating a new config, put in the setting with value "avoid them".
-
Maybe something else?
How to Reproduce
See description above. You can use basically any conf.py for this.
Environment Information
Latest Sphinx. (Likely not relevant.)
Sphinx extensions
Additional context
No response