Project

General

Profile

Actions

Bug #80700

open
DR

test/encoding: readable.sh fails on hosts with a non-C locale

Bug #80700: test/encoding: readable.sh fails on hosts with a non-C locale

Added by Dominik Raddatz 2 months ago. Updated 2 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Due date:
% Done:

0%

Source:
Community (dev)
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):
Tags (freeform):
Merge Commit:
Fixed In:
Released In:
Upkeep Timestamp:

Description

src/test/encoding/readable.sh fails for any developer whose shell locale is
not C/POSIX. Reproduced on Linux with LANG=de_DE.UTF-8, ceph-dencoder built
from main (21.0.0). Two independent problems in the nondeterministic-object
path, both long-standing:

1. Sorting under the caller's locale

For a type that ceph-dencoder reports as non-deterministic, the script dumps
the object and its re-encoded self, sorts both, and compares, so that element
order does not matter. The sort runs under the caller's locale. glibc collates
distinct punctuation-only lines as equal -- the bare "{", "},", "]" that fill
a json dump -- and GNU sort is stable, so tied lines keep their input order.
The nondeterministic ordering the sort was meant to erase therefore survives
it, and the two dumps compare unequal.

Reproducer, no ceph needed:

$ printf '        {\n        },\n' | LC_ALL=de_DE.UTF-8 sort   # {  then  },
$ printf ' },\n {\n' | LC_ALL=de_DE.UTF-8 sort # }, then {
$ # same two inputs under LC_ALL=C give identical output both times

Measured over the four types that ceph-dencoder reports as non-deterministic
(PGMap, PGMapDigest, cls_2pc_queue_reservations_ret, cls_2pc_urgent_data),
205 corpus objects in total: 123 of them do dump in a different order after a
re-encode. Of those 123, 107 falsely mismatch under de_DE.UTF-8 and 0 mismatch
under LC_ALL=C.

2. diff is fatal under set -e

On a mismatch the script prints the difference with diff, which exits non-zero
by construction. The script runs under "set -e" and an if body is not a tested
position, so the shell aborts. test_object runs as a background job that
records its tally to a result file at the end, so the abort discards that file
and every remaining object of that type is never tested. The summing loop then
reports

  • result file for job N is missing; the job likely died before recording
    its result **

which hides the actual mismatch and undercounts numtests. With problem 1
present, 17 of the 27 jobs for these types died at their first false mismatch,
so 58 of 205 objects were tested instead of all 205. Independently of the
locale, this means a genuine encode/decode regression would be reported as a
missing result file rather than as a diff.

Both problems predate the current code: the diff call dates to 625a89d4cb6
(2012) and the parallel result-file scheme to 8b6be11a360 (2016).

DR Updated by Dominik Raddatz 2 months ago Actions #1

  • Pull request ID set to 71946
Actions

Also available in: PDF Atom