@ttsc/darwin-x64 0.6.0-dev.20250501-2 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/bin/go/VERSION +2 -2
  2. package/bin/go/bin/go +0 -0
  3. package/bin/go/bin/gofmt +0 -0
  4. package/bin/go/pkg/tool/darwin_amd64/asm +0 -0
  5. package/bin/go/pkg/tool/darwin_amd64/cgo +0 -0
  6. package/bin/go/pkg/tool/darwin_amd64/compile +0 -0
  7. package/bin/go/pkg/tool/darwin_amd64/cover +0 -0
  8. package/bin/go/pkg/tool/darwin_amd64/fix +0 -0
  9. package/bin/go/pkg/tool/darwin_amd64/link +0 -0
  10. package/bin/go/pkg/tool/darwin_amd64/preprofile +0 -0
  11. package/bin/go/pkg/tool/darwin_amd64/vet +0 -0
  12. package/bin/go/src/archive/tar/format.go +0 -6
  13. package/bin/go/src/archive/tar/reader.go +4 -24
  14. package/bin/go/src/builtin/builtin.go +4 -13
  15. package/bin/go/src/crypto/tls/conn.go +3 -7
  16. package/bin/go/src/crypto/tls/handshake_client_tls13.go +2 -2
  17. package/bin/go/src/crypto/tls/handshake_server_tls13.go +2 -2
  18. package/bin/go/src/crypto/x509/constraints.go +33 -33
  19. package/bin/go/src/crypto/x509/verify.go +13 -28
  20. package/bin/go/src/html/template/attr_string.go +2 -3
  21. package/bin/go/src/html/template/context.go +1 -21
  22. package/bin/go/src/html/template/element_string.go +2 -3
  23. package/bin/go/src/html/template/escape.go +2 -16
  24. package/bin/go/src/html/template/state_string.go +3 -5
  25. package/bin/go/src/html/template/transition.go +6 -41
  26. package/bin/go/src/internal/buildcfg/zbootstrap.go +1 -1
  27. package/bin/go/src/internal/godebugs/table.go +0 -1
  28. package/bin/go/src/internal/poll/fd_windows.go +38 -64
  29. package/bin/go/src/internal/poll/sendfile_windows.go +1 -3
  30. package/bin/go/src/internal/syscall/unix/at.go +17 -0
  31. package/bin/go/src/internal/syscall/unix/at_sysnum_linux.go +1 -2
  32. package/bin/go/src/internal/syscall/windows/at_windows.go +3 -20
  33. package/bin/go/src/internal/syscall/windows/syscall_windows.go +0 -4
  34. package/bin/go/src/internal/syscall/windows/types_windows.go +0 -82
  35. package/bin/go/src/internal/syscall/windows/zsyscall_windows.go +0 -27
  36. package/bin/go/src/net/http/doc.go +1 -0
  37. package/bin/go/src/net/sendfile.go +0 -2
  38. package/bin/go/src/net/sendfile_stub.go +0 -2
  39. package/bin/go/src/net/sendfile_windows.go +0 -3
  40. package/bin/go/src/net/url/url.go +16 -21
  41. package/bin/go/src/os/dir_darwin.go +2 -2
  42. package/bin/go/src/os/dir_unix.go +2 -2
  43. package/bin/go/src/os/file.go +3 -0
  44. package/bin/go/src/os/file_unix.go +5 -9
  45. package/bin/go/src/os/root_unix.go +0 -1
  46. package/bin/go/src/os/stat.go +0 -3
  47. package/bin/go/src/reflect/value.go +2 -3
  48. package/bin/go/src/runtime/defs_linux_mips64x.go +1 -1
  49. package/bin/go/src/runtime/defs_linux_mipsx.go +1 -1
  50. package/bin/go/src/runtime/metrics/doc.go +0 -5
  51. package/bin/go/src/runtime/print.go +4 -16
  52. package/bin/go/src/runtime/race/README +9 -9
  53. package/bin/go/src/runtime/race/internal/amd64v1/race_darwin.syso +0 -0
  54. package/bin/go/src/runtime/race/internal/amd64v1/race_freebsd.syso +0 -0
  55. package/bin/go/src/runtime/race/internal/amd64v1/race_linux.syso +0 -0
  56. package/bin/go/src/runtime/race/internal/amd64v1/race_windows.syso +0 -0
  57. package/bin/go/src/runtime/race/internal/amd64v3/race_linux.syso +0 -0
  58. package/bin/go/src/runtime/race/race_darwin_arm64.syso +0 -0
  59. package/bin/go/src/runtime/race/race_linux_arm64.syso +0 -0
  60. package/bin/go/src/runtime/race/race_linux_loong64.syso +0 -0
  61. package/bin/go/src/runtime/race/race_linux_s390x.syso +0 -0
  62. package/bin/ttsc +0 -0
  63. package/package.json +1 -1
  64. package/bin/go/src/internal/poll/fstatat_unix.go +0 -22
  65. package/bin/go/src/internal/syscall/unix/fchmodat_linux.go +0 -51
  66. package/bin/go/src/internal/syscall/unix/fchmodat_other.go +0 -29
  67. package/bin/go/src/os/statat.go +0 -24
  68. package/bin/go/src/os/statat_other.go +0 -12
  69. package/bin/go/src/os/statat_unix.go +0 -20
  70. package/bin/go/src/runtime/race/internal/amd64v1/race_darwin.patch +0 -63
  71. package/bin/go/src/runtime/race/internal/amd64v1/race_freebsd.patch +0 -63
  72. package/bin/go/src/runtime/race/internal/amd64v1/race_linux.patch +0 -63
  73. package/bin/go/src/runtime/race/internal/amd64v1/race_windows.patch +0 -63
  74. package/bin/go/src/runtime/race/internal/amd64v3/race_linux.patch +0 -63
  75. package/bin/go/src/runtime/race/race_darwin_arm64.patch +0 -63
  76. package/bin/go/src/runtime/race/race_linux_arm64.patch +0 -63
  77. package/bin/go/src/runtime/race/race_linux_loong64.patch +0 -63
  78. package/bin/go/src/runtime/race/race_linux_s390x.patch +0 -63
@@ -2,13 +2,14 @@
2
2
  // Use of this source code is governed by a BSD-style
3
3
  // license that can be found in the LICENSE file.
4
4
 
5
- //go:generate go run gen_encoding_table.go
6
-
7
5
  // Package url parses URLs and implements query escaping.
8
6
  //
9
7
  // See RFC 3986. This package generally follows RFC 3986, except where
10
8
  // it deviates for compatibility reasons.
11
9
  // RFC 6874 followed for IPv6 zone literals.
10
+
11
+ //go:generate go run gen_encoding_table.go
12
+
12
13
  package url
13
14
 
14
15
  // When sending changes, first search old issues for history on decisions.
@@ -546,9 +547,7 @@ func parseAuthority(scheme, authority string) (user *Userinfo, host string, err
546
547
  // parseHost parses host as an authority without user
547
548
  // information. That is, as host[:port].
548
549
  func parseHost(scheme, host string) (string, error) {
549
- if openBracketIdx := strings.LastIndex(host, "["); openBracketIdx > 0 {
550
- return "", errors.New("invalid IP-literal")
551
- } else if openBracketIdx == 0 {
550
+ if openBracketIdx := strings.LastIndex(host, "["); openBracketIdx != -1 {
552
551
  // Parse an IP-Literal in RFC 3986 and RFC 6874.
553
552
  // E.g., "[fe80::1]", "[fe80::1%25en0]", "[fe80::1]:80".
554
553
  closeBracketIdx := strings.LastIndex(host, "]")
@@ -606,22 +605,18 @@ func parseHost(scheme, host string) (string, error) {
606
605
  } else if i := strings.Index(host, ":"); i != -1 {
607
606
  lastColon := strings.LastIndex(host, ":")
608
607
  if lastColon != i {
609
- // RFC 3986 does not allow colons to appear in the host subcomponent.
610
- //
611
- // However, a number of databases including PostgreSQL and MongoDB
612
- // permit a comma-separated list of hosts (with optional ports) in the
613
- // host subcomponent.
614
- //
615
- // Since we historically permitted colons to appear in the host,
616
- // enforce strict colons only for http and https URLs.
617
- //
618
- // See https://go.dev/issue/75223 and https://go.dev/issue/78077.
619
- if scheme == "http" || scheme == "https" {
620
- if urlstrictcolons.Value() == "0" {
621
- urlstrictcolons.IncNonDefault()
622
- i = lastColon
623
- }
624
- } else {
608
+ if scheme == "postgresql" || scheme == "postgres" {
609
+ // PostgreSQL relies on non-RFC-3986 parsing to accept
610
+ // a comma-separated list of hosts (with optional ports)
611
+ // in the host subcomponent:
612
+ // https://www.postgresql.org/docs/11/libpq-connect.html#LIBPQ-MULTIPLE-HOSTS
613
+ //
614
+ // Since we historically permitted colons to appear in the host,
615
+ // continue to permit it for postgres:// URLs only.
616
+ // https://go.dev/issue/75223
617
+ i = lastColon
618
+ } else if urlstrictcolons.Value() == "0" {
619
+ urlstrictcolons.IncNonDefault()
625
620
  i = lastColon
626
621
  }
627
622
  }
@@ -88,7 +88,7 @@ func (f *File) readdir(n int, mode readdirMode) (names []string, dirents []DirEn
88
88
  if mode == readdirName {
89
89
  names = append(names, string(name))
90
90
  } else if mode == readdirDirEntry {
91
- de, err := newUnixDirent(f, string(name), dtToType(dirent.Type))
91
+ de, err := newUnixDirent(f.name, string(name), dtToType(dirent.Type))
92
92
  if IsNotExist(err) {
93
93
  // File disappeared between readdir and stat.
94
94
  // Treat as if it didn't exist.
@@ -99,7 +99,7 @@ func (f *File) readdir(n int, mode readdirMode) (names []string, dirents []DirEn
99
99
  }
100
100
  dirents = append(dirents, de)
101
101
  } else {
102
- info, err := f.lstatat(string(name))
102
+ info, err := lstat(f.name + "/" + string(name))
103
103
  if IsNotExist(err) {
104
104
  // File disappeared between readdir + stat.
105
105
  // Treat as if it didn't exist.
@@ -138,7 +138,7 @@ func (f *File) readdir(n int, mode readdirMode) (names []string, dirents []DirEn
138
138
  if mode == readdirName {
139
139
  names = append(names, string(name))
140
140
  } else if mode == readdirDirEntry {
141
- de, err := newUnixDirent(f, string(name), direntType(rec))
141
+ de, err := newUnixDirent(f.name, string(name), direntType(rec))
142
142
  if IsNotExist(err) {
143
143
  // File disappeared between readdir and stat.
144
144
  // Treat as if it didn't exist.
@@ -149,7 +149,7 @@ func (f *File) readdir(n int, mode readdirMode) (names []string, dirents []DirEn
149
149
  }
150
150
  dirents = append(dirents, de)
151
151
  } else {
152
- info, err := f.lstatat(string(name))
152
+ info, err := lstat(f.name + "/" + string(name))
153
153
  if IsNotExist(err) {
154
154
  // File disappeared between readdir + stat.
155
155
  // Treat as if it didn't exist.
@@ -428,6 +428,9 @@ func openDir(name string) (*File, error) {
428
428
  return openDirNolog(name)
429
429
  }
430
430
 
431
+ // lstat is overridden in tests.
432
+ var lstat = Lstat
433
+
431
434
  // Rename renames (moves) oldpath to newpath.
432
435
  // If newpath already exists and is not a directory, Rename replaces it.
433
436
  // If newpath already exists and is a directory, Rename returns an error.
@@ -63,7 +63,6 @@ type file struct {
63
63
  nonblock bool // whether we set nonblocking mode
64
64
  stdoutOrErr bool // whether this is stdout or stderr
65
65
  appendMode bool // whether file is opened for appending
66
- inRoot bool // whether file is opened in a Root
67
66
  }
68
67
 
69
68
  // fd is the Unix implementation of Fd.
@@ -459,27 +458,24 @@ func (d *unixDirent) Info() (FileInfo, error) {
459
458
  if d.info != nil {
460
459
  return d.info, nil
461
460
  }
462
- return Lstat(d.parent + "/" + d.name)
461
+ return lstat(d.parent + "/" + d.name)
463
462
  }
464
463
 
465
464
  func (d *unixDirent) String() string {
466
465
  return fs.FormatDirEntry(d)
467
466
  }
468
467
 
469
- func newUnixDirent(parent *File, name string, typ FileMode) (DirEntry, error) {
468
+ func newUnixDirent(parent, name string, typ FileMode) (DirEntry, error) {
470
469
  ude := &unixDirent{
471
- parent: parent.name,
470
+ parent: parent,
472
471
  name: name,
473
472
  typ: typ,
474
473
  }
475
- // When the parent file was opened in a Root,
476
- // we cannot use a lazy lstat to load the FileInfo.
477
- // Use lstatat here.
478
- if typ != ^FileMode(0) && !parent.inRoot {
474
+ if typ != ^FileMode(0) {
479
475
  return ude, nil
480
476
  }
481
477
 
482
- info, err := parent.lstatat(name)
478
+ info, err := lstat(parent + "/" + name)
483
479
  if err != nil {
484
480
  return nil, err
485
481
  }
@@ -104,7 +104,6 @@ func rootOpenFileNolog(root *Root, name string, flag int, perm FileMode) (*File,
104
104
  return nil, &PathError{Op: "openat", Path: name, Err: err}
105
105
  }
106
106
  f := newFile(fd, joinPath(root.Name(), name), kindOpenFile, unix.HasNonblockFlag(flag))
107
- f.inRoot = true
108
107
  return f, nil
109
108
  }
110
109
 
@@ -25,6 +25,3 @@ func Lstat(name string) (FileInfo, error) {
25
25
  testlog.Stat(name)
26
26
  return lstatNolog(name)
27
27
  }
28
-
29
- // stathook is set in tests
30
- var stathook func(f *File, name string) (FileInfo, error)
@@ -1288,10 +1288,9 @@ func (v Value) Field(i int) Value {
1288
1288
  // bunch of zero-sized fields. We must return the zero-sized
1289
1289
  // fields indirectly, as only ptr-shaped things can be direct.
1290
1290
  // See issue 74935.
1291
- // We use &zeroVal[0] instead of v.ptr as it doesn't matter and
1291
+ // We use nil instead of v.ptr as it doesn't matter and
1292
1292
  // we can avoid pinning a possibly now-unused object.
1293
- // Don't use nil, see issue 77779.
1294
- return Value{typ, unsafe.Pointer(&zeroVal[0]), fl | flagIndir}
1293
+ return Value{typ, nil, fl | flagIndir}
1295
1294
  }
1296
1295
 
1297
1296
  // Either flagIndir is set and v.ptr points at struct,
@@ -12,7 +12,7 @@ const (
12
12
  _EINTR = 0x4
13
13
  _EAGAIN = 0xb
14
14
  _ENOMEM = 0xc
15
- _ENOSYS = 0x59
15
+ _ENOSYS = 0x26
16
16
 
17
17
  _PROT_NONE = 0x0
18
18
  _PROT_READ = 0x1
@@ -12,7 +12,7 @@ const (
12
12
  _EINTR = 0x4
13
13
  _EAGAIN = 0xb
14
14
  _ENOMEM = 0xc
15
- _ENOSYS = 0x59
15
+ _ENOSYS = 0x26
16
16
 
17
17
  _PROT_NONE = 0x0
18
18
  _PROT_READ = 0x1
@@ -306,11 +306,6 @@ Below is the full list of supported metrics, ordered lexicographically.
306
306
  The number of non-default behaviors executed by the go/types
307
307
  package due to a non-default GODEBUG=gotypesalias=... setting.
308
308
 
309
- /godebug/non-default-behavior/htmlmetacontenturlescape:events
310
- The number of non-default behaviors executed by
311
- the html/template package due to a non-default
312
- GODEBUG=htmlmetacontenturlescape=... setting.
313
-
314
309
  /godebug/non-default-behavior/http2client:events
315
310
  The number of non-default behaviors executed by the net/http
316
311
  package due to a non-default GODEBUG=http2client=... setting.
@@ -122,35 +122,23 @@ func printbool(v bool) {
122
122
  }
123
123
  }
124
124
 
125
- // float64 requires 1+17+1+1+1+3 = 24 bytes max (sign+digits+decimal point+e+sign+exponent digits).
126
- const float64Bytes = 24
127
-
128
125
  func printfloat64(v float64) {
129
- var buf [float64Bytes]byte
126
+ var buf [20]byte
130
127
  gwrite(strconv.AppendFloat(buf[:0], v, 'g', -1, 64))
131
128
  }
132
129
 
133
- // float32 requires 1+9+1+1+1+2 = 15 bytes max (sign+digits+decimal point+e+sign+exponent digits).
134
- const float32Bytes = 15
135
-
136
130
  func printfloat32(v float32) {
137
- var buf [float32Bytes]byte
131
+ var buf [20]byte
138
132
  gwrite(strconv.AppendFloat(buf[:0], float64(v), 'g', -1, 32))
139
133
  }
140
134
 
141
- // complex128 requires 24+24+1+1+1 = 51 bytes max (paren+float64+float64+i+paren).
142
- const complex128Bytes = 2*float64Bytes + 3
143
-
144
135
  func printcomplex128(c complex128) {
145
- var buf [complex128Bytes]byte
136
+ var buf [44]byte
146
137
  gwrite(strconv.AppendComplex(buf[:0], c, 'g', -1, 128))
147
138
  }
148
139
 
149
- // complex64 requires 15+15+1+1+1 = 33 bytes max (paren+float32+float32+i+paren).
150
- const complex64Bytes = 2*float32Bytes + 3
151
-
152
140
  func printcomplex64(c complex64) {
153
- var buf [complex64Bytes]byte
141
+ var buf [44]byte
154
142
  gwrite(strconv.AppendComplex(buf[:0], complex128(c), 'g', -1, 64))
155
143
  }
156
144
 
@@ -4,16 +4,16 @@ the LLVM project (https://github.com/llvm/llvm-project/tree/main/compiler-rt).
4
4
 
5
5
  To update the .syso files use golang.org/x/build/cmd/racebuild.
6
6
 
7
- internal/amd64v1/race_darwin.syso built with LLVM 51bfeff0e4b0757ff773da6882f4d538996c9b04 with patch internal/amd64v1/race_darwin.patch and Go a61fd428974822a8c57a2b2840fc237e6711b24d.
8
- internal/amd64v1/race_freebsd.syso built with LLVM 51bfeff0e4b0757ff773da6882f4d538996c9b04 with patch internal/amd64v1/race_freebsd.patch and Go a61fd428974822a8c57a2b2840fc237e6711b24d.
9
- internal/amd64v1/race_linux.syso built with LLVM 51bfeff0e4b0757ff773da6882f4d538996c9b04 with patch internal/amd64v1/race_linux.patch and Go a61fd428974822a8c57a2b2840fc237e6711b24d.
7
+ internal/amd64v1/race_darwin.syso built with LLVM 51bfeff0e4b0757ff773da6882f4d538996c9b04 and Go e7d582b55dda36e76ce4d0ce770139ca0915b7c5.
8
+ internal/amd64v1/race_freebsd.syso built with LLVM 51bfeff0e4b0757ff773da6882f4d538996c9b04 and Go e7d582b55dda36e76ce4d0ce770139ca0915b7c5.
9
+ internal/amd64v1/race_linux.syso built with LLVM 51bfeff0e4b0757ff773da6882f4d538996c9b04 and Go e7d582b55dda36e76ce4d0ce770139ca0915b7c5.
10
10
  internal/amd64v1/race_netbsd.syso built with LLVM 51bfeff0e4b0757ff773da6882f4d538996c9b04 and Go e7d582b55dda36e76ce4d0ce770139ca0915b7c5.
11
11
  internal/amd64v1/race_openbsd.syso built with LLVM fcf6ae2f070eba73074b6ec8d8281e54d29dbeeb and Go 8f2db14cd35bbd674cb2988a508306de6655e425.
12
- internal/amd64v1/race_windows.syso built with LLVM 51bfeff0e4b0757ff773da6882f4d538996c9b04 with patch internal/amd64v1/race_windows.patch and Go a61fd428974822a8c57a2b2840fc237e6711b24d.
13
- internal/amd64v3/race_linux.syso built with LLVM 51bfeff0e4b0757ff773da6882f4d538996c9b04 with patch internal/amd64v3/race_linux.patch and Go a61fd428974822a8c57a2b2840fc237e6711b24d.
14
- race_darwin_arm64.syso built with LLVM 51bfeff0e4b0757ff773da6882f4d538996c9b04 with patch race_darwin_arm64.patch and Go a61fd428974822a8c57a2b2840fc237e6711b24d.
15
- race_linux_arm64.syso built with LLVM 51bfeff0e4b0757ff773da6882f4d538996c9b04 with patch race_linux_arm64.patch and Go a61fd428974822a8c57a2b2840fc237e6711b24d.
16
- race_linux_loong64.syso built with LLVM 83fe85115da9dc25fa270d2ea8140113c8d49670 with patch race_linux_loong64.patch and Go a61fd428974822a8c57a2b2840fc237e6711b24d.
12
+ internal/amd64v1/race_windows.syso built with LLVM 51bfeff0e4b0757ff773da6882f4d538996c9b04 and Go e7d582b55dda36e76ce4d0ce770139ca0915b7c5.
13
+ internal/amd64v3/race_linux.syso built with LLVM 51bfeff0e4b0757ff773da6882f4d538996c9b04 and Go e7d582b55dda36e76ce4d0ce770139ca0915b7c5.
14
+ race_darwin_arm64.syso built with LLVM 51bfeff0e4b0757ff773da6882f4d538996c9b04 and Go e7d582b55dda36e76ce4d0ce770139ca0915b7c5.
15
+ race_linux_arm64.syso built with LLVM 51bfeff0e4b0757ff773da6882f4d538996c9b04 and Go e7d582b55dda36e76ce4d0ce770139ca0915b7c5.
16
+ race_linux_loong64.syso built with LLVM 83fe85115da9dc25fa270d2ea8140113c8d49670 and Go 037112464b4439571b45536de9ebe4bc9e10ecb7.
17
17
  race_linux_ppc64le.syso built with LLVM 51bfeff0e4b0757ff773da6882f4d538996c9b04 and Go e7d582b55dda36e76ce4d0ce770139ca0915b7c5.
18
18
  race_linux_riscv64.syso built with LLVM c3c24be13f7928460ca1e2fe613a1146c868854e and Go a21249436b6e1fd47356361d53dc053bbc074f90.
19
- race_linux_s390x.syso built with LLVM 51bfeff0e4b0757ff773da6882f4d538996c9b04 with patch race_linux_s390x.patch and Go a61fd428974822a8c57a2b2840fc237e6711b24d.
19
+ race_linux_s390x.syso built with LLVM 51bfeff0e4b0757ff773da6882f4d538996c9b04 and Go e7d582b55dda36e76ce4d0ce770139ca0915b7c5.
package/bin/ttsc CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttsc/darwin-x64",
3
- "version": "0.6.0-dev.20250501-2",
3
+ "version": "0.6.0",
4
4
  "description": "macOS x64 native binary and bundled Go compiler for ttsc.",
5
5
  "os": [
6
6
  "darwin"
@@ -1,22 +0,0 @@
1
- // Copyright 2026 The Go Authors. All rights reserved.
2
- // Use of this source code is governed by a BSD-style
3
- // license that can be found in the LICENSE file.
4
-
5
- //go:build unix || wasip1
6
-
7
- package poll
8
-
9
- import (
10
- "internal/syscall/unix"
11
- "syscall"
12
- )
13
-
14
- func (fd *FD) Fstatat(name string, s *syscall.Stat_t, flags int) error {
15
- if err := fd.incref(); err != nil {
16
- return err
17
- }
18
- defer fd.decref()
19
- return ignoringEINTR(func() error {
20
- return unix.Fstatat(fd.Sysfd, name, s, flags)
21
- })
22
- }
@@ -1,51 +0,0 @@
1
- // Copyright 2026 The Go Authors. All rights reserved.
2
- // Use of this source code is governed by a BSD-style
3
- // license that can be found in the LICENSE file.
4
-
5
- //go:build linux
6
-
7
- package unix
8
-
9
- import (
10
- "internal/strconv"
11
- "syscall"
12
- )
13
-
14
- func Fchmodat(dirfd int, path string, mode uint32, flags int) error {
15
- // On Linux, the fchmodat syscall silently ignores the AT_SYMLINK_NOFOLLOW flag.
16
- // We need to use fchmodat2 instead.
17
- // syscall.Fchmodat handles this.
18
- if err := syscall.Fchmodat(dirfd, path, mode, flags); err != syscall.EOPNOTSUPP {
19
- return err
20
- }
21
-
22
- // This kernel doesn't appear to support fchmodat2 (added in Linux 6.6).
23
- // We can't fall back to Fchmod, because it requires write permissions on the file.
24
- // Instead, use the same workaround as GNU libc and musl, which is to open the file
25
- // and then fchmodat the FD in /proc/self/fd.
26
- // See: https://lwn.net/Articles/939217/
27
- fd, err := Openat(dirfd, path, O_PATH|syscall.O_NOFOLLOW|syscall.O_CLOEXEC, 0)
28
- if err != nil {
29
- return err
30
- }
31
- defer syscall.Close(fd)
32
- procPath := "/proc/self/fd/" + strconv.Itoa(fd)
33
-
34
- // Check to see if this file is a symlink.
35
- // (We passed O_NOFOLLOW above, but O_PATH|O_NOFOLLOW will open a symlink.)
36
- var st syscall.Stat_t
37
- if err := syscall.Stat(procPath, &st); err != nil {
38
- if err == syscall.ENOENT {
39
- // /proc has probably not been mounted. Give up.
40
- return syscall.EOPNOTSUPP
41
- }
42
- return err
43
- }
44
- if st.Mode&syscall.S_IFMT == syscall.S_IFLNK {
45
- // fchmodat on the proc FD for a symlink apparently gives inconsistent
46
- // results, so just refuse to try.
47
- return syscall.EOPNOTSUPP
48
- }
49
-
50
- return syscall.Fchmodat(AT_FDCWD, procPath, mode, flags&^AT_SYMLINK_NOFOLLOW)
51
- }
@@ -1,29 +0,0 @@
1
- // Copyright 2026 The Go Authors. All rights reserved.
2
- // Use of this source code is governed by a BSD-style
3
- // license that can be found in the LICENSE file.
4
-
5
- //go:build dragonfly || freebsd || netbsd || (openbsd && mips64)
6
-
7
- package unix
8
-
9
- import (
10
- "syscall"
11
- "unsafe"
12
- )
13
-
14
- func Fchmodat(dirfd int, path string, mode uint32, flags int) error {
15
- p, err := syscall.BytePtrFromString(path)
16
- if err != nil {
17
- return err
18
- }
19
- _, _, errno := syscall.Syscall6(fchmodatTrap,
20
- uintptr(dirfd),
21
- uintptr(unsafe.Pointer(p)),
22
- uintptr(mode),
23
- uintptr(flags),
24
- 0, 0)
25
- if errno != 0 {
26
- return errno
27
- }
28
- return nil
29
- }
@@ -1,24 +0,0 @@
1
- // Copyright 2026 The Go Authors. All rights reserved.
2
- // Use of this source code is governed by a BSD-style
3
- // license that can be found in the LICENSE file.
4
-
5
- //go:build !windows
6
-
7
- package os
8
-
9
- import (
10
- "internal/testlog"
11
- )
12
-
13
- func (f *File) lstatat(name string) (FileInfo, error) {
14
- if stathook != nil {
15
- fi, err := stathook(f, name)
16
- if fi != nil || err != nil {
17
- return fi, err
18
- }
19
- }
20
- if log := testlog.Logger(); log != nil {
21
- log.Stat(joinPath(f.Name(), name))
22
- }
23
- return f.lstatatNolog(name)
24
- }
@@ -1,12 +0,0 @@
1
- // Copyright 2026 The Go Authors. All rights reserved.
2
- // Use of this source code is governed by a BSD-style
3
- // license that can be found in the LICENSE file.
4
-
5
- //go:build (js && wasm) || plan9
6
-
7
- package os
8
-
9
- func (f *File) lstatatNolog(name string) (FileInfo, error) {
10
- // These platforms don't have fstatat, so use stat instead.
11
- return Lstat(f.name + "/" + name)
12
- }
@@ -1,20 +0,0 @@
1
- // Copyright 2026 The Go Authors. All rights reserved.
2
- // Use of this source code is governed by a BSD-style
3
- // license that can be found in the LICENSE file.
4
-
5
- //go:build aix || darwin || dragonfly || freebsd || wasip1 || linux || netbsd || openbsd || solaris
6
-
7
- package os
8
-
9
- import (
10
- "internal/syscall/unix"
11
- )
12
-
13
- func (f *File) lstatatNolog(name string) (FileInfo, error) {
14
- var fs fileStat
15
- if err := f.pfd.Fstatat(name, &fs.sys, unix.AT_SYMLINK_NOFOLLOW); err != nil {
16
- return nil, f.wrapErr("fstatat", err)
17
- }
18
- fillFileStatFromSys(&fs, name)
19
- return &fs, nil
20
- }
@@ -1,63 +0,0 @@
1
- From cdfdb06c9155080ec97d6e4f4dd90b6e7cefb0ca Mon Sep 17 00:00:00 2001
2
- From: Michael Pratt <michael@prattmic.com>
3
- Date: Fri, 12 Dec 2025 16:31:44 +1100
4
- Subject: [PATCH] [TSan] Zero-initialize Trace.local_head
5
-
6
- Trace.local_head is currently uninitialized when Trace is created. It is
7
- first initialized when the first event is added to the trace, via the
8
- first call to TraceSwitchPartImpl.
9
-
10
- However, ThreadContext::OnFinished uses local_head, assuming that it is
11
- initialized. If it has not been initialized, we have undefined behavior,
12
- likely crashing if the contents are garbage. The allocator (Alloc)
13
- reuses previously allocations, so the contents of the uninitialized
14
- memory are arbitrary.
15
-
16
- In a C/C++ TSAN binary it is likely very difficult for a thread to start
17
- and exit without a single event inbetween. For Go programs, code running
18
- in the Go runtime itself is not TSan-instrumented, so goroutines that
19
- exclusively run runtime code (such as GC workers) can quite reasonably
20
- have no TSan events.
21
-
22
- The addition of such a goroutine to the Go test.c is sufficient to
23
- trigger this case, though for reliable failure (segfault) I've found it
24
- necessary to poison the ThreadContext allocation like so:
25
-
26
- (Example patch redacted because patch tries to apply this as a real
27
- patch. See full commit at
28
- https://github.com/llvm/llvm-project/commit/cdfdb06c9155080ec97d6e4f4dd90b6e7cefb0ca).
29
-
30
- The fix is trivial: local_head should be zero-initialized.
31
- ---
32
- compiler-rt/lib/tsan/go/test.c | 4 ++++
33
- compiler-rt/lib/tsan/rtl/tsan_trace.h | 2 +-
34
- 2 files changed, 5 insertions(+), 1 deletion(-)
35
-
36
- diff --git a/compiler-rt/lib/tsan/go/test.c b/compiler-rt/lib/tsan/go/test.c
37
- index d328ab1b331d7..fcd396227a4ab 100644
38
- --- a/compiler-rt/lib/tsan/go/test.c
39
- +++ b/compiler-rt/lib/tsan/go/test.c
40
- @@ -91,6 +91,10 @@ int main(void) {
41
- __tsan_go_start(thr0, &thr1, (char*)&barfoo + 1);
42
- void *thr2 = 0;
43
- __tsan_go_start(thr0, &thr2, (char*)&barfoo + 1);
44
- + // Goroutine that exits without a single event.
45
- + void *thr3 = 0;
46
- + __tsan_go_start(thr0, &thr3, (char*)&barfoo + 1);
47
- + __tsan_go_end(thr3);
48
- __tsan_func_exit(thr0);
49
- __tsan_func_enter(thr1, (char*)&foobar + 1);
50
- __tsan_func_enter(thr1, (char*)&foobar + 1);
51
- diff --git a/compiler-rt/lib/tsan/rtl/tsan_trace.h b/compiler-rt/lib/tsan/rtl/tsan_trace.h
52
- index 01bb7b34f43a2..1e791ff765fec 100644
53
- --- a/compiler-rt/lib/tsan/rtl/tsan_trace.h
54
- +++ b/compiler-rt/lib/tsan/rtl/tsan_trace.h
55
- @@ -190,7 +190,7 @@ struct Trace {
56
- Mutex mtx;
57
- IList<TraceHeader, &TraceHeader::trace_parts, TracePart> parts;
58
- // First node non-queued into ctx->trace_part_recycle.
59
- - TracePart* local_head;
60
- + TracePart* local_head = nullptr;
61
- // Final position in the last part for finished threads.
62
- Event* final_pos = nullptr;
63
- // Number of trace parts allocated on behalf of this trace specifically.
@@ -1,63 +0,0 @@
1
- From cdfdb06c9155080ec97d6e4f4dd90b6e7cefb0ca Mon Sep 17 00:00:00 2001
2
- From: Michael Pratt <michael@prattmic.com>
3
- Date: Fri, 12 Dec 2025 16:31:44 +1100
4
- Subject: [PATCH] [TSan] Zero-initialize Trace.local_head
5
-
6
- Trace.local_head is currently uninitialized when Trace is created. It is
7
- first initialized when the first event is added to the trace, via the
8
- first call to TraceSwitchPartImpl.
9
-
10
- However, ThreadContext::OnFinished uses local_head, assuming that it is
11
- initialized. If it has not been initialized, we have undefined behavior,
12
- likely crashing if the contents are garbage. The allocator (Alloc)
13
- reuses previously allocations, so the contents of the uninitialized
14
- memory are arbitrary.
15
-
16
- In a C/C++ TSAN binary it is likely very difficult for a thread to start
17
- and exit without a single event inbetween. For Go programs, code running
18
- in the Go runtime itself is not TSan-instrumented, so goroutines that
19
- exclusively run runtime code (such as GC workers) can quite reasonably
20
- have no TSan events.
21
-
22
- The addition of such a goroutine to the Go test.c is sufficient to
23
- trigger this case, though for reliable failure (segfault) I've found it
24
- necessary to poison the ThreadContext allocation like so:
25
-
26
- (Example patch redacted because patch tries to apply this as a real
27
- patch. See full commit at
28
- https://github.com/llvm/llvm-project/commit/cdfdb06c9155080ec97d6e4f4dd90b6e7cefb0ca).
29
-
30
- The fix is trivial: local_head should be zero-initialized.
31
- ---
32
- compiler-rt/lib/tsan/go/test.c | 4 ++++
33
- compiler-rt/lib/tsan/rtl/tsan_trace.h | 2 +-
34
- 2 files changed, 5 insertions(+), 1 deletion(-)
35
-
36
- diff --git a/compiler-rt/lib/tsan/go/test.c b/compiler-rt/lib/tsan/go/test.c
37
- index d328ab1b331d7..fcd396227a4ab 100644
38
- --- a/compiler-rt/lib/tsan/go/test.c
39
- +++ b/compiler-rt/lib/tsan/go/test.c
40
- @@ -91,6 +91,10 @@ int main(void) {
41
- __tsan_go_start(thr0, &thr1, (char*)&barfoo + 1);
42
- void *thr2 = 0;
43
- __tsan_go_start(thr0, &thr2, (char*)&barfoo + 1);
44
- + // Goroutine that exits without a single event.
45
- + void *thr3 = 0;
46
- + __tsan_go_start(thr0, &thr3, (char*)&barfoo + 1);
47
- + __tsan_go_end(thr3);
48
- __tsan_func_exit(thr0);
49
- __tsan_func_enter(thr1, (char*)&foobar + 1);
50
- __tsan_func_enter(thr1, (char*)&foobar + 1);
51
- diff --git a/compiler-rt/lib/tsan/rtl/tsan_trace.h b/compiler-rt/lib/tsan/rtl/tsan_trace.h
52
- index 01bb7b34f43a2..1e791ff765fec 100644
53
- --- a/compiler-rt/lib/tsan/rtl/tsan_trace.h
54
- +++ b/compiler-rt/lib/tsan/rtl/tsan_trace.h
55
- @@ -190,7 +190,7 @@ struct Trace {
56
- Mutex mtx;
57
- IList<TraceHeader, &TraceHeader::trace_parts, TracePart> parts;
58
- // First node non-queued into ctx->trace_part_recycle.
59
- - TracePart* local_head;
60
- + TracePart* local_head = nullptr;
61
- // Final position in the last part for finished threads.
62
- Event* final_pos = nullptr;
63
- // Number of trace parts allocated on behalf of this trace specifically.