@@ -89,6 +89,8 @@ protected Logger getLogger()
89
89
90
90
private int defaultDirectoryMode = -1 ; // Optionally used if a value is needed
91
91
92
+ private int umask = -1 ;
93
+
92
94
private boolean forced = true ;
93
95
94
96
private List <ArchiveFinalizer > finalizers ;
@@ -440,14 +442,19 @@ private ArchiveEntry updateArchiveEntryAttributes( ArchiveEntry entry )
440
442
}
441
443
442
444
protected ArchiveEntry asArchiveEntry ( @ Nonnull final PlexusIoResource resource , final String destFileName ,
443
- final int permissions , PlexusIoResourceCollection collection )
445
+ int permissions , PlexusIoResourceCollection collection )
444
446
throws ArchiverException
445
447
{
446
448
if ( !resource .isExisting () )
447
449
{
448
450
throw new ArchiverException ( resource .getName () + " not found." );
449
451
}
450
452
453
+ if ( umask > 0 )
454
+ {
455
+ permissions &= ~umask ;
456
+ }
457
+
451
458
ArchiveEntry entry ;
452
459
if ( resource .isFile () )
453
460
{
@@ -1264,6 +1271,18 @@ public String getOverrideGroupName()
1264
1271
return overrideGroupName ;
1265
1272
}
1266
1273
1274
+ @ Override
1275
+ public void setUmask ( int umask )
1276
+ {
1277
+ this .umask = umask ;
1278
+ }
1279
+
1280
+ @ Override
1281
+ public int getUmask ()
1282
+ {
1283
+ return umask ;
1284
+ }
1285
+
1267
1286
/**
1268
1287
* @deprecated Use {@link #configureReproducibleBuild(FileTime)} instead.
1269
1288
*/
@@ -1288,6 +1307,9 @@ public void configureReproducibleBuild( FileTime lastModifiedTime )
1288
1307
setOverrideUserName ( "root" ); // is it possible to avoid this, like "tar --numeric-owner"?
1289
1308
setOverrideGid ( 0 );
1290
1309
setOverrideGroupName ( "root" );
1310
+
1311
+ // 4. set umask to 022 to avoid environment umask value particularly on group write
1312
+ setUmask ( 0 _022 );
1291
1313
}
1292
1314
1293
1315
/**
0 commit comments