{"action":"created","issue":{"url":"https://api.github.com/repos/aws/aws-sdk-ruby/issues/1516","repository_url":"https://api.github.com/repos/aws/aws-sdk-ruby","labels_url":"https://api.github.com/repos/aws/aws-sdk-ruby/issues/1516/labels{/name}","comments_url":"https://api.github.com/repos/aws/aws-sdk-ruby/issues/1516/comments","events_url":"https://api.github.com/repos/aws/aws-sdk-ruby/issues/1516/events","html_url":"https://github.com/aws/aws-sdk-ruby/pull/1516","id":228717407,"number":1516,"title":"File#path may not point the corresponding file","user":{"login":"sorah","id":29440,"avatar_url":"https://avatars1.githubusercontent.com/u/29440?v=3","gravatar_id":"","url":"https://api.github.com/users/sorah","html_url":"https://github.com/sorah","followers_url":"https://api.github.com/users/sorah/followers","following_url":"https://api.github.com/users/sorah/following{/other_user}","gists_url":"https://api.github.com/users/sorah/gists{/gist_id}","starred_url":"https://api.github.com/users/sorah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sorah/subscriptions","organizations_url":"https://api.github.com/users/sorah/orgs","repos_url":"https://api.github.com/users/sorah/repos","events_url":"https://api.github.com/users/sorah/events{/privacy}","received_events_url":"https://api.github.com/users/sorah/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2017-05-15T13:37:23Z","updated_at":"2017-06-29T21:36:05Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/aws/aws-sdk-ruby/pulls/1516","html_url":"https://github.com/aws/aws-sdk-ruby/pull/1516","diff_url":"https://github.com/aws/aws-sdk-ruby/pull/1516.diff","patch_url":"https://github.com/aws/aws-sdk-ruby/pull/1516.patch"},"body":"According to [RDoc][1], `File#path` returns a string of the pathname used to create a `File` object. So, it doesn't guarantee a returned pathname points the pathname of File object's corresponding file.\r\n\r\nFor instance, File may have replaced with another file after original `File` object opened. Also, `File.open` with `File::TMPFILE` option don't create directory entry for created files (see `open(2)` manual). On current Ruby implementation, `O_TMPFILE` file objects returns a path of directory used to create a temporarily file.\r\n\r\n``` ruby\r\nFile.write '/tmp/foo', 'a'\r\nFile.write '/tmp/foo2', 'a'\r\nopen('/tmp/foo', 'r') do |io|\r\n  File.rename '/tmp/foo2', '/tmp/foo'\r\n  s3.put_object(..., body: io) # Reads different file!\r\nend\r\n\r\nopen('/tmp', File::RDWR | File::TMPFILE) do |io|\r\n  s3.put_object(..., body: io) #=> error: Errno::EISDIR\r\nend\r\n```\r\n\r\nThis patch changes Checksums module to correctly handle IO objects for\r\ncalculating digests.\r\n\r\n- Use `IO#dup` (`dup(2)`), `IO#rewind` and `IO#read` for calculating digest from `IO` object, always\r\n- Ensure binary mode when calculating digests\r\n- For non `IO` like objects, use #to_str to ensure the value is a `String` like object.\r\n\r\nSee also today's documentation change to note this pitfall. https://github.com/ruby/ruby/commit/efd36678e6041593a6b9cd64bdbe4318f1e7ad0e\r\n\r\n[1]: https://docs.ruby-lang.org/en/2.4.0/File.html#method-i-path"},"comment":{"url":"https://api.github.com/repos/aws/aws-sdk-ruby/issues/comments/312115467","html_url":"https://github.com/aws/aws-sdk-ruby/pull/1516#issuecomment-312115467","issue_url":"https://api.github.com/repos/aws/aws-sdk-ruby/issues/1516","id":312115467,"user":{"login":"awood45","id":2114465,"avatar_url":"https://avatars0.githubusercontent.com/u/2114465?v=3","gravatar_id":"","url":"https://api.github.com/users/awood45","html_url":"https://github.com/awood45","followers_url":"https://api.github.com/users/awood45/followers","following_url":"https://api.github.com/users/awood45/following{/other_user}","gists_url":"https://api.github.com/users/awood45/gists{/gist_id}","starred_url":"https://api.github.com/users/awood45/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/awood45/subscriptions","organizations_url":"https://api.github.com/users/awood45/orgs","repos_url":"https://api.github.com/users/awood45/repos","events_url":"https://api.github.com/users/awood45/events{/privacy}","received_events_url":"https://api.github.com/users/awood45/received_events","type":"User","site_admin":false},"created_at":"2017-06-29T21:36:05Z","updated_at":"2017-06-29T21:36:05Z","body":"I had to rebuild some of the commit history, and it looks like that may require a rebasing of this branch. Taking a look."}}
{"actor":{"display_login":"awood45"}}