[PATCH] ld: don't use SAME_INODE for the duplicate-script check on hosts without inodes
Alan Modra
amodra@gmail.com
Wed Aug 19 06:14:21 GMT 2026
On Tue, Aug 18, 2026 at 06:30:59AM +0000, Cole Munz wrote:
> On Tue, Aug 18, 2026 at 03:30:44PM +0930, Alan Modra wrote:
> > That says there is a bug in SAME_INODE, and in upstream gnulib too.
> > I will apply the following.
>
> Agreed, and that is the right layer for it. I tested the two macros side by
> side:
>
> two different files on D: (st_ino 0, st_dev 3)
> old -> 1 treats them as the same file
> new -> 0 correct
> two different files on drive 0 (st_ino 0, st_dev 0)
> old -> 0 new -> 0
> same file, real inode info
> old -> 1 new -> 1 still detects real duplicates
> different files, real inode info
> old -> 0 new -> 0
>
> So it removes the false positive without weakening the case where inodes
> work.
>
> One consequence worth a decision. Once SAME_INODE is false whenever st_ino
> is 0, ld's PR 24576 check goes inert on native Windows, so someone who does
> pass the same script twice there gets no diagnostic at all.
Right. binutils-2.33 through binutils-2.45 had checks that compared
file names, which worked on windows except when people were creative
with paths. binutils-2.46 had no check on windows and binutile-2.47
was broken by me noticing the check wasn't enabled.
I'll apply your patch.
> My patch kept
> that check alive on such hosts by falling back to a name comparison when
> stat gives nothing usable.
>
> Either is defensible. Drop my ld patch and let PR 24576 only cover hosts
> with real inodes, or take same-inode.h plus the name fallback and keep the
> diagnostic everywhere. I have no preference, I just did not want the check
> to go quiet as a side effect rather than as a choice.
>
> Cole
--
Alan Modra
More information about the Binutils
mailing list