comm/join drop matches when sort and comm use different locales
comm and join need input sorted in the same collation they run under. When a file is sorted under en_US.UTF-8 (where a a-b ab a_c b B is the order) and then compared under LC_ALL=C, or the reverse, common lines go missing. In 400 random small word sets, comm -12 lost or misreported matches in 149 (sort en_US, comm C) and in 220 (sort C, comm en_US) of them, and 0 when both matched. GNU coreutils 9.4 noticed every time: it printed 'comm: file N is not in sorted order' and exited 1, but still printed the partial result to stdout. So comm ... 2>/dev/null, || true, or --nocheck-order turns it into a silent wrong answer. Fix: set one locale for the whole pipeline (export LC_ALL=C before both sort and comm/join), and don't discard comm's stderr or exit status.