@@ -231,7 +231,11 @@ static FilelistEntry parse(String line) {
231231
232232 // v1 format: only absolute path
233233 if (line .startsWith ("/" )) {
234- return new FilelistEntry (EntryType .FILE , line , DEFAULT_FILE_PERMISSIONS );
234+ Set <PosixFilePermission > permissions = isExecutable (line )
235+ ? DEFAULT_DIR_PERMISSIONS // 0755
236+ : DEFAULT_FILE_PERMISSIONS ; // 0644
237+
238+ return new FilelistEntry (EntryType .FILE , line , permissions );
235239 }
236240
237241 // v2 format: <type> <mode> <path>
@@ -275,6 +279,10 @@ private static String octalToSymbolic(String octal) {
275279 }
276280 }
277281
282+ private static boolean isExecutable (String resourcePath ) {
283+ return resourcePath .endsWith (".so" ) || resourcePath .endsWith (".sh" ) || resourcePath .contains ("/bin/" );
284+ }
285+
278286 private final class FileEntry extends BaseEntry {
279287 private byte [] data ;
280288 private List <FileEntry > toExtract ;
@@ -538,7 +546,6 @@ private void initEntries() {
538546 List <URL > filelistUrls = getFilelistURLs (filelistPath );
539547 boolean hasNativeFiles = false ;
540548
541-
542549 fine ("VFS fileslistPath = %s" , filelistPath );
543550 for (URL url : filelistUrls ) {
544551 try (InputStream stream = url .openStream ()) {
@@ -593,7 +600,10 @@ private void initEntries() {
593600
594601 assert parent != null ;
595602 if (!platformPath .endsWith (PLATFORM_SEPARATOR )) {
596- FileEntry fileEntry = new FileEntry (platformPath , meta .permissions ());
603+ Set <PosixFilePermission > permissions = isExecutable (platformPath )
604+ ? DEFAULT_DIR_PERMISSIONS // 0755
605+ : meta .permissions ();
606+ FileEntry fileEntry = new FileEntry (platformPath , permissions );
597607 if (extractFilter != null && extractFilter .test (Paths .get (platformPath ))) {
598608 fileEntry .toExtract = List .of (fileEntry );
599609 }
0 commit comments