{"action":"created","comment":{"url":"https://api.github.com/repos/containerd/continuity/pulls/comments/188647407","pull_request_review_id":120667602,"id":188647407,"diff_hunk":"@@ -49,22 +49,30 @@ func copyFileContent(dst, src *os.File) error {\n \t\treturn errors.Wrap(err, \"unable to stat source\")\n \t}\n \n-\tn, err := unix.CopyFileRange(int(src.Fd()), nil, int(dst.Fd()), nil, int(st.Size()), 0)\n-\tif err != nil {\n-\t\tif err != unix.ENOSYS && err != unix.EXDEV {\n-\t\t\treturn errors.Wrap(err, \"copy file range failed\")\n-\t\t}\n+\tvar written int64\n+\tsize := st.Size()\n \n-\t\tbuf := bufferPool.Get().(*[]byte)\n-\t\t_, err = io.CopyBuffer(dst, src, *buf)\n-\t\tbufferPool.Put(buf)\n-\t\treturn err\n-\t}\n+\tfirst := true\n+\tfor written < size {\n+\t\tn, err := unix.CopyFileRange(int(src.Fd()), nil, int(dst.Fd()), nil, int(size-written), 0)\n+\t\tif err != nil {\n+\t\t\tif (err != unix.ENOSYS && err != unix.EXDEV) || !first {\n+\t\t\t\treturn errors.Wrap(err, \"copy file range failed\")\n+\t\t\t}\n \n-\tif int64(n) != st.Size() {\n-\t\treturn errors.Wrapf(err, \"short copy: %d of %d\", int64(n), st.Size())","path":"fs/copy_linux.go","position":26,"original_position":26,"commit_id":"2735bca6707d28516e192afa85061306691dc4ab","original_commit_id":"2735bca6707d28516e192afa85061306691dc4ab","user":{"login":"cpuguy83","id":799078,"avatar_url":"https://avatars3.githubusercontent.com/u/799078?v=4","gravatar_id":"","url":"https://api.github.com/users/cpuguy83","html_url":"https://github.com/cpuguy83","followers_url":"https://api.github.com/users/cpuguy83/followers","following_url":"https://api.github.com/users/cpuguy83/following{/other_user}","gists_url":"https://api.github.com/users/cpuguy83/gists{/gist_id}","starred_url":"https://api.github.com/users/cpuguy83/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cpuguy83/subscriptions","organizations_url":"https://api.github.com/users/cpuguy83/orgs","repos_url":"https://api.github.com/users/cpuguy83/repos","events_url":"https://api.github.com/users/cpuguy83/events{/privacy}","received_events_url":"https://api.github.com/users/cpuguy83/received_events","type":"User","site_admin":false},"body":"Note that this `errors.Wrap` is incorrect and always returns nil.","created_at":"2018-05-16T14:31:09Z","updated_at":"2018-05-16T14:31:10Z","html_url":"https://github.com/containerd/continuity/pull/114#discussion_r188647407","pull_request_url":"https://api.github.com/repos/containerd/continuity/pulls/114","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/containerd/continuity/pulls/comments/188647407"},"html":{"href":"https://github.com/containerd/continuity/pull/114#discussion_r188647407"},"pull_request":{"href":"https://api.github.com/repos/containerd/continuity/pulls/114"}}},"pull_request":{"url":"https://api.github.com/repos/containerd/continuity/pulls/114","id":188452405,"html_url":"https://github.com/containerd/continuity/pull/114","diff_url":"https://github.com/containerd/continuity/pull/114.diff","patch_url":"https://github.com/containerd/continuity/pull/114.patch","issue_url":"https://api.github.com/repos/containerd/continuity/issues/114","number":114,"state":"open","locked":false,"title":"Fix copy_file_range usage for files > 2GB","user":{"login":"cpuguy83","id":799078,"avatar_url":"https://avatars3.githubusercontent.com/u/799078?v=4","gravatar_id":"","url":"https://api.github.com/users/cpuguy83","html_url":"https://github.com/cpuguy83","followers_url":"https://api.github.com/users/cpuguy83/followers","following_url":"https://api.github.com/users/cpuguy83/following{/other_user}","gists_url":"https://api.github.com/users/cpuguy83/gists{/gist_id}","starred_url":"https://api.github.com/users/cpuguy83/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cpuguy83/subscriptions","organizations_url":"https://api.github.com/users/cpuguy83/orgs","repos_url":"https://api.github.com/users/cpuguy83/repos","events_url":"https://api.github.com/users/cpuguy83/events{/privacy}","received_events_url":"https://api.github.com/users/cpuguy83/received_events","type":"User","site_admin":false},"body":"copy_file_range (or any Linux syscall) will only ever copy 2GB at a\r\ntime. In this case there is no error returned from the system call.\r\n\r\nThis fix uses copy_file_range in a loop until either 0 bytes are copied,\r\nor the desired amount has been copied (st.Size()).","created_at":"2018-05-16T14:28:23Z","updated_at":"2018-05-16T14:31:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"371e2bc0951fb93d17965aa672e73910b308aef8","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/containerd/continuity/pulls/114/commits","review_comments_url":"https://api.github.com/repos/containerd/continuity/pulls/114/comments","review_comment_url":"https://api.github.com/repos/containerd/continuity/pulls/comments{/number}","comments_url":"https://api.github.com/repos/containerd/continuity/issues/114/comments","statuses_url":"https://api.github.com/repos/containerd/continuity/statuses/2735bca6707d28516e192afa85061306691dc4ab","head":{"label":"cpuguy83:fix_copy_file_range_usage","ref":"fix_copy_file_range_usage","sha":"2735bca6707d28516e192afa85061306691dc4ab","user":{"login":"cpuguy83","id":799078,"avatar_url":"https://avatars3.githubusercontent.com/u/799078?v=4","gravatar_id":"","url":"https://api.github.com/users/cpuguy83","html_url":"https://github.com/cpuguy83","followers_url":"https://api.github.com/users/cpuguy83/followers","following_url":"https://api.github.com/users/cpuguy83/following{/other_user}","gists_url":"https://api.github.com/users/cpuguy83/gists{/gist_id}","starred_url":"https://api.github.com/users/cpuguy83/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cpuguy83/subscriptions","organizations_url":"https://api.github.com/users/cpuguy83/orgs","repos_url":"https://api.github.com/users/cpuguy83/repos","events_url":"https://api.github.com/users/cpuguy83/events{/privacy}","received_events_url":"https://api.github.com/users/cpuguy83/received_events","type":"User","site_admin":false},"repo":{"id":118696009,"name":"continuity","full_name":"cpuguy83/continuity","owner":{"login":"cpuguy83","id":799078,"avatar_url":"https://avatars3.githubusercontent.com/u/799078?v=4","gravatar_id":"","url":"https://api.github.com/users/cpuguy83","html_url":"https://github.com/cpuguy83","followers_url":"https://api.github.com/users/cpuguy83/followers","following_url":"https://api.github.com/users/cpuguy83/following{/other_user}","gists_url":"https://api.github.com/users/cpuguy83/gists{/gist_id}","starred_url":"https://api.github.com/users/cpuguy83/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cpuguy83/subscriptions","organizations_url":"https://api.github.com/users/cpuguy83/orgs","repos_url":"https://api.github.com/users/cpuguy83/repos","events_url":"https://api.github.com/users/cpuguy83/events{/privacy}","received_events_url":"https://api.github.com/users/cpuguy83/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cpuguy83/continuity","description":"A transport-agnostic, filesystem metadata manifest system","fork":true,"url":"https://api.github.com/repos/cpuguy83/continuity","forks_url":"https://api.github.com/repos/cpuguy83/continuity/forks","keys_url":"https://api.github.com/repos/cpuguy83/continuity/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cpuguy83/continuity/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cpuguy83/continuity/teams","hooks_url":"https://api.github.com/repos/cpuguy83/continuity/hooks","issue_events_url":"https://api.github.com/repos/cpuguy83/continuity/issues/events{/number}","events_url":"https://api.github.com/repos/cpuguy83/continuity/events","assignees_url":"https://api.github.com/repos/cpuguy83/continuity/assignees{/user}","branches_url":"https://api.github.com/repos/cpuguy83/continuity/branches{/branch}","tags_url":"https://api.github.com/repos/cpuguy83/continuity/tags","blobs_url":"https://api.github.com/repos/cpuguy83/continuity/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cpuguy83/continuity/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cpuguy83/continuity/git/refs{/sha}","trees_url":"https://api.github.com/repos/cpuguy83/continuity/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cpuguy83/continuity/statuses/{sha}","languages_url":"https://api.github.com/repos/cpuguy83/continuity/languages","stargazers_url":"https://api.github.com/repos/cpuguy83/continuity/stargazers","contributors_url":"https://api.github.com/repos/cpuguy83/continuity/contributors","subscribers_url":"https://api.github.com/repos/cpuguy83/continuity/subscribers","subscription_url":"https://api.github.com/repos/cpuguy83/continuity/subscription","commits_url":"https://api.github.com/repos/cpuguy83/continuity/commits{/sha}","git_commits_url":"https://api.github.com/repos/cpuguy83/continuity/git/commits{/sha}","comments_url":"https://api.github.com/repos/cpuguy83/continuity/comments{/number}","issue_comment_url":"https://api.github.com/repos/cpuguy83/continuity/issues/comments{/number}","contents_url":"https://api.github.com/repos/cpuguy83/continuity/contents/{+path}","compare_url":"https://api.github.com/repos/cpuguy83/continuity/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cpuguy83/continuity/merges","archive_url":"https://api.github.com/repos/cpuguy83/continuity/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cpuguy83/continuity/downloads","issues_url":"https://api.github.com/repos/cpuguy83/continuity/issues{/number}","pulls_url":"https://api.github.com/repos/cpuguy83/continuity/pulls{/number}","milestones_url":"https://api.github.com/repos/cpuguy83/continuity/milestones{/number}","notifications_url":"https://api.github.com/repos/cpuguy83/continuity/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cpuguy83/continuity/labels{/name}","releases_url":"https://api.github.com/repos/cpuguy83/continuity/releases{/id}","deployments_url":"https://api.github.com/repos/cpuguy83/continuity/deployments","created_at":"2018-01-24T01:52:12Z","updated_at":"2018-01-24T01:52:14Z","pushed_at":"2018-05-16T14:27:39Z","git_url":"git://github.com/cpuguy83/continuity.git","ssh_url":"git@github.com:cpuguy83/continuity.git","clone_url":"https://github.com/cpuguy83/continuity.git","svn_url":"https://github.com/cpuguy83/continuity","homepage":"https://containerd.io","size":1183,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"containerd:master","ref":"master","sha":"c6cef34830231743494fe2969284df7b82cc0ad0","user":{"login":"containerd","id":14037953,"avatar_url":"https://avatars1.githubusercontent.com/u/14037953?v=4","gravatar_id":"","url":"https://api.github.com/users/containerd","html_url":"https://github.com/containerd","followers_url":"https://api.github.com/users/containerd/followers","following_url":"https://api.github.com/users/containerd/following{/other_user}","gists_url":"https://api.github.com/users/containerd/gists{/gist_id}","starred_url":"https://api.github.com/users/containerd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/containerd/subscriptions","organizations_url":"https://api.github.com/users/containerd/orgs","repos_url":"https://api.github.com/users/containerd/repos","events_url":"https://api.github.com/users/containerd/events{/privacy}","received_events_url":"https://api.github.com/users/containerd/received_events","type":"Organization","site_admin":false},"repo":{"id":39231914,"name":"continuity","full_name":"containerd/continuity","owner":{"login":"containerd","id":14037953,"avatar_url":"https://avatars1.githubusercontent.com/u/14037953?v=4","gravatar_id":"","url":"https://api.github.com/users/containerd","html_url":"https://github.com/containerd","followers_url":"https://api.github.com/users/containerd/followers","following_url":"https://api.github.com/users/containerd/following{/other_user}","gists_url":"https://api.github.com/users/containerd/gists{/gist_id}","starred_url":"https://api.github.com/users/containerd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/containerd/subscriptions","organizations_url":"https://api.github.com/users/containerd/orgs","repos_url":"https://api.github.com/users/containerd/repos","events_url":"https://api.github.com/users/containerd/events{/privacy}","received_events_url":"https://api.github.com/users/containerd/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/containerd/continuity","description":"A transport-agnostic, filesystem metadata manifest system","fork":false,"url":"https://api.github.com/repos/containerd/continuity","forks_url":"https://api.github.com/repos/containerd/continuity/forks","keys_url":"https://api.github.com/repos/containerd/continuity/keys{/key_id}","collaborators_url":"https://api.github.com/repos/containerd/continuity/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/containerd/continuity/teams","hooks_url":"https://api.github.com/repos/containerd/continuity/hooks","issue_events_url":"https://api.github.com/repos/containerd/continuity/issues/events{/number}","events_url":"https://api.github.com/repos/containerd/continuity/events","assignees_url":"https://api.github.com/repos/containerd/continuity/assignees{/user}","branches_url":"https://api.github.com/repos/containerd/continuity/branches{/branch}","tags_url":"https://api.github.com/repos/containerd/continuity/tags","blobs_url":"https://api.github.com/repos/containerd/continuity/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/containerd/continuity/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/containerd/continuity/git/refs{/sha}","trees_url":"https://api.github.com/repos/containerd/continuity/git/trees{/sha}","statuses_url":"https://api.github.com/repos/containerd/continuity/statuses/{sha}","languages_url":"https://api.github.com/repos/containerd/continuity/languages","stargazers_url":"https://api.github.com/repos/containerd/continuity/stargazers","contributors_url":"https://api.github.com/repos/containerd/continuity/contributors","subscribers_url":"https://api.github.com/repos/containerd/continuity/subscribers","subscription_url":"https://api.github.com/repos/containerd/continuity/subscription","commits_url":"https://api.github.com/repos/containerd/continuity/commits{/sha}","git_commits_url":"https://api.github.com/repos/containerd/continuity/git/commits{/sha}","comments_url":"https://api.github.com/repos/containerd/continuity/comments{/number}","issue_comment_url":"https://api.github.com/repos/containerd/continuity/issues/comments{/number}","contents_url":"https://api.github.com/repos/containerd/continuity/contents/{+path}","compare_url":"https://api.github.com/repos/containerd/continuity/compare/{base}...{head}","merges_url":"https://api.github.com/repos/containerd/continuity/merges","archive_url":"https://api.github.com/repos/containerd/continuity/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/containerd/continuity/downloads","issues_url":"https://api.github.com/repos/containerd/continuity/issues{/number}","pulls_url":"https://api.github.com/repos/containerd/continuity/pulls{/number}","milestones_url":"https://api.github.com/repos/containerd/continuity/milestones{/number}","notifications_url":"https://api.github.com/repos/containerd/continuity/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/containerd/continuity/labels{/name}","releases_url":"https://api.github.com/repos/containerd/continuity/releases{/id}","deployments_url":"https://api.github.com/repos/containerd/continuity/deployments","created_at":"2015-07-17T02:54:36Z","updated_at":"2018-05-01T01:44:06Z","pushed_at":"2018-05-16T14:28:24Z","git_url":"git://github.com/containerd/continuity.git","ssh_url":"git@github.com:containerd/continuity.git","clone_url":"https://github.com/containerd/continuity.git","svn_url":"https://github.com/containerd/continuity","homepage":"https://containerd.io","size":1190,"stargazers_count":48,"watchers_count":48,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":26,"mirror_url":null,"archived":false,"open_issues_count":34,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":26,"open_issues":34,"watchers":48,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/containerd/continuity/pulls/114"},"html":{"href":"https://github.com/containerd/continuity/pull/114"},"issue":{"href":"https://api.github.com/repos/containerd/continuity/issues/114"},"comments":{"href":"https://api.github.com/repos/containerd/continuity/issues/114/comments"},"review_comments":{"href":"https://api.github.com/repos/containerd/continuity/pulls/114/comments"},"review_comment":{"href":"https://api.github.com/repos/containerd/continuity/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/containerd/continuity/pulls/114/commits"},"statuses":{"href":"https://api.github.com/repos/containerd/continuity/statuses/2735bca6707d28516e192afa85061306691dc4ab"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"cpuguy83"}}