From 97c9115c02b05f9aa0120b84deffed8b7b3d6018 Mon Sep 17 00:00:00 2001 From: Miloslav Trmač Date: Sat, 2 Mar 2019 06:36:44 +0100 Subject: Potentially breaking: Make hooks sort order locale-independent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Don't sort OCI hooks using the locale collation order; it does not make sense for the same system-wide directory to be interpreted differently depending on the user's LC_COLLATE setting, and the language-specific collation order can even change over time. Besides, the current collation order determination code has never worked with the most common LC_COLLATE values like en_US.UTF-8. Ideally, we would like to just order based on Unicode code points to be reliably stable, but the existing implementation is case-insensitive, so we are forced to rely on the unicode case mapping tables at least. (This gives up on canonicalization and width-insensitivity, potentially breaking users who rely on these previously documented properties.) Signed-off-by: Miloslav Trmač --- pkg/hooks/hooks_test.go | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'pkg/hooks/hooks_test.go') diff --git a/pkg/hooks/hooks_test.go b/pkg/hooks/hooks_test.go index 2925a99e4..02cde6d64 100644 --- a/pkg/hooks/hooks_test.go +++ b/pkg/hooks/hooks_test.go @@ -12,7 +12,6 @@ import ( current "github.com/containers/libpod/pkg/hooks/1.0.0" rspec "github.com/opencontainers/runtime-spec/specs-go" "github.com/stretchr/testify/assert" - "golang.org/x/text/language" ) // path is the path to an example hook executable. @@ -43,12 +42,7 @@ func TestGoodNew(t *testing.T) { } } - lang, err := language.Parse("und-u-va-posix") - if err != nil { - t.Fatal(err) - } - - manager, err := New(ctx, []string{dir}, []string{}, lang) + manager, err := New(ctx, []string{dir}, []string{}) if err != nil { t.Fatal(err) } @@ -110,12 +104,7 @@ func TestBadNew(t *testing.T) { t.Fatal(err) } - lang, err := language.Parse("und-u-va-posix") - if err != nil { - t.Fatal(err) - } - - _, err = New(ctx, []string{dir}, []string{}, lang) + _, err = New(ctx, []string{dir}, []string{}) if err == nil { t.Fatal("unexpected success") } -- cgit v1.2.3-54-g00ecf