eyforia opened a new issue, #450:
URL: https://github.com/apache/maven-build-cache-extension/issues/450

   ### Affected version
   
   1.2.2
   
   ### Bug description
   
   I ran into a problem with the latest version of `maven-build-cache` 
extension (1.2.2) failing to correctly restore "execute" permissions for *.sh 
files from `<attachedOutputs>`, even with `<preservePermissions/>` enabled :-(
   
   I see that  with @cowwoc 's fix #392 (thank you) the zip file is created 
with correct permissions, however `CacheUtils.unzip()` does not seem to be be 
restoring unix permissions correctly from the zip archive (see screenshots 
below)
   
   It looks like the problem is caused by a known limitation of `apache 
commons-compress` 's `ZipArchiveInputStream` - it's not populating zip entry's 
file permissions during the unzip operation :-( the solution is to switch to 
using ZipFile instead of ZipArchiveInputStream (recommended in 
`commons-compress` javadocs - see screenshots below. 
   
   Steps to reproduce: 
   1. run "./mvnw clean package" for the first time.  The generated Zip for the 
`attachedOutput` has correctly preserved "execute" permission (done in #392 )
   <img width="1487" height="334" alt="Image" 
src="https://github.com/user-attachments/assets/08bdc743-327b-448b-a7b3-e4b2d52f014b";
 />
   
   2. run "./mvnw clean package" for the second time. Check the target folder - 
notice that "execute" permission is removed after the target folder is restored 
from the zip archive
   <img width="1086" height="281" alt="Image" 
src="https://github.com/user-attachments/assets/ddefca86-cab6-4bdc-bd90-79c0d141f762";
 />
   
   javadoc for "ZipArchiveInputStream":
   <img width="1139" height="643" alt="Image" 
src="https://github.com/user-attachments/assets/140f7c38-b1be-4a61-a465-0649900bb82e";
 />
   
   Suggested fix (will opena a separate PR after I'm done with the unit test):
   <img width="1767" height="924" alt="Image" 
src="https://github.com/user-attachments/assets/06a64410-7e12-4c8b-be2a-8982044d4f28";
 />
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to