I guess there are 2 parts to the issue.
Part 1 is reproducible.
Open an existing lpi in an editor outside the IDE and add units
I have a folder on the D drive, so I added some from there. I even used the same folder, but in one case I lowercased the drive letter. (by default they should be uppercase).
And with that the IDE displays this as 2 different path.
<Units>
....
<Unit>
<Filename Value="D:\lazarus64\lcl\arrow.pp"/>
<IsPartOfProject Value="True"/>
</Unit>
<Unit>
<Filename Value="d:\lazarus64\lcl\controls.pp"/>
<IsPartOfProject Value="True"/>
</Unit>
</Units>
Note, for me the OS always gives uppercase letters, and other than editing the XML, I have not found a way to get a lowercase drive letter in there.
However, the casing of a folder could change. And I have not tested, but have a suspicion that if I change the casing of a folder for which I have some files already added, and then add more to the LPI => that will have similar effects.
That leaves part 2
How can such a drive letter end up in the lpi, without editing the file by hand.
Ultimately, since it likely can happen for folders, the compare algorithm may need to be adjusted...