-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
Description
What version of Go are you using (go version
)?
go version go1.9.2 openbsd/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env
)?
OpenBSD 6.2-current (2017110) amd64
What did you do?
The following code:
package main
import (
"fmt"
"io/ioutil"
"os"
)
func main() {
ioutil.WriteFile("./test.txt", []byte("test\n"), 0755|os.ModeSticky)
fi, _ := os.Lstat("./test.txt")
fmt.Printf("mode: %v\n", fi.Mode())
}
What did you expect to see?
When run as non-root user it should return:
mode: trwxr-xr-x
like it does on Linux.
What did you see instead?
On OpenBSD, if it's run by root it returns:
mode: trwxr-xr-x
If it's run by a non-root user it returns:
mode: -rwxr-xr-x
os.Lstat
works correctly in all cases; these are the actual file permissions.
(found it accidentally by running the tests for restic.)