{"action":"created","issue":{"url":"https://api.github.com/repos/go-ini/ini/issues/15","labels_url":"https://api.github.com/repos/go-ini/ini/issues/15/labels{/name}","comments_url":"https://api.github.com/repos/go-ini/ini/issues/15/comments","events_url":"https://api.github.com/repos/go-ini/ini/issues/15/events","html_url":"https://github.com/go-ini/ini/issues/15","id":108659027,"number":15,"title":"On full COW filesystems os.Create will truncate but never create new file","user":{"login":"szaydel","id":249424,"avatar_url":"https://avatars.githubusercontent.com/u/249424?v=3","gravatar_id":"","url":"https://api.github.com/users/szaydel","html_url":"https://github.com/szaydel","followers_url":"https://api.github.com/users/szaydel/followers","following_url":"https://api.github.com/users/szaydel/following{/other_user}","gists_url":"https://api.github.com/users/szaydel/gists{/gist_id}","starred_url":"https://api.github.com/users/szaydel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/szaydel/subscriptions","organizations_url":"https://api.github.com/users/szaydel/orgs","repos_url":"https://api.github.com/users/szaydel/repos","events_url":"https://api.github.com/users/szaydel/events{/privacy}","received_events_url":"https://api.github.com/users/szaydel/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/go-ini/ini/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/go-ini/ini/labels/feedback%20needed","name":"feedback needed","color":"fbca04"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-09-28T13:34:15Z","updated_at":"2015-10-01T16:38:08Z","closed_at":null,"body":"I found that on a full volume, on a COW filesystem like ZFS, because any write means copy first, if you are saving a change to already existing INI file, truncation with os.Create will happen, but changed contents are not written out, because of the nature of COW.\r\n\r\nThis is one way of solving this problem. I am not sure it is worth your time, but I do see this as a problem in general. Before a file is saved, we should make sure previous version is not lost until save is known to be good.\r\n\r\n**My attempt**: `https://github.com/szaydel/ini/commit/7d5632418e212b9d519f8d31803532dc3a3ee97e`"},"comment":{"url":"https://api.github.com/repos/go-ini/ini/issues/comments/144781795","html_url":"https://github.com/go-ini/ini/issues/15#issuecomment-144781795","issue_url":"https://api.github.com/repos/go-ini/ini/issues/15","id":144781795,"user":{"login":"Unknwon","id":2946214,"avatar_url":"https://avatars.githubusercontent.com/u/2946214?v=3","gravatar_id":"","url":"https://api.github.com/users/Unknwon","html_url":"https://github.com/Unknwon","followers_url":"https://api.github.com/users/Unknwon/followers","following_url":"https://api.github.com/users/Unknwon/following{/other_user}","gists_url":"https://api.github.com/users/Unknwon/gists{/gist_id}","starred_url":"https://api.github.com/users/Unknwon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Unknwon/subscriptions","organizations_url":"https://api.github.com/users/Unknwon/orgs","repos_url":"https://api.github.com/users/Unknwon/repos","events_url":"https://api.github.com/users/Unknwon/events{/privacy}","received_events_url":"https://api.github.com/users/Unknwon/received_events","type":"User","site_admin":false},"created_at":"2015-10-01T16:38:08Z","updated_at":"2015-10-01T16:38:08Z","body":"Hi @szaydel yeah, it's fine! And yes use standard lib as much as possible is the ideal. But by reading the [source code](https://github.com/golang/go/blob/master/src/io/ioutil/tempfile.go#L47) of this function, it is kind of too complicated for just generate a unique file name(timestamp solves almost everything).\r\n\r\nAnd in terms of lines of code, I think both of them are one line... :smiley:\r\n\r\n"}}