{"action":"created","comment":{"url":"https://api.github.com/repos/docker/docker/pulls/comments/46815078","id":46815078,"diff_hunk":"@@ -4217,6 +4217,79 @@ RUN cat /existing-directory-trailing-slash/test/foo | grep Hi`\n \n }\n \n+func (s *DockerSuite) TestBuildAddBrokenTar(c *check.C) {\n+\ttestRequires(c, DaemonIsLinux)\n+\tname := \"testbuildaddbrokentar\"\n+\n+\tctx := func() *FakeContext {\n+\t\tdockerfile := `\n+FROM busybox\n+ADD test.tar /`\n+\t\ttmpDir, err := ioutil.TempDir(\"\", \"fake-context\")\n+\t\tc.Assert(err, check.IsNil)\n+\t\ttestTar, err := os.Create(filepath.Join(tmpDir, \"test.tar\"))\n+\t\tif err != nil {\n+\t\t\tc.Fatalf(\"failed to create test.tar archive: %v\", err)\n+\t\t}\n+\t\tdefer testTar.Close()\n+\n+\t\ttw := tar.NewWriter(testTar)\n+\n+\t\tif err := tw.WriteHeader(&tar.Header{\n+\t\t\tName: \"test/foo\",\n+\t\t\tSize: 2,\n+\t\t}); err != nil {\n+\t\t\tc.Fatalf(\"failed to write tar file header: %v\", err)\n+\t\t}\n+\t\tif _, err := tw.Write([]byte(\"Hi\")); err != nil {\n+\t\t\tc.Fatalf(\"failed to write tar file content: %v\", err)\n+\t\t}\n+\t\tif err := tw.Close(); err != nil {\n+\t\t\tc.Fatalf(\"failed to close tar archive: %v\", err)\n+\t\t}\n+\n+\t\t// Corrupt the tar by removing one byte off the end\n+\t\tstat, err := testTar.Stat()\n+\t\tif err != nil {\n+\t\t\tc.Fatalf(\"failed to stat tar archive: %v\", err)\n+\t\t}\n+\t\tif err := testTar.Truncate(stat.Size() - 1); err != nil {\n+\t\t\tc.Fatalf(\"failed to truncate tar archive: %v\", err)\n+\t\t}\n+\n+\t\tif err := ioutil.WriteFile(filepath.Join(tmpDir, \"Dockerfile\"), []byte(dockerfile), 0644); err != nil {\n+\t\t\tc.Fatalf(\"failed to open destination dockerfile: %v\", err)\n+\t\t}\n+\t\treturn fakeContextFromDir(tmpDir)\n+\t}()\n+\tdefer ctx.Close()\n+\n+\tif _, err := buildImageFromContext(name, ctx, true); err == nil {\n+\t\tc.Fatalf(\"build should have failed for TestBuildAddBrokenTar\")\n+\t}\n+}\n+\n+func (s *DockerSuite) TestBuildAddNonTar(c *check.C) {","path":"integration-cli/docker_cli_build_test.go","position":56,"original_position":56,"commit_id":"3243e504d01ea1efa141f3e3cc296903d7d62ca4","original_commit_id":"3243e504d01ea1efa141f3e3cc296903d7d62ca4","user":{"login":"tiborvass","id":827131,"avatar_url":"https://avatars.githubusercontent.com/u/827131?v=3","gravatar_id":"","url":"https://api.github.com/users/tiborvass","html_url":"https://github.com/tiborvass","followers_url":"https://api.github.com/users/tiborvass/followers","following_url":"https://api.github.com/users/tiborvass/following{/other_user}","gists_url":"https://api.github.com/users/tiborvass/gists{/gist_id}","starred_url":"https://api.github.com/users/tiborvass/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tiborvass/subscriptions","organizations_url":"https://api.github.com/users/tiborvass/orgs","repos_url":"https://api.github.com/users/tiborvass/repos","events_url":"https://api.github.com/users/tiborvass/events{/privacy}","received_events_url":"https://api.github.com/users/tiborvass/received_events","type":"User","site_admin":false},"body":"@aidanhs is this test covering changes in the PR or covering existing code in master?\r\nIOW, should this test pass or fail if tested on master?\r\n\r\nTestBuildAddBrokenTar fails on master (which is expected), but TestBuildAddNonTar passes, and I'm not exactly sure if that's expected or not.","created_at":"2015-12-07T12:24:13Z","updated_at":"2015-12-07T12:24:13Z","html_url":"https://github.com/docker/docker/pull/18123#discussion_r46815078","pull_request_url":"https://api.github.com/repos/docker/docker/pulls/18123","_links":{"self":{"href":"https://api.github.com/repos/docker/docker/pulls/comments/46815078"},"html":{"href":"https://github.com/docker/docker/pull/18123#discussion_r46815078"},"pull_request":{"href":"https://api.github.com/repos/docker/docker/pulls/18123"}}},"pull_request":{"url":"https://api.github.com/repos/docker/docker/pulls/18123","id":51380300,"html_url":"https://github.com/docker/docker/pull/18123","diff_url":"https://github.com/docker/docker/pull/18123.diff","patch_url":"https://github.com/docker/docker/pull/18123.patch","issue_url":"https://api.github.com/repos/docker/docker/issues/18123","number":18123,"state":"open","locked":false,"title":"Ensure adding a broken tar doesn't silently fail","user":{"login":"aidanhs","id":1050652,"avatar_url":"https://avatars.githubusercontent.com/u/1050652?v=3","gravatar_id":"","url":"https://api.github.com/users/aidanhs","html_url":"https://github.com/aidanhs","followers_url":"https://api.github.com/users/aidanhs/followers","following_url":"https://api.github.com/users/aidanhs/following{/other_user}","gists_url":"https://api.github.com/users/aidanhs/gists{/gist_id}","starred_url":"https://api.github.com/users/aidanhs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aidanhs/subscriptions","organizations_url":"https://api.github.com/users/aidanhs/orgs","repos_url":"https://api.github.com/users/aidanhs/repos","events_url":"https://api.github.com/users/aidanhs/events{/privacy}","received_events_url":"https://api.github.com/users/aidanhs/received_events","type":"User","site_admin":false},"body":"The change to `daemon/daemonbuilder/builder.go` ensures that if `UntarPath` returns an error, that error will be passed upwards (previously it would log an error at debug, i.e. nothing for most users, and silently succeed). I have deliberately opted to include `io.EOF`, because that shouldn't be received at this level of code.\r\n\r\nThe change to `pkg/archive/archive.go` is just a simplification.","created_at":"2015-11-20T16:53:24Z","updated_at":"2015-12-07T12:24:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1ba5d8958d9ff27147f0848fd456964639cabbaa","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/docker/docker/pulls/18123/commits","review_comments_url":"https://api.github.com/repos/docker/docker/pulls/18123/comments","review_comment_url":"https://api.github.com/repos/docker/docker/pulls/comments{/number}","comments_url":"https://api.github.com/repos/docker/docker/issues/18123/comments","statuses_url":"https://api.github.com/repos/docker/docker/statuses/3243e504d01ea1efa141f3e3cc296903d7d62ca4","head":{"label":"aidanhs:aphs-fail-on-broken-tar","ref":"aphs-fail-on-broken-tar","sha":"3243e504d01ea1efa141f3e3cc296903d7d62ca4","user":{"login":"aidanhs","id":1050652,"avatar_url":"https://avatars.githubusercontent.com/u/1050652?v=3","gravatar_id":"","url":"https://api.github.com/users/aidanhs","html_url":"https://github.com/aidanhs","followers_url":"https://api.github.com/users/aidanhs/followers","following_url":"https://api.github.com/users/aidanhs/following{/other_user}","gists_url":"https://api.github.com/users/aidanhs/gists{/gist_id}","starred_url":"https://api.github.com/users/aidanhs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aidanhs/subscriptions","organizations_url":"https://api.github.com/users/aidanhs/orgs","repos_url":"https://api.github.com/users/aidanhs/repos","events_url":"https://api.github.com/users/aidanhs/events{/privacy}","received_events_url":"https://api.github.com/users/aidanhs/received_events","type":"User","site_admin":false},"repo":{"id":15942913,"name":"docker","full_name":"aidanhs/docker","owner":{"login":"aidanhs","id":1050652,"avatar_url":"https://avatars.githubusercontent.com/u/1050652?v=3","gravatar_id":"","url":"https://api.github.com/users/aidanhs","html_url":"https://github.com/aidanhs","followers_url":"https://api.github.com/users/aidanhs/followers","following_url":"https://api.github.com/users/aidanhs/following{/other_user}","gists_url":"https://api.github.com/users/aidanhs/gists{/gist_id}","starred_url":"https://api.github.com/users/aidanhs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aidanhs/subscriptions","organizations_url":"https://api.github.com/users/aidanhs/orgs","repos_url":"https://api.github.com/users/aidanhs/repos","events_url":"https://api.github.com/users/aidanhs/events{/privacy}","received_events_url":"https://api.github.com/users/aidanhs/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/aidanhs/docker","description":"Docker - the open-source application container engine","fork":true,"url":"https://api.github.com/repos/aidanhs/docker","forks_url":"https://api.github.com/repos/aidanhs/docker/forks","keys_url":"https://api.github.com/repos/aidanhs/docker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aidanhs/docker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aidanhs/docker/teams","hooks_url":"https://api.github.com/repos/aidanhs/docker/hooks","issue_events_url":"https://api.github.com/repos/aidanhs/docker/issues/events{/number}","events_url":"https://api.github.com/repos/aidanhs/docker/events","assignees_url":"https://api.github.com/repos/aidanhs/docker/assignees{/user}","branches_url":"https://api.github.com/repos/aidanhs/docker/branches{/branch}","tags_url":"https://api.github.com/repos/aidanhs/docker/tags","blobs_url":"https://api.github.com/repos/aidanhs/docker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aidanhs/docker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aidanhs/docker/git/refs{/sha}","trees_url":"https://api.github.com/repos/aidanhs/docker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aidanhs/docker/statuses/{sha}","languages_url":"https://api.github.com/repos/aidanhs/docker/languages","stargazers_url":"https://api.github.com/repos/aidanhs/docker/stargazers","contributors_url":"https://api.github.com/repos/aidanhs/docker/contributors","subscribers_url":"https://api.github.com/repos/aidanhs/docker/subscribers","subscription_url":"https://api.github.com/repos/aidanhs/docker/subscription","commits_url":"https://api.github.com/repos/aidanhs/docker/commits{/sha}","git_commits_url":"https://api.github.com/repos/aidanhs/docker/git/commits{/sha}","comments_url":"https://api.github.com/repos/aidanhs/docker/comments{/number}","issue_comment_url":"https://api.github.com/repos/aidanhs/docker/issues/comments{/number}","contents_url":"https://api.github.com/repos/aidanhs/docker/contents/{+path}","compare_url":"https://api.github.com/repos/aidanhs/docker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aidanhs/docker/merges","archive_url":"https://api.github.com/repos/aidanhs/docker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aidanhs/docker/downloads","issues_url":"https://api.github.com/repos/aidanhs/docker/issues{/number}","pulls_url":"https://api.github.com/repos/aidanhs/docker/pulls{/number}","milestones_url":"https://api.github.com/repos/aidanhs/docker/milestones{/number}","notifications_url":"https://api.github.com/repos/aidanhs/docker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aidanhs/docker/labels{/name}","releases_url":"https://api.github.com/repos/aidanhs/docker/releases{/id}","created_at":"2014-01-15T17:48:20Z","updated_at":"2015-05-07T12:25:40Z","pushed_at":"2015-11-24T21:46:01Z","git_url":"git://github.com/aidanhs/docker.git","ssh_url":"git@github.com:aidanhs/docker.git","clone_url":"https://github.com/aidanhs/docker.git","svn_url":"https://github.com/aidanhs/docker","homepage":"http://www.docker.io","size":74762,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"docker:master","ref":"master","sha":"1d1de645fd52dd2f886ca650b645c960f2cb219c","user":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"repo":{"id":7691631,"name":"docker","full_name":"docker/docker","owner":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/docker/docker","description":"Docker - the open-source application container engine","fork":false,"url":"https://api.github.com/repos/docker/docker","forks_url":"https://api.github.com/repos/docker/docker/forks","keys_url":"https://api.github.com/repos/docker/docker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/docker/docker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/docker/docker/teams","hooks_url":"https://api.github.com/repos/docker/docker/hooks","issue_events_url":"https://api.github.com/repos/docker/docker/issues/events{/number}","events_url":"https://api.github.com/repos/docker/docker/events","assignees_url":"https://api.github.com/repos/docker/docker/assignees{/user}","branches_url":"https://api.github.com/repos/docker/docker/branches{/branch}","tags_url":"https://api.github.com/repos/docker/docker/tags","blobs_url":"https://api.github.com/repos/docker/docker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/docker/docker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/docker/docker/git/refs{/sha}","trees_url":"https://api.github.com/repos/docker/docker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/docker/docker/statuses/{sha}","languages_url":"https://api.github.com/repos/docker/docker/languages","stargazers_url":"https://api.github.com/repos/docker/docker/stargazers","contributors_url":"https://api.github.com/repos/docker/docker/contributors","subscribers_url":"https://api.github.com/repos/docker/docker/subscribers","subscription_url":"https://api.github.com/repos/docker/docker/subscription","commits_url":"https://api.github.com/repos/docker/docker/commits{/sha}","git_commits_url":"https://api.github.com/repos/docker/docker/git/commits{/sha}","comments_url":"https://api.github.com/repos/docker/docker/comments{/number}","issue_comment_url":"https://api.github.com/repos/docker/docker/issues/comments{/number}","contents_url":"https://api.github.com/repos/docker/docker/contents/{+path}","compare_url":"https://api.github.com/repos/docker/docker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/docker/docker/merges","archive_url":"https://api.github.com/repos/docker/docker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/docker/docker/downloads","issues_url":"https://api.github.com/repos/docker/docker/issues{/number}","pulls_url":"https://api.github.com/repos/docker/docker/pulls{/number}","milestones_url":"https://api.github.com/repos/docker/docker/milestones{/number}","notifications_url":"https://api.github.com/repos/docker/docker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/docker/docker/labels{/name}","releases_url":"https://api.github.com/repos/docker/docker/releases{/id}","created_at":"2013-01-18T18:10:57Z","updated_at":"2015-12-07T12:23:48Z","pushed_at":"2015-12-07T12:20:18Z","git_url":"git://github.com/docker/docker.git","ssh_url":"git@github.com:docker/docker.git","clone_url":"https://github.com/docker/docker.git","svn_url":"https://github.com/docker/docker","homepage":"http://www.docker.com","size":118770,"stargazers_count":26848,"watchers_count":26848,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7291,"mirror_url":null,"open_issues_count":1220,"forks":7291,"open_issues":1220,"watchers":26848,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/docker/docker/pulls/18123"},"html":{"href":"https://github.com/docker/docker/pull/18123"},"issue":{"href":"https://api.github.com/repos/docker/docker/issues/18123"},"comments":{"href":"https://api.github.com/repos/docker/docker/issues/18123/comments"},"review_comments":{"href":"https://api.github.com/repos/docker/docker/pulls/18123/comments"},"review_comment":{"href":"https://api.github.com/repos/docker/docker/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/docker/docker/pulls/18123/commits"},"statuses":{"href":"https://api.github.com/repos/docker/docker/statuses/3243e504d01ea1efa141f3e3cc296903d7d62ca4"}}}}