aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main
diff options
context:
space:
mode:
authorGravatar Kristina Chodorow <kchodorow@google.com>2016-09-22 17:37:49 +0000
committerGravatar Kristina Chodorow <kchodorow@google.com>2016-09-22 17:53:11 +0000
commit296ffbde796f00c7a493330089085f9be1442f0b (patch)
tree332103207eb7b52c1229f4e33c0d7ca96522dc8d /src/main
parentcebb7522cac6a245a491ebf7a323d8e793bb0ef1 (diff)
*** Reason for rollback *** This is causing external_integration_test to fail See, for example, http://ci.bazel.io/job/bazel-tests/BAZEL_VERSION=HEAD,PLATFORM_NAME=linux-x86_64/236/console: ** test_http_archive_tar_xz **************************************************** GET /fox.tar.xz HTTP/1.1 User-Agent: Java/1.8.0_101 Host: localhost:36541 Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2 Connection: keep-alive cat: bazel-out/../external/endangered/fox/male_absolute: No such file or directory -- Test log: ----------------------------------------------------------- INFO: Reading 'startup' options from /home/ci/.cache/bazel/_bazel_ci/a761298a0949227106f79c62c3bebb6e/bazel-sandbox/81f51af6-eb50-417e-8f8d-b7bba207ee83-661/execroot/linux-x86_64/_tmp/external_integration_test_2/bazelrc: --output_user_root=/home/ci/.cache/bazel/_bazel_ci/a761298a0949227106f79c62c3bebb6e/bazel-sandbox/81f51af6-eb50-417e-8f8d-b7bba207ee83-661/execroot/linux-x86_64/_tmp/external_integration_test_2/root --host_javabase=/home/ci/.cache/bazel/_bazel_ci/a761298a0949227106f79c62c3bebb6e/bazel-sandbox/81f51af6-eb50-417e-8f8d-b7bba207ee83-661/execroot/linux-x86_64/bazel-out/local-fastbuild/bin/src/test/shell/bazel/external_integration_test.runfiles/local_jdk INFO: $TEST_TMPDIR defined: output root default is '/home/ci/.cache/bazel/_bazel_ci/a761298a0949227106f79c62c3bebb6e/bazel-sandbox/81f51af6-eb50-417e-8f8d-b7bba207ee83-661/execroot/linux-x86_64/_tmp/external_integration_test_2'. .............................................. ____Loading package: zoo ____Loading... ____Loading package: @bazel_tools//tools/cpp ____Loading package: @bazel_tools//tools/jdk ____Loading package: @local_config_xcode// ____Loading package: @local_jdk// ____Loading package: @local_config_cc// ____Loading complete. Analyzing... ____Downloading from [] 0B ____Downloading from [] 1KB ____Loading package: @endangered//fox ____Found 1 target... ____Building... ____[0 / 1] BazelWorkspaceStatusAction stable-status.txt ____[0 / 4] Creating source manifest for //zoo:breeding-program ____[0 / 4] Symlinking //zoo:breeding-program ____[3 / 4] Creating runfiles tree bazel-out/local-fastbuild/bin/zoo/breeding-program.runfiles ____Building complete. Target //zoo:breeding-program up-to-date: bazel-bin/zoo/breeding-program ____Elapsed time: 6.903s, Critical Path: 0.04s ____Running command line: bazel-bin/zoo/breeding-program Fraka-kaka-kaka-kaka-kow ------------------------------------------------------------------------ test_http_archive_tar_xz FAILED: Expected regexp #!/bin/bash echo Fraka-kaka-kaka-kaka-kow not found in bazel-out/../external/endangered/fox/male_absolute . /home/ci/.cache/bazel/_bazel_ci/a761298a0949227106f79c62c3bebb6e/bazel-sandbox/81f51af6-eb50-417e-8f8d-b7bba207ee83-661/execroot/linux-x86_64/bazel-out/local-fastbuild/bin/src/test/shell/bazel/external_integration_test.runfiles/io_bazel/src/test/shell/bazel/external_integration_test:154: in call to assert_files_same /home/ci/.cache/bazel/_bazel_ci/a761298a0949227106f79c62c3bebb6e/bazel-sandbox/81f51af6-eb50-417e-8f8d-b7bba207ee83-661/execroot/linux-x86_64/bazel-out/local-fastbuild/bin/src/test/shell/bazel/external_integration_test.runfiles/io_bazel/src/test/shell/bazel/external_integration_test:150: in call to http_archive_helper /home/ci/.cache/bazel/_bazel_ci/a761298a0949227106f79c62c3bebb6e/bazel-sandbox/81f51af6-eb50-417e-8f8d-b7bba207ee83-661/execroot/linux-x86_64/bazel-out/local-fastbuild/bin/src/test/shell/bazel/external_integration_test.runfiles/io_bazel/src/test/shell/bazel/external_integration_test:190: in call to test_http_archive_tar_xz FAILED: test_http_archive_tar_xz *** Original change description *** Fixed symbolic link and hard link path not stripped when "strip_prefix" is set. -- MOS_MIGRATED_REVID=133970692
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/google/devtools/build/lib/bazel/repository/CompressedTarFunction.java5
-rw-r--r--src/main/java/com/google/devtools/build/lib/vfs/FileSystemUtils.java16
2 files changed, 9 insertions, 12 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/repository/CompressedTarFunction.java b/src/main/java/com/google/devtools/build/lib/bazel/repository/CompressedTarFunction.java
index 8b4a5f4022..daf6e66267 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/repository/CompressedTarFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/repository/CompressedTarFunction.java
@@ -58,10 +58,7 @@ public abstract class CompressedTarFunction implements Decompressor {
FileSystemUtils.createDirectoryAndParents(filename);
} else {
if (entry.isSymbolicLink() || entry.isLink()) {
- // Strip the prefix from the link path if set
- StripPrefixedPath linkPath =
- StripPrefixedPath.maybeDeprefix(entry.getLinkName(), prefix);
- PathFragment linkName = linkPath.getPathFragment();
+ PathFragment linkName = new PathFragment(entry.getLinkName());
if (linkName.isAbsolute()) {
linkName = linkName.relativeTo(PathFragment.ROOT_DIR);
linkName = descriptor.repositoryPath().getRelative(linkName).asFragment();
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/FileSystemUtils.java b/src/main/java/com/google/devtools/build/lib/vfs/FileSystemUtils.java
index 73a9a5119f..c8d1f3c2c4 100644
--- a/src/main/java/com/google/devtools/build/lib/vfs/FileSystemUtils.java
+++ b/src/main/java/com/google/devtools/build/lib/vfs/FileSystemUtils.java
@@ -1010,19 +1010,19 @@ public class FileSystemUtils {
*/
public static void createHardLink(Path linkPath, Path originalPath) throws IOException {
- // Directory
- if (originalPath.isDirectory()) {
- for (Path originalSubpath : originalPath.getDirectoryEntries()) {
- Path linkSubpath = linkPath.getRelative(originalSubpath.relativeTo(originalPath));
- createHardLink(linkSubpath, originalSubpath);
- }
- // Other types of file
- } else {
+ // Regular file
+ if (originalPath.isFile()) {
Path parentDir = linkPath.getParentDirectory();
if (!parentDir.exists()) {
FileSystemUtils.createDirectoryAndParents(parentDir);
}
originalPath.createHardLink(linkPath);
+ // Directory
+ } else if (originalPath.isDirectory()) {
+ for (Path originalSubpath : originalPath.getDirectoryEntries()) {
+ Path linkSubpath = linkPath.getRelative(originalSubpath.relativeTo(originalPath));
+ createHardLink(linkSubpath, originalSubpath);
+ }
}
}
}