From 61f92b326da0efea1cf4d3c263ef0e0b7cacfc25 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 5 Jul 2018 00:15:44 +0100 Subject: [PATCH] test suite: Always pass LC_COLLATE=C to sort(1). Specifically, by replacing every invocation of sort with the new function t-sort. The one case where we already took care of this, we change LC_ALL to LC_COLLATE, which should be sufficient. Closes:#903006. Signed-off-by: Ian Jackson --- debian/changelog | 1 + tests/lib | 2 +- tests/lib-core | 4 ++++ tests/lib-gdr | 2 +- tests/lib-import-chk | 8 ++++---- tests/tartree-edit | 2 +- tests/tests/checkout | 2 +- tests/tests/import-native | 2 +- tests/tests/manpages-format | 2 +- 9 files changed, 15 insertions(+), 10 deletions(-) diff --git a/debian/changelog b/debian/changelog index dcff9e6d..4912f019 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,7 @@ dgit (5.7~) unstable; urgency=medium * dgit(7): Mention git-debrebase and gbp pq alongside git-dpm, in the comment about handling patch stacks. * dgit update-vcs-git: Honour --package properly. + * test suite: Always pass LC_COLLATE=C to sort(1). Closes:#903006. -- diff --git a/tests/lib b/tests/lib index bad47c90..4ef275ca 100644 --- a/tests/lib +++ b/tests/lib @@ -153,7 +153,7 @@ t-reporefs () { exec >"$outputfile" if test -d $whichrepo; then cd $whichrepo - git show-ref |sort + git show-ref |t-sort fi) } diff --git a/tests/lib-core b/tests/lib-core index e2b6c062..724c8aca 100644 --- a/tests/lib-core +++ b/tests/lib-core @@ -40,3 +40,7 @@ t-filter-out-git-hyphen-dir () { path="${path%:}" PATH="$path" } + +t-sort () { + LC_COLLATE=C sort "$@" +} diff --git a/tests/lib-gdr b/tests/lib-gdr index 7b4f0858..22ea6d1f 100644 --- a/tests/lib-gdr +++ b/tests/lib-gdr @@ -141,7 +141,7 @@ t-gdr-good () { test $cnparents = $enparents local cndparents=` - for f in $parents; do echo $f; done | sort -u | wc -w + for f in $parents; do echo $f; done | t-sort -u | wc -w ` test $cndparents = $cnparents diff --git a/tests/lib-import-chk b/tests/lib-import-chk index 88984c1b..d6633f96 100644 --- a/tests/lib-import-chk +++ b/tests/lib-import-chk @@ -1,11 +1,11 @@ t-import-chk-authorship () { perl -ne 'print $1,"\n" if m/^ -- (\S.*\>) /' debian/changelog \ - | sort -u \ + | t-sort -u \ > $tmp/authorship.changelog ${import_chk_changelog_massage:-:} $tmp/authorship.changelog git log --pretty=format:'%an <%ae>%n%cn <%ce>' \ - | sort -u \ + | t-sort -u \ > $tmp/authorship.commits diff $tmp/authorship.{changelog,commits} } @@ -63,7 +63,7 @@ t-import-chk2() { t-ref-same refs/heads/first-2nd-import for orig in ../${p}_${v%-*}.orig*.tar.*; do - tar -atf $orig | LC_ALL=C sort >../files.o + tar -atf $orig | t-sort >../files.o pfx=$(perl <../files.o -ne ' while (<>) { m#^([^/]+/)# or exit 0; @@ -87,7 +87,7 @@ t-import-chk2() { t-ref-same-val "$orig $start" "$imp" done git ls-tree -r --name-only "$t_ref_val:" \ - | sort >../files.g + | t-sort >../files.g diff ../files.{o,g} done cd .. diff --git a/tests/tartree-edit b/tests/tartree-edit index 40bd6e96..78f0e4f6 100755 --- a/tests/tartree-edit +++ b/tests/tartree-edit @@ -17,7 +17,7 @@ gitfetchdiff_list () { git for-each-ref --format '%(refname) %(objectname)' \ refs/remotes/"$1" \ | sed 's/^refs\/remotes\/[^\/]*\///' \ - | sort >"$play/$2" + | t-sort >"$play/$2" } gitfetchdiff () { diff --git a/tests/tests/checkout b/tests/tests/checkout index 4b205f3d..bc3d6ef4 100755 --- a/tests/tests/checkout +++ b/tests/tests/checkout @@ -39,7 +39,7 @@ dgit checkout unstable END diff -u ../reflog.{expect,got} -git for-each-ref --format='%(refname)' refs/heads | sort >../refs.got +git for-each-ref --format='%(refname)' refs/heads | t-sort >../refs.got cat >../refs.expect <