{"action":"created","issue":{"url":"https://api.github.com/repos/erlware/erlware_commons/issues/133","repository_url":"https://api.github.com/repos/erlware/erlware_commons","labels_url":"https://api.github.com/repos/erlware/erlware_commons/issues/133/labels{/name}","comments_url":"https://api.github.com/repos/erlware/erlware_commons/issues/133/comments","events_url":"https://api.github.com/repos/erlware/erlware_commons/issues/133/events","html_url":"https://github.com/erlware/erlware_commons/issues/133","id":330121314,"node_id":"MDU6SXNzdWUzMzAxMjEzMTQ=","number":133,"title":"ec_file:copy fails for not owned source file with OTP 21-rc2","user":{"login":"shino","id":10225,"node_id":"MDQ6VXNlcjEwMjI1","avatar_url":"https://avatars3.githubusercontent.com/u/10225?v=4","gravatar_id":"","url":"https://api.github.com/users/shino","html_url":"https://github.com/shino","followers_url":"https://api.github.com/users/shino/followers","following_url":"https://api.github.com/users/shino/following{/other_user}","gists_url":"https://api.github.com/users/shino/gists{/gist_id}","starred_url":"https://api.github.com/users/shino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shino/subscriptions","organizations_url":"https://api.github.com/users/shino/orgs","repos_url":"https://api.github.com/users/shino/repos","events_url":"https://api.github.com/users/shino/events{/privacy}","received_events_url":"https://api.github.com/users/shino/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-06-07T05:23:43Z","updated_at":"2018-06-23T07:18:02Z","closed_at":null,"author_association":"NONE","body":"- commit b23bf733c5d949e746f7560664b6855eb85eed93\r\n- erlang/OTP : 21-rc2\r\n\r\nFor the file owned by root user, ec_file:coy fails if executed by non-root user.\r\n\r\nSteps to reproduce:\r\n\r\n```\r\n(default) % rm -f a && sudo touch a && sudo chmod 755 a\r\n(default) % ls -al a\r\n-rwxr-xr-x  1 root  staff  0 Jun  7 14:07 a\r\n(default) % ./rebar3 shell\r\n===> Verifying dependencies...\r\n===> Compiling erlware_commons\r\nErlang/OTP 21 [RELEASE CANDIDATE 2] [erts-10.0] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:0] [hipe] [sharing-preserving]\r\n\r\nEshell V10.0  (abort with ^G)\r\n1> ec_file:copy(\"a\", \"b\").\r\n{error,{write_file_info_failed,eperm}}\r\n```\r\n\r\nThis does not fail with OTP 20.3.4.\r\n\r\n----\r\n\r\nFrom the doc of 21-rc2, file_info record has been added some fields.\r\n\r\n- http://erlang.org/documentation/doc-10.0-rc2/lib/kernel-6.0/doc/html/file.html#type-file_info\r\n- http://erlang.org/doc/man/file.html#type-file_info\r\n\r\nTherefore, this is caused by  (potential) incompatibility of Erlang/OTP.\r\nIf you decide this is not a bug of erlware_commons, please just close ;)"},"comment":{"url":"https://api.github.com/repos/erlware/erlware_commons/issues/comments/399645063","html_url":"https://github.com/erlware/erlware_commons/issues/133#issuecomment-399645063","issue_url":"https://api.github.com/repos/erlware/erlware_commons/issues/133","id":399645063,"node_id":"MDEyOklzc3VlQ29tbWVudDM5OTY0NTA2Mw==","user":{"login":"shino","id":10225,"node_id":"MDQ6VXNlcjEwMjI1","avatar_url":"https://avatars3.githubusercontent.com/u/10225?v=4","gravatar_id":"","url":"https://api.github.com/users/shino","html_url":"https://github.com/shino","followers_url":"https://api.github.com/users/shino/followers","following_url":"https://api.github.com/users/shino/following{/other_user}","gists_url":"https://api.github.com/users/shino/gists{/gist_id}","starred_url":"https://api.github.com/users/shino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shino/subscriptions","organizations_url":"https://api.github.com/users/shino/orgs","repos_url":"https://api.github.com/users/shino/repos","events_url":"https://api.github.com/users/shino/events{/privacy}","received_events_url":"https://api.github.com/users/shino/received_events","type":"User","site_admin":false},"created_at":"2018-06-23T07:18:02Z","updated_at":"2018-06-23T07:18:02Z","author_association":"NONE","body":"I don't have nice way to fix the bug yet...\r\nFor discussion purpose, here is one of the ways to fix:\r\n\r\n1. Try `file:write_file_info` with full SrcFileInfo as it is now. \r\n2. if 1. succeeds, it's ok.\r\n3. if 1. fails, try `file:write_file_info(Path, SrcFileInfo#file_info{uid=undefined, gid=undefined}` .\r\n\r\nPros:\r\n- It works as is for OTP 20-\r\n- For OTP 21+, it's almost the same behavior as OTP 20-\r\n  - in case it's executed by root user, it changes owner/group to source's one\r\n  - in case it's executed by non-root user, it does *not* fail without changing ower/group\r\n\r\nCons:\r\n- It can be slower (because try two times)\r\n\r\n"}}
{"actor":{"display_login":"shino"}}