From: Richard Miller Date: Tue, 19 Nov 2024 12:15:26 +0000 (+0000) Subject: os: allow for variant plan9 error messages in TestOpenError X-Git-Tag: go1.24rc1~109 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=e06e29b9b4afbb30f5c77551ff8e6bdaafcf8e9b;p=gostls13.git os: allow for variant plan9 error messages in TestOpenError Different Plan 9 file servers may return different error strings on an attempt to open a directory for writing: EISDIR, EACCES or EPERM. TestOpenError allows for the first two, but it needs to allow for EPERM as well. Fixes #70440 Change-Id: I705cc086e21630ca254499ca922ede78c9901b11 Reviewed-on: https://go-review.googlesource.com/c/go/+/629635 Auto-Submit: Dmitri Shuralyov Reviewed-by: Ian Lance Taylor Reviewed-by: Dmitri Shuralyov TryBot-Bypass: Dmitri Shuralyov --- diff --git a/src/os/os_test.go b/src/os/os_test.go index dbf77db990..1e2db94dea 100644 --- a/src/os/os_test.go +++ b/src/os/os_test.go @@ -1840,9 +1840,11 @@ func testOpenError(t *testing.T, dir string, rooted bool) { expectedErrStr := strings.Replace(tt.error.Error(), "file ", "", 1) if !strings.HasSuffix(syscallErrStr, expectedErrStr) { // Some Plan 9 file servers incorrectly return - // EACCES rather than EISDIR when a directory is + // EPERM or EACCES rather than EISDIR when a directory is // opened for write. - if tt.error == syscall.EISDIR && strings.HasSuffix(syscallErrStr, syscall.EACCES.Error()) { + if tt.error == syscall.EISDIR && + (strings.HasSuffix(syscallErrStr, syscall.EPERM.Error()) || + strings.HasSuffix(syscallErrStr, syscall.EACCES.Error())) { continue } t.Errorf("%v = _, %q; want suffix %q", name, syscallErrStr, expectedErrStr)