{"action":"created","issue":{"url":"https://api.github.com/repos/gradle/gradle/issues/7564","repository_url":"https://api.github.com/repos/gradle/gradle","labels_url":"https://api.github.com/repos/gradle/gradle/issues/7564/labels{/name}","comments_url":"https://api.github.com/repos/gradle/gradle/issues/7564/comments","events_url":"https://api.github.com/repos/gradle/gradle/issues/7564/events","html_url":"https://github.com/gradle/gradle/issues/7564","id":375054267,"node_id":"MDU6SXNzdWUzNzUwNTQyNjc=","number":7564,"title":"CONSTANT_TIME_FOR_TAR_ENTRIES = 0 causes issues with Java applications","user":{"login":"blop","id":1006502,"node_id":"MDQ6VXNlcjEwMDY1MDI=","avatar_url":"https://avatars3.githubusercontent.com/u/1006502?v=4","gravatar_id":"","url":"https://api.github.com/users/blop","html_url":"https://github.com/blop","followers_url":"https://api.github.com/users/blop/followers","following_url":"https://api.github.com/users/blop/following{/other_user}","gists_url":"https://api.github.com/users/blop/gists{/gist_id}","starred_url":"https://api.github.com/users/blop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blop/subscriptions","organizations_url":"https://api.github.com/users/blop/orgs","repos_url":"https://api.github.com/users/blop/repos","events_url":"https://api.github.com/users/blop/events{/privacy}","received_events_url":"https://api.github.com/users/blop/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-10-29T14:50:41Z","updated_at":"2018-10-29T16:31:09Z","closed_at":null,"author_association":"NONE","body":"Hello,\r\n\r\nI'm using the Gradle TAR task with the \"preserveFileTimestamps = false\" option (version 4.10.2).\r\nThis is part of the creation of Docker images and that flag helps deduplicating similar layers.\r\n\r\nAs stated in https://github.com/gradle/gradle/blob/master/subprojects/core/src/main/java/org/gradle/api/internal/file/archive/TarCopyAction.java#L120 the last modified date is set to 0.\r\n\r\nUnfortunately, this has some side effects for Java applications, as the popular java.io.File#lastModified method returns a primitive long value and uses 0 when the last modified date cannot be read or if the file is invalid.\r\n\r\nI have the same symptoms as presented here https://github.com/spotify/docker-maven-plugin/issues/58#issuecomment-91189781\r\n\r\nCould you please change the CONSTANT_TIME_FOR_TAR_ENTRIES for anything but 0, or make it configurable ? Maybe make it the same as the CONSTANT_TIME_FOR_ZIP_ENTRIES to be homogeneous ?\r\nSee https://github.com/gradle/gradle/blob/e975872ae2cf1d521b73f1107cae772ca09c63cd/subprojects/core/src/main/java/org/gradle/api/internal/file/archive/ZipCopyAction.java#L57\r\n\r\nThanks!\r\nPing @big-guy ;-)\r\n"},"comment":{"url":"https://api.github.com/repos/gradle/gradle/issues/comments/433980014","html_url":"https://github.com/gradle/gradle/issues/7564#issuecomment-433980014","issue_url":"https://api.github.com/repos/gradle/gradle/issues/7564","id":433980014,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMzk4MDAxNA==","user":{"login":"blop","id":1006502,"node_id":"MDQ6VXNlcjEwMDY1MDI=","avatar_url":"https://avatars3.githubusercontent.com/u/1006502?v=4","gravatar_id":"","url":"https://api.github.com/users/blop","html_url":"https://github.com/blop","followers_url":"https://api.github.com/users/blop/followers","following_url":"https://api.github.com/users/blop/following{/other_user}","gists_url":"https://api.github.com/users/blop/gists{/gist_id}","starred_url":"https://api.github.com/users/blop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blop/subscriptions","organizations_url":"https://api.github.com/users/blop/orgs","repos_url":"https://api.github.com/users/blop/repos","events_url":"https://api.github.com/users/blop/events{/privacy}","received_events_url":"https://api.github.com/users/blop/received_events","type":"User","site_admin":false},"created_at":"2018-10-29T16:31:09Z","updated_at":"2018-10-29T16:31:09Z","author_association":"NONE","body":"I'm not untarring it myself, I pass the tar to the Dockerfile ADD instruction https://docs.docker.com/engine/reference/builder/#add.\r\n\r\nThe timestamps I get afterwards are the ones set by Gradle here : \r\nhttps://github.com/gradle/gradle/blob/master/subprojects/core/src/main/java/org/gradle/api/internal/file/archive/TarCopyAction.java#L109\r\n\r\nThen later, when the Java app starts it has issues with the files with lastModifiedDate=0 which is the value chosen by Gradle when \"not preserving timestamps\"."}}
{"actor":{"display_login":"blop"}}