Skip to content

Commit 6964b62

Browse files
committed
force root/root uid/gid for reproducible tar
1 parent 2d3bd82 commit 6964b62

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/main/java/org/codehaus/plexus/archiver/AbstractArchiver.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,6 +1278,12 @@ public int compare( String s1, String s2 )
12781278
// notice: this overrides execute bit on Unix (that is already ignored on Windows)
12791279
setFileMode( Archiver.DEFAULT_FILE_MODE );
12801280
setDirectoryMode( Archiver.DEFAULT_DIR_MODE );
1281+
1282+
// 4. ignore uid/gid from filesystem (for tar)
1283+
setOverrideUid( 0 );
1284+
setOverrideUserName( "root" ); // is it possible to avoid this, like "tar --numeric-owner"?
1285+
setOverrideGid( 0 );
1286+
setOverrideGroupName( "root" );
12811287
}
12821288

12831289
protected Date convertSourceDateEpochToDate( int sourceDateEpoch )

0 commit comments

Comments
 (0)