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/monitor_test.go | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) (limited to 'pkg/hooks/monitor_test.go') diff --git a/pkg/hooks/monitor_test.go b/pkg/hooks/monitor_test.go index b3af4bb43..31d7f9e39 100644 --- a/pkg/hooks/monitor_test.go +++ b/pkg/hooks/monitor_test.go @@ -11,7 +11,6 @@ import ( rspec "github.com/opencontainers/runtime-spec/specs-go" "github.com/stretchr/testify/assert" - "golang.org/x/text/language" ) func TestMonitorOneDirGood(t *testing.T) { @@ -22,12 +21,7 @@ func TestMonitorOneDirGood(t *testing.T) { } defer os.RemoveAll(dir) - 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) } @@ -132,12 +126,7 @@ func TestMonitorTwoDirGood(t *testing.T) { } defer os.RemoveAll(fallbackDir) - lang, err := language.Parse("und-u-va-posix") - if err != nil { - t.Fatal(err) - } - - manager, err := New(ctx, []string{fallbackDir, primaryDir}, []string{}, lang) + manager, err := New(ctx, []string{fallbackDir, primaryDir}, []string{}) if err != nil { t.Fatal(err) } @@ -312,12 +301,7 @@ func TestMonitorTwoDirGood(t *testing.T) { func TestMonitorBadWatcher(t *testing.T) { ctx := context.Background() - lang, err := language.Parse("und-u-va-posix") - if err != nil { - t.Fatal(err) - } - - manager, err := New(ctx, []string{}, []string{}, lang) + manager, err := New(ctx, []string{}, []string{}) if err != nil { t.Fatal(err) } -- cgit v1.2.3-54-g00ecf