Page MenuHomeFreeBSD

localedef: Use consistent sorting order
ClosedPublic

Authored by markj on Mon, Jun 9, 6:29 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Jul 5, 11:59 AM
Unknown Object (File)
Thu, Jul 3, 7:33 PM
Unknown Object (File)
Thu, Jul 3, 6:47 PM
Unknown Object (File)
Mon, Jun 30, 5:31 PM
Unknown Object (File)
Mon, Jun 30, 9:18 AM
Unknown Object (File)
Sun, Jun 29, 4:19 PM
Unknown Object (File)
Sun, Jun 29, 5:43 AM
Unknown Object (File)
Thu, Jun 26, 6:29 AM
Subscribers

Details

Summary

In several modules we build up an RB tree keyed by wide characters.
wchar_t has different signedness on different platforms, so iteration
over such a tree results in platform-dependent ordering.

The ctype module uses this ordering when writing the output file, which
creates reproducibility problems when comparing the results of cross
builds and native builds (e.g., native amd64 vs. cross-building on
arm64).

Modify such comparisons to always be unsigned. Introduce a helper
function for this purpose. In the other modules I believe the sort
order does not affect program output.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

markj requested review of this revision.Mon, Jun 9, 6:29 PM

With this change does the cross-compiled one now match the native one, or is it the other way around? It looks like we just mmap this file so I'm curious what will happen if the ordering changes.

With this change does the cross-compiled one now match the native one, or is it the other way around? It looks like we just mmap this file so I'm curious what will happen if the ordering changes.

It changes the output of one ctype file (zh_CN.GB18030) on amd64. Specifically, the arrays written by the wr_category() calls in dump_type() are permuted. The size of the file doesn't change.

This revision was not accepted when it landed; it landed in state Needs Review.Fri, Jun 20, 4:40 PM
This revision was automatically updated to reflect the committed changes.