{"action":"created","comment":{"url":"https://api.github.com/repos/chapel-lang/chapel/pulls/comments/25899810","id":25899810,"diff_hunk":"@@ -55,6 +56,27 @@ qioerr chpl_fs_chown(const char* name, int uid, int gid) {\n   return err;\n }\n \n+qioerr chpl_fs_copy_metadata(const char* source, const char* dest) {\n+  qioerr err = 0;\n+  struct stat oldTimes;\n+  struct utimbuf times;\n+  int exitStatus = stat(source, &oldTimes);\n+  if (exitStatus == -1) {\n+    // Hopefully an error will not occur (as we have checked that the\n+    // file exists when we perform the other operations on it).  But just in\n+    // case, check it here.\n+    err = qio_mkerror_errno();\n+    return err;\n+  }\n+  times.actime = oldTimes.st_atime;  // The access time\n+  times.modtime = oldTimes.st_mtime; // The modification time\n+  exitStatus = utime(dest, &times);  // Set the times for dest.\n+  if (exitStatus == -1) {\n+    err = qio_mkerror_errno();\n+  }\n+  return err;\n+}\n+","path":"runtime/src/chpl-file-utils.c","position":32,"original_position":32,"commit_id":"c2a178da6a8d669d415913bb19d68c76e2f75798","original_commit_id":"c2a178da6a8d669d415913bb19d68c76e2f75798","user":{"login":"lydia-duncan","id":2454710,"avatar_url":"https://avatars.githubusercontent.com/u/2454710?v=3","gravatar_id":"","url":"https://api.github.com/users/lydia-duncan","html_url":"https://github.com/lydia-duncan","followers_url":"https://api.github.com/users/lydia-duncan/followers","following_url":"https://api.github.com/users/lydia-duncan/following{/other_user}","gists_url":"https://api.github.com/users/lydia-duncan/gists{/gist_id}","starred_url":"https://api.github.com/users/lydia-duncan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lydia-duncan/subscriptions","organizations_url":"https://api.github.com/users/lydia-duncan/orgs","repos_url":"https://api.github.com/users/lydia-duncan/repos","events_url":"https://api.github.com/users/lydia-duncan/events{/privacy}","received_events_url":"https://api.github.com/users/lydia-duncan/received_events","type":"User","site_admin":false},"body":"I figured that mode, user id, and group id were functions that should exist in the Chapel modules, so we should minimize the (obvious) reliance on runtime capability as much as possible.  While chmod and chown call down to similar runtime capability, since the user would implement these functions with them instead of the runtime versions, we should aim for doing that as well.","created_at":"2015-03-05T20:46:00Z","updated_at":"2015-03-05T20:46:00Z","html_url":"https://github.com/chapel-lang/chapel/pull/1482#discussion_r25899810","pull_request_url":"https://api.github.com/repos/chapel-lang/chapel/pulls/1482","_links":{"self":{"href":"https://api.github.com/repos/chapel-lang/chapel/pulls/comments/25899810"},"html":{"href":"https://github.com/chapel-lang/chapel/pull/1482#discussion_r25899810"},"pull_request":{"href":"https://api.github.com/repos/chapel-lang/chapel/pulls/1482"}}},"pull_request":{"url":"https://api.github.com/repos/chapel-lang/chapel/pulls/1482","id":30583224,"html_url":"https://github.com/chapel-lang/chapel/pull/1482","diff_url":"https://github.com/chapel-lang/chapel/pull/1482.diff","patch_url":"https://github.com/chapel-lang/chapel/pull/1482.patch","issue_url":"https://api.github.com/repos/chapel-lang/chapel/issues/1482","number":1482,"state":"open","locked":false,"title":"Implement copy, copyMode, and copyFile","user":{"login":"lydia-duncan","id":2454710,"avatar_url":"https://avatars.githubusercontent.com/u/2454710?v=3","gravatar_id":"","url":"https://api.github.com/users/lydia-duncan","html_url":"https://github.com/lydia-duncan","followers_url":"https://api.github.com/users/lydia-duncan/followers","following_url":"https://api.github.com/users/lydia-duncan/following{/other_user}","gists_url":"https://api.github.com/users/lydia-duncan/gists{/gist_id}","starred_url":"https://api.github.com/users/lydia-duncan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lydia-duncan/subscriptions","organizations_url":"https://api.github.com/users/lydia-duncan/orgs","repos_url":"https://api.github.com/users/lydia-duncan/repos","events_url":"https://api.github.com/users/lydia-duncan/events{/privacy}","received_events_url":"https://api.github.com/users/lydia-duncan/received_events","type":"User","site_admin":false},"body":"Implements the file utility functions copy, copyMode, and\r\ncopyFile.  copyMode copies the permissions of one file\r\nonto another file, copyFile copies the contents of one file\r\nto another file (overwriting previous contents if present\r\nand creating a new file otherwise), and copy combines both\r\nthese functions and additionally (if metadata=true) will\r\ncopy the original uid, gid, last access time, and last time of\r\nmodification from the source onto the destination.\r\n\r\nSome caveats with this implementation:\r\n\r\nTesting is not completely robust.  I have checked that things\r\nwork to my satisfaction and will add more tests when we\r\naren't trying to get as many file utilities as possible into the\r\nrelease.\r\n\r\nAlso, copy's ability to take a directory as a destination (and thus\r\nuse the source's base name as part of the destination) would\r\nbe best implemented with two file utilities that I had put off\r\ndue to their dependence on string utilities: basename and\r\njoinPath.  It seems okay to leave off this functionality for now,\r\nsince the user can accomplish it themselves and we expect\r\nstring improvements soon.\r\n\r\nThe bug discovered in #1464 has forced copyFile to include\r\na set of curly braces around the portion where it actively\r\ncopies the contents (so that error checking can occur inside\r\nit).  When those futures have been resolved, the curly braces\r\nwill be safe to remove.","created_at":"2015-03-05T18:37:48Z","updated_at":"2015-03-05T20:46:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7be0955b3be82c2f29faa27606a1f07c5df24efd","assignee":{"login":"mppf","id":3653132,"avatar_url":"https://avatars.githubusercontent.com/u/3653132?v=3","gravatar_id":"","url":"https://api.github.com/users/mppf","html_url":"https://github.com/mppf","followers_url":"https://api.github.com/users/mppf/followers","following_url":"https://api.github.com/users/mppf/following{/other_user}","gists_url":"https://api.github.com/users/mppf/gists{/gist_id}","starred_url":"https://api.github.com/users/mppf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mppf/subscriptions","organizations_url":"https://api.github.com/users/mppf/orgs","repos_url":"https://api.github.com/users/mppf/repos","events_url":"https://api.github.com/users/mppf/events{/privacy}","received_events_url":"https://api.github.com/users/mppf/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/chapel-lang/chapel/pulls/1482/commits","review_comments_url":"https://api.github.com/repos/chapel-lang/chapel/pulls/1482/comments","review_comment_url":"https://api.github.com/repos/chapel-lang/chapel/pulls/comments{/number}","comments_url":"https://api.github.com/repos/chapel-lang/chapel/issues/1482/comments","statuses_url":"https://api.github.com/repos/chapel-lang/chapel/statuses/c2a178da6a8d669d415913bb19d68c76e2f75798","head":{"label":"lydia-duncan:copyAttemptWithoutTestFiles","ref":"copyAttemptWithoutTestFiles","sha":"c2a178da6a8d669d415913bb19d68c76e2f75798","user":{"login":"lydia-duncan","id":2454710,"avatar_url":"https://avatars.githubusercontent.com/u/2454710?v=3","gravatar_id":"","url":"https://api.github.com/users/lydia-duncan","html_url":"https://github.com/lydia-duncan","followers_url":"https://api.github.com/users/lydia-duncan/followers","following_url":"https://api.github.com/users/lydia-duncan/following{/other_user}","gists_url":"https://api.github.com/users/lydia-duncan/gists{/gist_id}","starred_url":"https://api.github.com/users/lydia-duncan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lydia-duncan/subscriptions","organizations_url":"https://api.github.com/users/lydia-duncan/orgs","repos_url":"https://api.github.com/users/lydia-duncan/repos","events_url":"https://api.github.com/users/lydia-duncan/events{/privacy}","received_events_url":"https://api.github.com/users/lydia-duncan/received_events","type":"User","site_admin":false},"repo":{"id":21914939,"name":"chapel","full_name":"lydia-duncan/chapel","owner":{"login":"lydia-duncan","id":2454710,"avatar_url":"https://avatars.githubusercontent.com/u/2454710?v=3","gravatar_id":"","url":"https://api.github.com/users/lydia-duncan","html_url":"https://github.com/lydia-duncan","followers_url":"https://api.github.com/users/lydia-duncan/followers","following_url":"https://api.github.com/users/lydia-duncan/following{/other_user}","gists_url":"https://api.github.com/users/lydia-duncan/gists{/gist_id}","starred_url":"https://api.github.com/users/lydia-duncan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lydia-duncan/subscriptions","organizations_url":"https://api.github.com/users/lydia-duncan/orgs","repos_url":"https://api.github.com/users/lydia-duncan/repos","events_url":"https://api.github.com/users/lydia-duncan/events{/privacy}","received_events_url":"https://api.github.com/users/lydia-duncan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lydia-duncan/chapel","description":"a Productive Parallel Programming Language","fork":true,"url":"https://api.github.com/repos/lydia-duncan/chapel","forks_url":"https://api.github.com/repos/lydia-duncan/chapel/forks","keys_url":"https://api.github.com/repos/lydia-duncan/chapel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lydia-duncan/chapel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lydia-duncan/chapel/teams","hooks_url":"https://api.github.com/repos/lydia-duncan/chapel/hooks","issue_events_url":"https://api.github.com/repos/lydia-duncan/chapel/issues/events{/number}","events_url":"https://api.github.com/repos/lydia-duncan/chapel/events","assignees_url":"https://api.github.com/repos/lydia-duncan/chapel/assignees{/user}","branches_url":"https://api.github.com/repos/lydia-duncan/chapel/branches{/branch}","tags_url":"https://api.github.com/repos/lydia-duncan/chapel/tags","blobs_url":"https://api.github.com/repos/lydia-duncan/chapel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lydia-duncan/chapel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lydia-duncan/chapel/git/refs{/sha}","trees_url":"https://api.github.com/repos/lydia-duncan/chapel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lydia-duncan/chapel/statuses/{sha}","languages_url":"https://api.github.com/repos/lydia-duncan/chapel/languages","stargazers_url":"https://api.github.com/repos/lydia-duncan/chapel/stargazers","contributors_url":"https://api.github.com/repos/lydia-duncan/chapel/contributors","subscribers_url":"https://api.github.com/repos/lydia-duncan/chapel/subscribers","subscription_url":"https://api.github.com/repos/lydia-duncan/chapel/subscription","commits_url":"https://api.github.com/repos/lydia-duncan/chapel/commits{/sha}","git_commits_url":"https://api.github.com/repos/lydia-duncan/chapel/git/commits{/sha}","comments_url":"https://api.github.com/repos/lydia-duncan/chapel/comments{/number}","issue_comment_url":"https://api.github.com/repos/lydia-duncan/chapel/issues/comments{/number}","contents_url":"https://api.github.com/repos/lydia-duncan/chapel/contents/{+path}","compare_url":"https://api.github.com/repos/lydia-duncan/chapel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lydia-duncan/chapel/merges","archive_url":"https://api.github.com/repos/lydia-duncan/chapel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lydia-duncan/chapel/downloads","issues_url":"https://api.github.com/repos/lydia-duncan/chapel/issues{/number}","pulls_url":"https://api.github.com/repos/lydia-duncan/chapel/pulls{/number}","milestones_url":"https://api.github.com/repos/lydia-duncan/chapel/milestones{/number}","notifications_url":"https://api.github.com/repos/lydia-duncan/chapel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lydia-duncan/chapel/labels{/name}","releases_url":"https://api.github.com/repos/lydia-duncan/chapel/releases{/id}","created_at":"2014-07-16T19:55:13Z","updated_at":"2015-03-05T16:15:32Z","pushed_at":"2015-03-05T18:10:59Z","git_url":"git://github.com/lydia-duncan/chapel.git","ssh_url":"git@github.com:lydia-duncan/chapel.git","clone_url":"https://github.com/lydia-duncan/chapel.git","svn_url":"https://github.com/lydia-duncan/chapel","homepage":"http://chapel.cray.com/","size":255228,"stargazers_count":1,"watchers_count":1,"language":"Chapel","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"chapel-lang:master","ref":"master","sha":"5b501787b8ef327ffe803beae86311468fadb028","user":{"login":"chapel-lang","id":7597261,"avatar_url":"https://avatars.githubusercontent.com/u/7597261?v=3","gravatar_id":"","url":"https://api.github.com/users/chapel-lang","html_url":"https://github.com/chapel-lang","followers_url":"https://api.github.com/users/chapel-lang/followers","following_url":"https://api.github.com/users/chapel-lang/following{/other_user}","gists_url":"https://api.github.com/users/chapel-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/chapel-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chapel-lang/subscriptions","organizations_url":"https://api.github.com/users/chapel-lang/orgs","repos_url":"https://api.github.com/users/chapel-lang/repos","events_url":"https://api.github.com/users/chapel-lang/events{/privacy}","received_events_url":"https://api.github.com/users/chapel-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":21663285,"name":"chapel","full_name":"chapel-lang/chapel","owner":{"login":"chapel-lang","id":7597261,"avatar_url":"https://avatars.githubusercontent.com/u/7597261?v=3","gravatar_id":"","url":"https://api.github.com/users/chapel-lang","html_url":"https://github.com/chapel-lang","followers_url":"https://api.github.com/users/chapel-lang/followers","following_url":"https://api.github.com/users/chapel-lang/following{/other_user}","gists_url":"https://api.github.com/users/chapel-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/chapel-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chapel-lang/subscriptions","organizations_url":"https://api.github.com/users/chapel-lang/orgs","repos_url":"https://api.github.com/users/chapel-lang/repos","events_url":"https://api.github.com/users/chapel-lang/events{/privacy}","received_events_url":"https://api.github.com/users/chapel-lang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/chapel-lang/chapel","description":"a Productive Parallel Programming Language","fork":false,"url":"https://api.github.com/repos/chapel-lang/chapel","forks_url":"https://api.github.com/repos/chapel-lang/chapel/forks","keys_url":"https://api.github.com/repos/chapel-lang/chapel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chapel-lang/chapel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chapel-lang/chapel/teams","hooks_url":"https://api.github.com/repos/chapel-lang/chapel/hooks","issue_events_url":"https://api.github.com/repos/chapel-lang/chapel/issues/events{/number}","events_url":"https://api.github.com/repos/chapel-lang/chapel/events","assignees_url":"https://api.github.com/repos/chapel-lang/chapel/assignees{/user}","branches_url":"https://api.github.com/repos/chapel-lang/chapel/branches{/branch}","tags_url":"https://api.github.com/repos/chapel-lang/chapel/tags","blobs_url":"https://api.github.com/repos/chapel-lang/chapel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chapel-lang/chapel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chapel-lang/chapel/git/refs{/sha}","trees_url":"https://api.github.com/repos/chapel-lang/chapel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chapel-lang/chapel/statuses/{sha}","languages_url":"https://api.github.com/repos/chapel-lang/chapel/languages","stargazers_url":"https://api.github.com/repos/chapel-lang/chapel/stargazers","contributors_url":"https://api.github.com/repos/chapel-lang/chapel/contributors","subscribers_url":"https://api.github.com/repos/chapel-lang/chapel/subscribers","subscription_url":"https://api.github.com/repos/chapel-lang/chapel/subscription","commits_url":"https://api.github.com/repos/chapel-lang/chapel/commits{/sha}","git_commits_url":"https://api.github.com/repos/chapel-lang/chapel/git/commits{/sha}","comments_url":"https://api.github.com/repos/chapel-lang/chapel/comments{/number}","issue_comment_url":"https://api.github.com/repos/chapel-lang/chapel/issues/comments{/number}","contents_url":"https://api.github.com/repos/chapel-lang/chapel/contents/{+path}","compare_url":"https://api.github.com/repos/chapel-lang/chapel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chapel-lang/chapel/merges","archive_url":"https://api.github.com/repos/chapel-lang/chapel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chapel-lang/chapel/downloads","issues_url":"https://api.github.com/repos/chapel-lang/chapel/issues{/number}","pulls_url":"https://api.github.com/repos/chapel-lang/chapel/pulls{/number}","milestones_url":"https://api.github.com/repos/chapel-lang/chapel/milestones{/number}","notifications_url":"https://api.github.com/repos/chapel-lang/chapel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chapel-lang/chapel/labels{/name}","releases_url":"https://api.github.com/repos/chapel-lang/chapel/releases{/id}","created_at":"2014-07-09T18:15:54Z","updated_at":"2015-03-05T20:36:14Z","pushed_at":"2015-03-05T20:36:14Z","git_url":"git://github.com/chapel-lang/chapel.git","ssh_url":"git@github.com:chapel-lang/chapel.git","clone_url":"https://github.com/chapel-lang/chapel.git","svn_url":"https://github.com/chapel-lang/chapel","homepage":"http://chapel.cray.com/","size":339097,"stargazers_count":72,"watchers_count":72,"language":"Chapel","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":40,"mirror_url":null,"open_issues_count":8,"forks":40,"open_issues":8,"watchers":72,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/chapel-lang/chapel/pulls/1482"},"html":{"href":"https://github.com/chapel-lang/chapel/pull/1482"},"issue":{"href":"https://api.github.com/repos/chapel-lang/chapel/issues/1482"},"comments":{"href":"https://api.github.com/repos/chapel-lang/chapel/issues/1482/comments"},"review_comments":{"href":"https://api.github.com/repos/chapel-lang/chapel/pulls/1482/comments"},"review_comment":{"href":"https://api.github.com/repos/chapel-lang/chapel/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/chapel-lang/chapel/pulls/1482/commits"},"statuses":{"href":"https://api.github.com/repos/chapel-lang/chapel/statuses/c2a178da6a8d669d415913bb19d68c76e2f75798"}}}}