You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "eyforia (via GitHub)" <gi...@apache.org> on 2026/02/05 05:57:51 UTC

[PR] fix for issue #450 - fixed CacheUtils.unzip to properly restore unix permissions on file systems that support it [maven-build-cache-extension]

eyforia opened a new pull request, #451:
URL: https://github.com/apache/maven-build-cache-extension/pull/451

   Fix for issue https://github.com/apache/maven-build-cache-extension/issues/450
   
   CacheUtils.unzip() is using ZipArchiveInputStream which is not properly reading unix permissions. Apparently, it's a known shortcoming documented in commons-compress javadocs. Switched to using ZipFile and permissions are now extracted correctly. See more details in the issue above.
   
   Following this checklist to help us incorporate your
   contribution quickly and easily:
   
   - [x] Your pull request should address just one issue, without pulling in other changes.
   - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
   - [x] Each commit in the pull request should have a meaningful subject line and body.
     Note that commits might be squashed by a maintainer on merge.
   - [x] Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied.
     This may not always be possible but is a best-practice.
   - [x] Run `mvn verify` to make sure basic checks pass.
     A more thorough check will be performed on your pull request automatically.
   - [x] You have run the integration tests successfully (`mvn -Prun-its verify`).
   
   If your pull request is about ~20 lines of code you don't need to sign an
   [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure
   please ask on the developers list.
   
   To make clear that you license your contribution under
   the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   you have to acknowledge this by using the following check-box.
   
   - [x] I hereby declare this contribution to be licenced under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   - [x] In any other case, please file an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix for issue #450 - fixed CacheUtils.unzip to properly restore unix permissions on file systems that support it [maven-build-cache-extension]

Posted by "eyforia (via GitHub)" <gi...@apache.org>.
eyforia commented on code in PR #451:
URL: https://github.com/apache/maven-build-cache-extension/pull/451#discussion_r2807563292


##########
src/test/java/org/apache/maven/buildcache/CacheUtilsPermissionsTest.java:
##########
@@ -154,6 +154,37 @@ void testPermissionsDoNotAffectHashWhenDisabled() throws IOException {
                         + "Files should use system default permissions (umask).");
     }
 
+    @Test
+    void testPermissionsAreRestoredOnUnzip() throws Exception {
+        // Skip test on non-POSIX filesystems (e.g., Windows)
+        if (!tempDir.getFileSystem().supportedFileAttributeViews().contains("posix")) {

Review Comment:
   merci!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix for issue #450 - fixed CacheUtils.unzip to properly restore unix permissions on file systems that support it [maven-build-cache-extension]

Posted by "eyforia (via GitHub)" <gi...@apache.org>.
eyforia commented on code in PR #451:
URL: https://github.com/apache/maven-build-cache-extension/pull/451#discussion_r2791450049


##########
src/test/java/org/apache/maven/buildcache/CacheUtilsPermissionsTest.java:
##########
@@ -154,6 +154,37 @@ void testPermissionsDoNotAffectHashWhenDisabled() throws IOException {
                         + "Files should use system default permissions (umask).");
     }
 
+    @Test
+    void testPermissionsAreRestoredOnUnzip() throws Exception {
+        // Skip test on non-POSIX filesystems (e.g., Windows)
+        if (!tempDir.getFileSystem().supportedFileAttributeViews().contains("posix")) {

Review Comment:
   makes sense. 
   :heavy_check_mark: Done (also  added annotations to methods previously added by @cowwoc 
   Please verify @olamy 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix for issue #450 - fixed CacheUtils.unzip to properly restore unix permissions on file systems that support it [maven-build-cache-extension]

Posted by "eyforia (via GitHub)" <gi...@apache.org>.
eyforia commented on code in PR #451:
URL: https://github.com/apache/maven-build-cache-extension/pull/451#discussion_r2791450049


##########
src/test/java/org/apache/maven/buildcache/CacheUtilsPermissionsTest.java:
##########
@@ -154,6 +154,37 @@ void testPermissionsDoNotAffectHashWhenDisabled() throws IOException {
                         + "Files should use system default permissions (umask).");
     }
 
+    @Test
+    void testPermissionsAreRestoredOnUnzip() throws Exception {
+        // Skip test on non-POSIX filesystems (e.g., Windows)
+        if (!tempDir.getFileSystem().supportedFileAttributeViews().contains("posix")) {

Review Comment:
   makes sense. 
   :heavy_check_mark: Done (also  added annotations to methods contributed by @cowwoc)
   Please verify @olamy. 
   
   Update: hang on - looks like there's a conflict - fixing...



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix for issue #450 - fixed CacheUtils.unzip to properly restore unix permissions on file systems that support it [maven-build-cache-extension]

Posted by "olamy (via GitHub)" <gi...@apache.org>.
olamy commented on code in PR #451:
URL: https://github.com/apache/maven-build-cache-extension/pull/451#discussion_r2780926997


##########
src/test/java/org/apache/maven/buildcache/CacheUtilsPermissionsTest.java:
##########
@@ -154,6 +154,37 @@ void testPermissionsDoNotAffectHashWhenDisabled() throws IOException {
                         + "Files should use system default permissions (umask).");
     }
 
+    @Test
+    void testPermissionsAreRestoredOnUnzip() throws Exception {
+        // Skip test on non-POSIX filesystems (e.g., Windows)
+        if (!tempDir.getFileSystem().supportedFileAttributeViews().contains("posix")) {

Review Comment:
   I didn't review correctly previous PR.
   But probably better using junit native annotation such `@EnabledOnOs`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix for issue #450 - fixed CacheUtils.unzip to properly restore unix permissions on file systems that support it [maven-build-cache-extension]

Posted by "olamy (via GitHub)" <gi...@apache.org>.
olamy commented on code in PR #451:
URL: https://github.com/apache/maven-build-cache-extension/pull/451#discussion_r2780984911


##########
src/test/java/org/apache/maven/buildcache/CacheUtilsPermissionsTest.java:
##########
@@ -154,6 +154,37 @@ void testPermissionsDoNotAffectHashWhenDisabled() throws IOException {
                         + "Files should use system default permissions (umask).");
     }
 
+    @Test
+    void testPermissionsAreRestoredOnUnzip() throws Exception {
+        // Skip test on non-POSIX filesystems (e.g., Windows)
+        if (!tempDir.getFileSystem().supportedFileAttributeViews().contains("posix")) {

Review Comment:
   done here https://github.com/apache/maven-build-cache-extension/pull/454



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix for issue #450 - fixed CacheUtils.unzip to properly restore unix permissions on file systems that support it [maven-build-cache-extension]

Posted by "eyforia (via GitHub)" <gi...@apache.org>.
eyforia commented on PR #451:
URL: https://github.com/apache/maven-build-cache-extension/pull/451#issuecomment-3864803153

   bump. 
   @pn-santos @cowwoc @maximiln please review


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix for issue #450 - fixed CacheUtils.unzip to properly restore unix permissions on file systems that support it [maven-build-cache-extension]

Posted by "eyforia (via GitHub)" <gi...@apache.org>.
eyforia commented on code in PR #451:
URL: https://github.com/apache/maven-build-cache-extension/pull/451#discussion_r2791450049


##########
src/test/java/org/apache/maven/buildcache/CacheUtilsPermissionsTest.java:
##########
@@ -154,6 +154,37 @@ void testPermissionsDoNotAffectHashWhenDisabled() throws IOException {
                         + "Files should use system default permissions (umask).");
     }
 
+    @Test
+    void testPermissionsAreRestoredOnUnzip() throws Exception {
+        // Skip test on non-POSIX filesystems (e.g., Windows)
+        if (!tempDir.getFileSystem().supportedFileAttributeViews().contains("posix")) {

Review Comment:
   makes sense. 
   :heavy_check_mark: Done (also  added annotations to methods contributed by @cowwoc)
   Please verify @olamy 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix for issue #450 - fixed CacheUtils.unzip to properly restore unix permissions on file systems that support it [maven-build-cache-extension]

Posted by "olamy (via GitHub)" <gi...@apache.org>.
olamy commented on code in PR #451:
URL: https://github.com/apache/maven-build-cache-extension/pull/451#discussion_r2780926997


##########
src/test/java/org/apache/maven/buildcache/CacheUtilsPermissionsTest.java:
##########
@@ -154,6 +154,37 @@ void testPermissionsDoNotAffectHashWhenDisabled() throws IOException {
                         + "Files should use system default permissions (umask).");
     }
 
+    @Test
+    void testPermissionsAreRestoredOnUnzip() throws Exception {
+        // Skip test on non-POSIX filesystems (e.g., Windows)
+        if (!tempDir.getFileSystem().supportedFileAttributeViews().contains("posix")) {

Review Comment:
   I didn't review correctly previous PR.
   But probably better using junit native annotation such `@EnabledOnOs` or `@DisabledOnOs(OS.WINDOWS)`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix for issue #450 - fixed CacheUtils.unzip to properly restore unix permissions on file systems that support it [maven-build-cache-extension]

Posted by "eyforia (via GitHub)" <gi...@apache.org>.
eyforia commented on code in PR #451:
URL: https://github.com/apache/maven-build-cache-extension/pull/451#discussion_r2801282288


##########
src/test/java/org/apache/maven/buildcache/CacheUtilsPermissionsTest.java:
##########
@@ -154,6 +154,37 @@ void testPermissionsDoNotAffectHashWhenDisabled() throws IOException {
                         + "Files should use system default permissions (umask).");
     }
 
+    @Test
+    void testPermissionsAreRestoredOnUnzip() throws Exception {
+        // Skip test on non-POSIX filesystems (e.g., Windows)
+        if (!tempDir.getFileSystem().supportedFileAttributeViews().contains("posix")) {

Review Comment:
   Bump. Please review/approve. Would be great if this fix makes it into the next release



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix for issue #450 - fixed CacheUtils.unzip to properly restore unix permissions on file systems that support it [maven-build-cache-extension]

Posted by "olamy (via GitHub)" <gi...@apache.org>.
olamy merged PR #451:
URL: https://github.com/apache/maven-build-cache-extension/pull/451


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix for issue #450 - fixed CacheUtils.unzip to properly restore unix permissions on file systems that support it [maven-build-cache-extension]

Posted by "eyforia (via GitHub)" <gi...@apache.org>.
eyforia commented on code in PR #451:
URL: https://github.com/apache/maven-build-cache-extension/pull/451#discussion_r2791450049


##########
src/test/java/org/apache/maven/buildcache/CacheUtilsPermissionsTest.java:
##########
@@ -154,6 +154,37 @@ void testPermissionsDoNotAffectHashWhenDisabled() throws IOException {
                         + "Files should use system default permissions (umask).");
     }
 
+    @Test
+    void testPermissionsAreRestoredOnUnzip() throws Exception {
+        // Skip test on non-POSIX filesystems (e.g., Windows)
+        if (!tempDir.getFileSystem().supportedFileAttributeViews().contains("posix")) {

Review Comment:
   makes sense. :heavy_check_mark: Done. Please verify @olamy 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix for issue #450 - fixed CacheUtils.unzip to properly restore unix permissions on file systems that support it [maven-build-cache-extension]

Posted by "eyforia (via GitHub)" <gi...@apache.org>.
eyforia closed pull request #451: fix for issue #450 - fixed CacheUtils.unzip to properly restore unix permissions on file systems that support it
URL: https://github.com/apache/maven-build-cache-extension/pull/451


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix for issue #450 - fixed CacheUtils.unzip to properly restore unix permissions on file systems that support it [maven-build-cache-extension]

Posted by "eyforia (via GitHub)" <gi...@apache.org>.
eyforia commented on code in PR #451:
URL: https://github.com/apache/maven-build-cache-extension/pull/451#discussion_r2791450049


##########
src/test/java/org/apache/maven/buildcache/CacheUtilsPermissionsTest.java:
##########
@@ -154,6 +154,37 @@ void testPermissionsDoNotAffectHashWhenDisabled() throws IOException {
                         + "Files should use system default permissions (umask).");
     }
 
+    @Test
+    void testPermissionsAreRestoredOnUnzip() throws Exception {
+        // Skip test on non-POSIX filesystems (e.g., Windows)
+        if (!tempDir.getFileSystem().supportedFileAttributeViews().contains("posix")) {

Review Comment:
   makes sense. :heavy_check_mark: Done. Please verify @olamy. 



##########
src/test/java/org/apache/maven/buildcache/CacheUtilsPermissionsTest.java:
##########
@@ -154,6 +154,37 @@ void testPermissionsDoNotAffectHashWhenDisabled() throws IOException {
                         + "Files should use system default permissions (umask).");
     }
 
+    @Test
+    void testPermissionsAreRestoredOnUnzip() throws Exception {
+        // Skip test on non-POSIX filesystems (e.g., Windows)
+        if (!tempDir.getFileSystem().supportedFileAttributeViews().contains("posix")) {

Review Comment:
   makes sense. :heavy_check_mark: Done. Please review @olamy



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org