]> Cypherpunks repositories - gostls13.git/commitdiff
os: include 0111 in directory file mode on windows
authorAlex Brainman <alex.brainman@gmail.com>
Wed, 28 Nov 2012 06:01:59 +0000 (17:01 +1100)
committerAlex Brainman <alex.brainman@gmail.com>
Wed, 28 Nov 2012 06:01:59 +0000 (17:01 +1100)
Fixes #4444.

R=golang-dev, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6858079

src/pkg/os/os_test.go
src/pkg/os/stat_windows.go

index 1940f562def795da3dbfaeec4867d53979f04524..ecae0f202992caf5bb2d6d9b35f5ac999d7f8b21 100644 (file)
@@ -1095,3 +1095,15 @@ func TestLargeWriteToConsole(t *testing.T) {
                t.Errorf("Write to os.Stderr should return %d; got %d", len(b), n)
        }
 }
+
+func TestStatDirModeExec(t *testing.T) {
+       const mode = 0111
+       const path = "."
+       dir, err := Stat(path)
+       if err != nil {
+               t.Fatalf("Stat %q (looking for mode %#o): %s", path, mode, err)
+       }
+       if dir.Mode()&mode != mode {
+               t.Errorf("Stat %q: mode %#o want %#o", path, dir.Mode(), mode)
+       }
+}
index 4fc6f457e3d98c6496f58bb603d8a647d5398f7a..c0441a42ae62b9248b1437087784f181f107bf9a 100644 (file)
@@ -190,7 +190,7 @@ func mkModTime(mtime syscall.Filetime) time.Time {
 
 func mkMode(fa uint32) (m FileMode) {
        if fa&syscall.FILE_ATTRIBUTE_DIRECTORY != 0 {
-               m |= ModeDir
+               m |= ModeDir | 0111
        }
        if fa&syscall.FILE_ATTRIBUTE_READONLY != 0 {
                m |= 0444