]> Cypherpunks repositories - gostls13.git/commitdiff
os,internal/godebugs: add missing IncNonDefault calls
authorqmuntal <quimmuntal@gmail.com>
Mon, 11 Mar 2024 17:16:16 +0000 (18:16 +0100)
committerQuim Muntal <quimmuntal@gmail.com>
Wed, 13 Mar 2024 19:10:34 +0000 (19:10 +0000)
Fixes #66215

Change-Id: Id7de15feabe08f66c048dc114c09494813c9febc
Reviewed-on: https://go-review.googlesource.com/c/go/+/570695
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
src/internal/godebugs/table.go
src/os/file_windows.go
src/os/types_windows.go
src/runtime/metrics/doc.go

index c11f708dd98670e6538880988cb96326da24fac7..572fb729837f08adf1d0ee02a9c70121c33915e2 100644 (file)
@@ -49,8 +49,8 @@ var All = []Info{
        {Name: "tlsmaxrsasize", Package: "crypto/tls"},
        {Name: "tlsrsakex", Package: "crypto/tls", Changed: 22, Old: "1"},
        {Name: "tlsunsafeekm", Package: "crypto/tls", Changed: 22, Old: "1"},
-       {Name: "winreadlinkvolume", Package: "os", Changed: 22, Old: "0", Opaque: true}, // bug #66215: remove Opaque
-       {Name: "winsymlink", Package: "os", Changed: 22, Old: "0", Opaque: true},        // bug #66215: remove Opaque
+       {Name: "winreadlinkvolume", Package: "os", Changed: 22, Old: "0"},
+       {Name: "winsymlink", Package: "os", Changed: 22, Old: "0"},
        {Name: "x509sha1", Package: "crypto/x509"},
        {Name: "x509usefallbackroots", Package: "crypto/x509"},
        {Name: "x509usepolicies", Package: "crypto/x509"},
index 49fdd8d44d62dd26c4ece795a0b44624406b56cb..fcdb5f2e8f8cc8b7c455f13ddf0e668957073327 100644 (file)
@@ -378,6 +378,7 @@ func normaliseLinkPath(path string) (string, error) {
        if winreadlinkvolume.Value() != "0" {
                return `\\?\` + path[4:], nil
        }
+       winreadlinkvolume.IncNonDefault()
 
        h, err := openSymlink(path)
        if err != nil {
index c4a87219243a67739059a04379dc61503434bc55..16042fea510aca7a52f1714a6a7d9aed41e9cb78 100644 (file)
@@ -161,10 +161,19 @@ func (fs *fileStat) Size() int64 {
 
 var winsymlink = godebug.New("winsymlink")
 
-func (fs *fileStat) Mode() (m FileMode) {
+func (fs *fileStat) Mode() FileMode {
+       m := fs.mode()
        if winsymlink.Value() == "0" {
-               return fs.modePreGo1_23()
+               old := fs.modePreGo1_23()
+               if old != m {
+                       winsymlink.IncNonDefault()
+                       m = old
+               }
        }
+       return m
+}
+
+func (fs *fileStat) mode() (m FileMode) {
        if fs.FileAttributes&syscall.FILE_ATTRIBUTE_READONLY != 0 {
                m |= 0444
        } else {
index e1b3387c133a171a6c0e12a2c18d69d0036b7b1c..deb993241d9785636f76d6dc48dbb4509f9ebc2a 100644 (file)
@@ -310,6 +310,14 @@ Below is the full list of supported metrics, ordered lexicographically.
                The number of non-default behaviors executed by the crypto/tls
                package due to a non-default GODEBUG=tlsunsafeekm=... setting.
 
+       /godebug/non-default-behavior/winreadlinkvolume:events
+               The number of non-default behaviors executed by the os package
+               due to a non-default GODEBUG=winreadlinkvolume=... setting.
+
+       /godebug/non-default-behavior/winsymlink:events
+               The number of non-default behaviors executed by the os package
+               due to a non-default GODEBUG=winsymlink=... setting.
+
        /godebug/non-default-behavior/x509sha1:events
                The number of non-default behaviors executed by the crypto/x509
                package due to a non-default GODEBUG=x509sha1=... setting.