Skip to content

Commit

Permalink
Override uId and gId for Tar in test
Browse files Browse the repository at this point in the history
We can not use posix mode because of mTime can have nanoseconds

Test can fail on OS with user ID as long, eg:
java.lang.IllegalArgumentException: user id '604932503' is too big ( > 2097151 ).
  • Loading branch information
slawekjaranowski committed Apr 21, 2023
1 parent ed5cc7a commit b517c63
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
import org.codehaus.plexus.archiver.exceptions.EmptyArchiveException;
import org.codehaus.plexus.archiver.tar.TarArchiver;
import org.codehaus.plexus.archiver.tar.TarFile;
import org.codehaus.plexus.archiver.tar.TarLongFileMode;
import org.codehaus.plexus.archiver.util.ArchiveEntryUtils;
import org.codehaus.plexus.archiver.util.DefaultArchivedFileSet;
import org.codehaus.plexus.archiver.util.DefaultFileSet;
Expand Down Expand Up @@ -809,6 +810,10 @@ public void testZipNonConcurrentResourceCollection()
{
final File tarFile = getTestFile( "target/output/zip-non-concurrent.tar" );
TarArchiver tarArchiver = (TarArchiver) lookup( Archiver.class, "tar" );
// Override uId and gId - in standard mode on OS where uId or gId can have long values creation of tar can fail
// We can not use posix mode because mTime can have nanoseconds in posix but zip doesn't so assertions can fail
tarArchiver.setOverrideUid(100);
tarArchiver.setOverrideGid(100);
tarArchiver.setDestFile( tarFile );
// We're testing concurrency issue so we need large amount of files
for ( int i = 0; i < 100; i++ )
Expand Down

0 comments on commit b517c63

Please sign in to comment.