Skip to content

Commit 418e6d5

Browse files
committed
os,internal/godebugs: add missing IncNonDefault calls
Fixes #66215 Change-Id: Id7de15feabe08f66c048dc114c09494813c9febc Reviewed-on: https://go-review.googlesource.com/c/go/+/570695 Reviewed-by: Cherry Mui <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 381ba9f commit 418e6d5

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

src/internal/godebugs/table.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ var All = []Info{
4949
{Name: "tlsmaxrsasize", Package: "crypto/tls"},
5050
{Name: "tlsrsakex", Package: "crypto/tls", Changed: 22, Old: "1"},
5151
{Name: "tlsunsafeekm", Package: "crypto/tls", Changed: 22, Old: "1"},
52-
{Name: "winreadlinkvolume", Package: "os", Changed: 22, Old: "0", Opaque: true}, // bug #66215: remove Opaque
53-
{Name: "winsymlink", Package: "os", Changed: 22, Old: "0", Opaque: true}, // bug #66215: remove Opaque
52+
{Name: "winreadlinkvolume", Package: "os", Changed: 22, Old: "0"},
53+
{Name: "winsymlink", Package: "os", Changed: 22, Old: "0"},
5454
{Name: "x509sha1", Package: "crypto/x509"},
5555
{Name: "x509usefallbackroots", Package: "crypto/x509"},
5656
{Name: "x509usepolicies", Package: "crypto/x509"},

src/os/file_windows.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ func normaliseLinkPath(path string) (string, error) {
378378
if winreadlinkvolume.Value() != "0" {
379379
return `\\?\` + path[4:], nil
380380
}
381+
winreadlinkvolume.IncNonDefault()
381382

382383
h, err := openSymlink(path)
383384
if err != nil {

src/os/types_windows.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,19 @@ func (fs *fileStat) Size() int64 {
161161

162162
var winsymlink = godebug.New("winsymlink")
163163

164-
func (fs *fileStat) Mode() (m FileMode) {
164+
func (fs *fileStat) Mode() FileMode {
165+
m := fs.mode()
165166
if winsymlink.Value() == "0" {
166-
return fs.modePreGo1_23()
167+
old := fs.modePreGo1_23()
168+
if old != m {
169+
winsymlink.IncNonDefault()
170+
m = old
171+
}
167172
}
173+
return m
174+
}
175+
176+
func (fs *fileStat) mode() (m FileMode) {
168177
if fs.FileAttributes&syscall.FILE_ATTRIBUTE_READONLY != 0 {
169178
m |= 0444
170179
} else {

src/runtime/metrics/doc.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,14 @@ Below is the full list of supported metrics, ordered lexicographically.
310310
The number of non-default behaviors executed by the crypto/tls
311311
package due to a non-default GODEBUG=tlsunsafeekm=... setting.
312312
313+
/godebug/non-default-behavior/winreadlinkvolume:events
314+
The number of non-default behaviors executed by the os package
315+
due to a non-default GODEBUG=winreadlinkvolume=... setting.
316+
317+
/godebug/non-default-behavior/winsymlink:events
318+
The number of non-default behaviors executed by the os package
319+
due to a non-default GODEBUG=winsymlink=... setting.
320+
313321
/godebug/non-default-behavior/x509sha1:events
314322
The number of non-default behaviors executed by the crypto/x509
315323
package due to a non-default GODEBUG=x509sha1=... setting.

0 commit comments

Comments
 (0)