rust icon indicating copy to clipboard operation
rust copied to clipboard

Rustdoc: pages are being overwritten on the file systems with case-insensitive names

Open DoumanAsh opened this issue 11 years ago • 6 comments

Not sure if we can work around the case-insensitivity but when generating docs for the identifiers with the same name, but different cases(well it is ok for Rust after all :)) Like: https://github.com/DoumanAsh/trace-macro/blob/master/src/lib.rs#L29 https://github.com/DoumanAsh/trace-macro/blob/master/src/lib.rs#L150

We will have only one page, instead of two. I suspect that the last generated page will overwrite the first one since from Win file-system point of view it will be the same file.(And NTFS is also case-insensitive?)

I'm not sure what would be a good work around for that. I suppose it would be good idea to track names to avoid such issues and if there are several identifiers with the same names(different case) it should warn and generate pages with some suffix(like [-num]). Or even no need to warn, after all docs will be generated successfully.

Rust stable 1.0 rustdoc 1.0.0 (a59de37e9 2015-05-13) (built 2015-05-14) Win8 x64

DoumanAsh avatar May 29 '15 15:05 DoumanAsh

cc me (and also, sigh)

If anyone wants to tackle this I'm happy to mentor, however, it won't be super-easy.

nrc avatar Jul 26 '16 23:07 nrc

Triage: i'm not aware of any changes here, nor any plans to fix this any time soon

steveklabnik avatar Oct 31 '18 14:10 steveklabnik

One option would be to generate a disambiguation page whenever this problem is detected. That way inbound links will still work correctly, with the only downside that the user has to click an extra time.

Diggsey avatar Dec 01 '20 18:12 Diggsey

I would edit the summary to make this clearer, but this affects:

  • Windows (all vFAT, EXFAT, NTFS without FILE_FLAG_POSIX_SEMANTICS)
  • MacOSX (HFS+ and APFS both default to case insensitivity and require a reformat to be case sensitive).

rbtcollins avatar Mar 16 '21 21:03 rbtcollins

Is this not the general problem of tying filenames directly to Rust identifiers? For example an easy way to break rustdoc on Windows is:

pub mod nul {}

ChrisDenton avatar Mar 19 '21 10:03 ChrisDenton

I'd like to work on this. Building on the disambiguation-page idea above, here's the plan:

  • Detect item paths that collide after case folding when rustdoc writes its output.
  • Give the colliding items distinct, stable filenames, and write a disambiguation page at the original path so existing inbound links keep working.
  • Add rustdoc tests for colliding modules and types.

Before I start, could a rustdoc team member confirm this approach is acceptable, or point me to a preferred one?

HavishJadav avatar Nov 30 '26 10:11 HavishJadav