Skip to contentSkip to conversation

CodeSamples/formal/herd: Tame 'sort' command by setting LC_ALL

PATCH New Akira Yokosawa 1 participant 1 message Dec 12, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 CodeSamples/formal/herd: Tame 'sort' command by setting LC_ALL

From d6979ecb0635bd0418c049c89357cadb50cb32de Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Tue, 12 Dec 2017 23:56:07 +0900
Subject: [PATCH] CodeSamples/formal/herd: Tame 'sort' command by setting LC_ALL

Otherwise, results of sorting in targets run-absperf and run-absperf-all will depend on locale setting.

Fixes ef392264b2b1 ("CodeSamples/formal/herd: Make use of absperf scripts in make targets")

---
Hi Paul,

I suppose your locale setting is "en_US.UTF-8".
If this is the case, the result of run-absperf with a short timeout will look something like:

    C-SB+l-o-o-u+l-o-o-u-X.litmus 0.04 0.04 0.04
    C-SB+l-o-o-u+l-o-o-u-XE.litmus 0.09 0.09 0.09
    C-SB+l-o-o-u+l-o-o-u+l-o-o-u-X.litmus 1.55 1.55 1.55
    C-SB+l-o-o-u+l-o-o-u+l-o-o-u-XE.litmus 5.26 5.26 5.26
    C-SB+l-o-o-u+l-o-o-u+l-o-o-u+l-o-o-u.litmus 0.6 0.60 0.60
    C-SB+l-o-o-u+l-o-o-u+l-o-o-u.litmus 0.06 0.06 0.06
    C-SB+l-o-o-u+l-o-o-u+l-o-o-u-C.litmus 1.22 1.22 1.22
    C-SB+l-o-o-u+l-o-o-u+l-o-o-u-CE.litmus 2.65 2.65 2.65
    C-SB+l-o-o-u+l-o-o-u.litmus 0.01 0.01 0.01
    C-SB+l-o-o-u+l-o-o-u-C.litmus 0.04 0.04 0.04
    C-SB+l-o-o-u+l-o-o-u-CE.litmus 0.06 0.06 0.06

I used "sort -r" to have the ordering as:

    C-SB+l-o-o-u+l-o-o-u.litmus 0.01 0.01 0.01
    C-SB+l-o-o-u+l-o-o-u-XE.litmus 0.09 0.09 0.09
    C-SB+l-o-o-u+l-o-o-u-X.litmus 0.04 0.04 0.04
    C-SB+l-o-o-u+l-o-o-u-CE.litmus 0.06 0.06 0.06
    C-SB+l-o-o-u+l-o-o-u-C.litmus 0.04 0.04 0.04
    C-SB+l-o-o-u+l-o-o-u+l-o-o-u.litmus 0.06 0.06 0.06
    C-SB+l-o-o-u+l-o-o-u+l-o-o-u-XE.litmus 5.26 5.26 5.26
    C-SB+l-o-o-u+l-o-o-u+l-o-o-u-X.litmus 1.55 1.55 1.55
    C-SB+l-o-o-u+l-o-o-u+l-o-o-u-CE.litmus 2.65 2.65 2.65
    C-SB+l-o-o-u+l-o-o-u+l-o-o-u-C.litmus 1.22 1.22 1.22
    C-SB+l-o-o-u+l-o-o-u+l-o-o-u+l-o-o-u.litmus 0.6 0.60 0.60

This change ensures the intended ordering no matter what your locale is. (Well, this is not ideal, but close enough.)

Thanks, Akira
--

 CodeSamples/formal/herd/Makefile | 1 +
 1 file changed, 1 insertion(+)
CodeSamples/formal/herd/Makefile +1 -0
index 7bbfeaf..8e0635a 100644
@@ -79,6 +79,7 @@ absperf.out: ABSPERF_LIST = $(ABSPERF_SHORT)
 absperf.out: $(ABSPERF_SHORT)
 absperf-all.out: ABSPERF_LIST = $(ABSPERF_TEST)
 absperf-all.out: $(ABSPERF_TEST)
+$(ABSPERF_OUT): export LC_ALL = C
 
 $(ABSPERF_OUT):
 	mkdir -p absperf
Signature · 1 line
2.7.4