Skip to content

Commit

Permalink
Do not crash when constructing an error message for a directory sourc…
Browse files Browse the repository at this point in the history
…e artifact with an owner label of `:.`.

Such a label occurs with `exports_files["."]`, however an exception is unexpected and may indicate that the filesystem is corrupted.

PiperOrigin-RevId: 392679200
  • Loading branch information
justinhorvitz authored and copybara-github committed Aug 24, 2021
1 parent 4a57146 commit 11a985f
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -437,8 +437,9 @@ private static final class ArtifactFunctionException extends SkyFunctionExceptio

private static String constructErrorMessage(Artifact artifact, String error) {
Label ownerLabel = artifact.getOwner();
if (ownerLabel == null) {
// Discovered inputs may not have an owner.
if (ownerLabel == null || ownerLabel.getName().equals(".")) {
// Discovered inputs may not have an owner. Directory source artifacts may be owned by a label
// ':.' which will crash toPathFragment below.
return String.format("%s '%s'", error, artifact.getExecPathString());
} else if (ownerLabel.toPathFragment().equals(artifact.getExecPath())) {
// No additional useful information from path.
Expand Down

0 comments on commit 11a985f

Please sign in to comment.