Skip to content

Commit 20fb384

Browse files
willstrantoncopybara-github
authored andcommitted
Revert "Upgrade Apache Commons Compress from 1.26.1 to 1.28.0" (bazelbuild#28469)
Reverts the upgrade of Apache Commons Compress. 1.28.0 back to 1.26.1 due to bazelbuild#28454 The comment in that issue suggests downgrading to 1.27.1 instead but I opted to just revert to 1.26.1 as that was the previous version it was at to reduce the likelihood of any additional regressions that may have occurred in 1.27.1. I am not aware of any new functionality that relied on Apache Commons Compress being at 1.28.0. The upgrade was done to clean up a test and provide accurate decompressed timestamps. Fixes: bazelbuild#28454 Closes bazelbuild#28469. PiperOrigin-RevId: 862634285 Change-Id: I4f6696fd28f358ed26b5bb179bee14ace9b58009
1 parent 1d52819 commit 20fb384

File tree

3 files changed

+25
-13
lines changed

3 files changed

+25
-13
lines changed

MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ maven.install(
219219
"javax.activation:javax.activation-api:1.2.0",
220220
"javax.annotation:javax.annotation-api:1.3.2",
221221
"javax.inject:javax.inject:1",
222-
"org.apache.commons:commons-compress:1.28.0",
222+
"org.apache.commons:commons-compress:1.26.1",
223223
"org.apache.commons:commons-lang3:3.14.0",
224224
"org.apache.tomcat:tomcat-annotations-api:8.0.5",
225225
"org.apache.velocity:velocity:1.7",

maven_install.json

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"__AUTOGENERATED_FILE_DO_NOT_MODIFY_THIS_FILE_MANUALLY": "THERE_IS_NO_DATA_ONLY_ZUUL",
3-
"__INPUT_ARTIFACTS_HASH": -1192428811,
4-
"__RESOLVED_ARTIFACTS_HASH": -684605906,
3+
"__INPUT_ARTIFACTS_HASH": -443743500,
4+
"__RESOLVED_ARTIFACTS_HASH": -1216862662,
55
"conflict_resolution": {
66
"com.google.code.gson:gson:2.8.9": "com.google.code.gson:gson:2.11.0",
77
"com.google.errorprone:error_prone_annotations:2.30.0": "com.google.errorprone:error_prone_annotations:2.46.0",
@@ -25,7 +25,6 @@
2525
"io.netty:netty-transport-native-unix-common:4.1.110.Final": "io.netty:netty-transport-native-unix-common:4.1.119.Final",
2626
"io.netty:netty-transport:4.1.110.Final": "io.netty:netty-transport:4.1.119.Final",
2727
"io.opencensus:opencensus-api:0.31.0": "io.opencensus:opencensus-api:0.31.1",
28-
"org.apache.commons:commons-lang3:3.14.0": "org.apache.commons:commons-lang3:3.18.0",
2928
"org.checkerframework:checker-qual:3.12.0": "org.checkerframework:checker-qual:3.42.0"
3029
},
3130
"artifacts": {
@@ -379,9 +378,9 @@
379378
},
380379
"commons-codec:commons-codec": {
381380
"shasums": {
382-
"jar": "5c3881e4f556855e9c532927ee0c9dfde94cc66760d5805c031a59887070af5f"
381+
"jar": "ec87bfb55f22cbd1b21e2190eeda28b2b312ed2a431ee49fbdcc01812d04a5e4"
383382
},
384-
"version": "1.19.0"
383+
"version": "1.16.1"
385384
},
386385
"commons-collections:commons-collections": {
387386
"shasums": {
@@ -391,9 +390,9 @@
391390
},
392391
"commons-io:commons-io": {
393392
"shasums": {
394-
"jar": "df90bba0fe3cb586b7f164e78fe8f8f4da3f2dd5c27fa645f888100ccc25dd72"
393+
"jar": "a58af12ee1b68cfd2ebb0c27caef164f084381a00ec81a48cc275fd7ea54e154"
395394
},
396-
"version": "2.20.0"
395+
"version": "2.15.1"
397396
},
398397
"commons-lang:commons-lang": {
399398
"shasums": {
@@ -684,15 +683,15 @@
684683
},
685684
"org.apache.commons:commons-compress": {
686685
"shasums": {
687-
"jar": "e1522945218456f3649a39bc4afd70ce4bd466221519dba7d378f2141a4642ca"
686+
"jar": "27bb5d40f37c3bb7205b4a0540247df057715e9f6cbbd97d626ab8b50318bb04"
688687
},
689-
"version": "1.28.0"
688+
"version": "1.26.1"
690689
},
691690
"org.apache.commons:commons-lang3": {
692691
"shasums": {
693-
"jar": "4eeeae8d20c078abb64b015ec158add383ac581571cddc45c68f0c9ae0230720"
692+
"jar": "7b96bf3ee68949abb5bc465559ac270e0551596fa34523fddf890ec418dde13c"
694693
},
695-
"version": "3.18.0"
694+
"version": "3.14.0"
696695
},
697696
"org.apache.commons:commons-math3": {
698697
"shasums": {

src/test/java/com/google/devtools/build/lib/bazel/repository/decompressor/GzFunctionTest.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
package com.google.devtools.build.lib.bazel.repository.decompressor;
1616

1717
import static com.google.common.truth.Truth.assertThat;
18+
import static com.google.devtools.build.lib.testutil.TestConstants.PRODUCT_NAME;
1819
import static java.nio.charset.StandardCharsets.UTF_8;
20+
import static org.junit.Assume.assumeFalse;
1921

2022
import com.google.devtools.build.lib.testutil.TestUtils;
2123
import com.google.devtools.build.lib.vfs.FileSystem;
@@ -128,6 +130,9 @@ public static class FileAttributes {
128130

129131
@Test
130132
public void setLastModifiedTime() throws IOException {
133+
// TODO(pcloudy): Fix this test in Blaze.
134+
assumeFalse(
135+
"Skipping setLastModifiedTime test in Blaze environment.", PRODUCT_NAME.equals("blaze"));
131136
FileSystem testFs = TestArchiveDescriptor.getFileSystem();
132137
com.google.devtools.build.lib.vfs.Path tmpDir = TestUtils.createUniqueTmpDir(testFs);
133138
File testFile = new File(tmpDir.getPathFile(), "test_file");
@@ -150,8 +155,16 @@ public void setLastModifiedTime() throws IOException {
150155
fn.setFileAttributes(decompressorStream, testFs.getPath(testFile.getCanonicalPath()));
151156
}
152157

158+
// There was an error in Apache Commons Compress where the time was improperly divided by
159+
// 1000, thus losing 3 digits of precision. This replicates that wrong behavior until we
160+
// upgrade the Apache Commons Compress library to 1.28. At which point, you can replace
161+
// hackExpectedTimeSeconds below with unixTimeSeconds.
162+
// See https://github.com/apache/commons-compress/pull/624
163+
// NOTE: 1.28 also has an issue - see https://github.com/bazelbuild/bazel/issues/28454
164+
// so cleaning up this hack will need to wait until 1.29 is released.
165+
long hackExpectedTimeSeconds = unixTimeSeconds / 1000 * 1000;
153166
// Time should be in epoch milliseconds.
154-
assertThat(testFile.lastModified()).isEqualTo(unixTimeSeconds * 1000);
167+
assertThat(testFile.lastModified()).isEqualTo(hackExpectedTimeSeconds * 1000);
155168
}
156169
}
157170
}

0 commit comments

Comments
 (0)