{"action":"created","issue":{"url":"https://api.github.com/repos/golang/go/issues/15827","repository_url":"https://api.github.com/repos/golang/go","labels_url":"https://api.github.com/repos/golang/go/issues/15827/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/15827/comments","events_url":"https://api.github.com/repos/golang/go/issues/15827/events","html_url":"https://github.com/golang/go/issues/15827","id":156633617,"number":15827,"title":"Chdir fails for relative paths with tilde ~","user":{"login":"karysto","id":6022002,"avatar_url":"https://avatars.githubusercontent.com/u/6022002?v=3","gravatar_id":"","url":"https://api.github.com/users/karysto","html_url":"https://github.com/karysto","followers_url":"https://api.github.com/users/karysto/followers","following_url":"https://api.github.com/users/karysto/following{/other_user}","gists_url":"https://api.github.com/users/karysto/gists{/gist_id}","starred_url":"https://api.github.com/users/karysto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karysto/subscriptions","organizations_url":"https://api.github.com/users/karysto/orgs","repos_url":"https://api.github.com/users/karysto/repos","events_url":"https://api.github.com/users/karysto/events{/privacy}","received_events_url":"https://api.github.com/users/karysto/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-05-24T23:42:42Z","updated_at":"2016-05-24T23:46:14Z","closed_at":null,"body":"1. What version of Go are you using (`go version`)?\r\n`go version go1.6.1 linux/amd64`\r\n\r\n2. What operating system and processor architecture are you using (`go env`)?\r\n```\r\nGOARCH=\"amd64\"\r\nGOBIN=\"\"\r\nGOEXE=\"\"\r\nGOHOSTARCH=\"amd64\"\r\nGOHOSTOS=\"linux\"\r\nGOOS=\"linux\"\r\nGOPATH=\"/home/karysto/go\"\r\nGORACE=\"\"\r\nGOROOT=\"/usr/local/go\"\r\nGOTOOLDIR=\"/usr/local/go/pkg/tool/linux_amd64\"\r\nGO15VENDOREXPERIMENT=\"1\"\r\nCC=\"gcc\"\r\nGOGCCFLAGS=\"-fPIC -m64 -pthread -fmessage-length=0\"\r\nCXX=\"g++\"\r\nCGO_ENABLED=\"1\"\r\n```\r\n\r\n3. What did you do?\r\nIf possible, provide a recipe for reproducing the error.\r\nA complete runnable program is good.\r\nA link on play.golang.org is best.\r\n--\r\nPlayground Link:\r\nhttps://play.golang.org/p/DpGGD2SLhu\r\n\r\nFirst create a directory using `mkdir ~/test_from_go` (since `os.Mkdir` also fails for `~` paths).\r\nThen run `os.Chdir(\"~/test_from_go\")` using the relative `~/` path as the argument.\r\n\r\nUsing the absolute path, `/home/<USER_NAME>/test_from_go` works. The documentation for `os.Chdir` should be more specific stating that paths using `~` fail. It currently states: \r\n\r\nFrom https://golang.org/pkg/os/#Chdir:\r\n```\r\nChdir changes the current working directory to the file, which must be a directory. If there is an error, it will be of type *PathError.\r\n```\r\n\r\n4. What did you expect to see?\r\nNo stdout output and the created directory `~/test_from_go`\r\n\r\n5. What did you see instead?\r\nAn error. The error thrown is `chdir ~/test_from_go: No such file or directory`. \r\n"},"comment":{"url":"https://api.github.com/repos/golang/go/issues/comments/221435097","html_url":"https://github.com/golang/go/issues/15827#issuecomment-221435097","issue_url":"https://api.github.com/repos/golang/go/issues/15827","id":221435097,"user":{"login":"minux","id":135652,"avatar_url":"https://avatars.githubusercontent.com/u/135652?v=3","gravatar_id":"","url":"https://api.github.com/users/minux","html_url":"https://github.com/minux","followers_url":"https://api.github.com/users/minux/followers","following_url":"https://api.github.com/users/minux/following{/other_user}","gists_url":"https://api.github.com/users/minux/gists{/gist_id}","starred_url":"https://api.github.com/users/minux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minux/subscriptions","organizations_url":"https://api.github.com/users/minux/orgs","repos_url":"https://api.github.com/users/minux/repos","events_url":"https://api.github.com/users/minux/events{/privacy}","received_events_url":"https://api.github.com/users/minux/received_events","type":"User","site_admin":false},"created_at":"2016-05-24T23:46:14Z","updated_at":"2016-05-24T23:46:14Z","body":"~ is expanded by the shell. This is working as intended and I don't think\nwe need to document that. It's similar to why os.Mkdir(\"$HOME/Go\") won't\nwork as expected.\n"}}
{"actor":{"display_login":"minux"}}