NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
PR/58115 CVS commit: src/usr.bin/config
The following reply was made to PR bin/58115; it has been noted by GNATS.
From: "Taylor R Campbell" <riastradh%netbsd.org@localhost>
To: gnats-bugs%gnats.NetBSD.org@localhost
Cc:
Subject: PR/58115 CVS commit: src/usr.bin/config
Date: Fri, 5 Apr 2024 00:43:42 +0000
Module Name: src
Committed By: riastradh
Date: Fri Apr 5 00:43:42 UTC 2024
Modified Files:
src/usr.bin/config: defs.h files.c mkioconf.c mkmakefile.c pack.c
Log Message:
config(1): Make sort order deterministic.
Ensure we break ties in every case. This way, even though we use the
unstable qsort(3) library routine, the output is reproducible, no
matter what algorithm is behind qsort(3).
It would be nice if we could just use a stable sort function here,
but mergesort(3) is nonstandard, so we'd have to add it to
tools/compat, which is a big pain.
Instead, put a tie-breaking rule in every comparison function we use
with qsort, and abort() in the event of ties -- that way, we noisily
refuse to rely on unstable sort order.
While here, dispense with any question of integer overflow, and
sprinkle comments.
PR bin/58115
To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.109 src/usr.bin/config/defs.h
cvs rdiff -u -r1.37 -r1.38 src/usr.bin/config/files.c
cvs rdiff -u -r1.35 -r1.36 src/usr.bin/config/mkioconf.c
cvs rdiff -u -r1.72 -r1.73 src/usr.bin/config/mkmakefile.c
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/config/pack.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Home |
Main Index |
Thread Index |
Old Index