{"action":"created","issue":{"url":"https://api.github.com/repos/klutometis/roxygen/issues/495","repository_url":"https://api.github.com/repos/klutometis/roxygen","labels_url":"https://api.github.com/repos/klutometis/roxygen/issues/495/labels{/name}","comments_url":"https://api.github.com/repos/klutometis/roxygen/issues/495/comments","events_url":"https://api.github.com/repos/klutometis/roxygen/issues/495/events","html_url":"https://github.com/klutometis/roxygen/issues/495","id":173221083,"number":495,"title":"DESCRIPTION on mounted folders","user":{"login":"gdkrmr","id":12512930,"avatar_url":"https://avatars.githubusercontent.com/u/12512930?v=3","gravatar_id":"","url":"https://api.github.com/users/gdkrmr","html_url":"https://github.com/gdkrmr","followers_url":"https://api.github.com/users/gdkrmr/followers","following_url":"https://api.github.com/users/gdkrmr/following{/other_user}","gists_url":"https://api.github.com/users/gdkrmr/gists{/gist_id}","starred_url":"https://api.github.com/users/gdkrmr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gdkrmr/subscriptions","organizations_url":"https://api.github.com/users/gdkrmr/orgs","repos_url":"https://api.github.com/users/gdkrmr/repos","events_url":"https://api.github.com/users/gdkrmr/events{/privacy}","received_events_url":"https://api.github.com/users/gdkrmr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-25T14:36:57Z","updated_at":"2016-08-26T07:58:23Z","closed_at":null,"body":"Situation:\r\n\r\nUbuntu 16.04, latest R and roxygen2 from CRAN and a Package in a folder mounted with sftp via gnome virtual file system\r\n\r\nA call to `roxygen2::document()` produces a garbage `DESCRIPTION` file: instead of appending it overwrites from the beginning. The problem is R and writing to connections\r\n```R\r\n for(i in 1:10){cat(i, file = \"/mounted/folder/test2\", append = TRUE)}\r\n```\r\ngives a file that reads `10` and not `1 2 ... 10`\r\n\r\nSolution, open the file only once:\r\n```R\r\nassignInNamespace(\r\n    \"write.description\",\r\n    function(desc, file = \"\") {\r\n        con <- if(file != \"\"){\r\n            file(file, \"w\")\r\n        } else {\r\n            \"\"\r\n        }\r\n            \r\n        mapply(roxygen2:::cat.description, names(desc), desc, MoreArgs = list(file = con))\r\n\r\n        if(inherits(con, \"connection\")) close(con)\r\n        \r\n        invisible()\r\n    },\r\n    \"roxygen2\"\r\n)\r\n```\r\n\r\nThe post that helped me with this can be found here:\r\nhttps://stackoverflow.com/questions/24927041/r-writeappend-true-overwrites-file-contents\r\n"},"comment":{"url":"https://api.github.com/repos/klutometis/roxygen/issues/comments/242658575","html_url":"https://github.com/klutometis/roxygen/issues/495#issuecomment-242658575","issue_url":"https://api.github.com/repos/klutometis/roxygen/issues/495","id":242658575,"user":{"login":"gdkrmr","id":12512930,"avatar_url":"https://avatars.githubusercontent.com/u/12512930?v=3","gravatar_id":"","url":"https://api.github.com/users/gdkrmr","html_url":"https://github.com/gdkrmr","followers_url":"https://api.github.com/users/gdkrmr/followers","following_url":"https://api.github.com/users/gdkrmr/following{/other_user}","gists_url":"https://api.github.com/users/gdkrmr/gists{/gist_id}","starred_url":"https://api.github.com/users/gdkrmr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gdkrmr/subscriptions","organizations_url":"https://api.github.com/users/gdkrmr/orgs","repos_url":"https://api.github.com/users/gdkrmr/repos","events_url":"https://api.github.com/users/gdkrmr/events{/privacy}","received_events_url":"https://api.github.com/users/gdkrmr/received_events","type":"User","site_admin":false},"created_at":"2016-08-26T07:58:23Z","updated_at":"2016-08-26T07:58:23Z","body":"I did some more checking with :\r\n```R\r\nfor(i in 1:10){cat(i, file = \"/mounted/folder/test2\", append = TRUE)}\r\n```\r\n\r\n- A mapped network drive on Windows 7 and R 3.2.5 works fine.\r\n- A samba share on a Mac works fine.\r\n- A samba share on Ubuntu 16.04 works fine.\r\n- An sftp share on Ubuntu 16.06 does not work."}}
{"actor":{"display_login":"gdkrmr"}}