Program: 110618
Project: 110618
Buggy source:
private static FileInfo lookUpFileInfo(Environment env,TraversalRequest traversal) throws MissingDepException, IOException, InterruptedException {
  FileValue fileValue=(FileValue)env.getValueOrThrow(FileValue.key(traversal.path),IOException.class);
  if (env.valuesMissing()) {
    throw new MissingDepException();
  }
  if (fileValue.exists()) {
    PathFragment unresolvedLinkTarget=null;
    FileType type=null;
    if (fileValue.isSymlink()) {
      unresolvedLinkTarget=fileValue.getUnresolvedLinkTarget();
      type=fileValue.isDirectory() ? FileType.SYMLINK_TO_DIRECTORY : FileType.SYMLINK_TO_FILE;
    }
 else {
      type=fileValue.isDirectory() ? FileType.DIRECTORY : FileType.FILE;
    }
    return new FileInfo(type,fileValue.realFileStateValue(),fileValue.realRootedPath(),unresolvedLinkTarget);
  }
 else {
    return new FileInfo(fileValue.isSymlink() ? FileType.DANGLING_SYMLINK : FileType.NONEXISTENT,fileValue.realFileStateValue(),null,fileValue.isSymlink() ? fileValue.getUnresolvedLinkTarget() : null);
  }
}

Fixed version (ground truth):
private static FileInfo lookUpFileInfo(Environment env,TraversalRequest traversal) throws MissingDepException, IOException, InterruptedException {
  if (traversal.isGenerated) {
    byte[] digest=null;
    if (traversal.root.getOutputArtifact() != null) {
      Artifact artifact=traversal.root.getOutputArtifact();
      SkyKey artifactKey=ArtifactSkyKey.key(artifact,true);
      SkyValue value=env.getValue(artifactKey);
      if (env.valuesMissing()) {
        throw new MissingDepException();
      }
      if (value instanceof FileArtifactValue) {
        FileArtifactValue fsVal=(FileArtifactValue)value;
        digest=fsVal.getDigest();
      }
 else {
        return new FileInfo(FileType.NONEXISTENT,null,null,null);
      }
    }
    Path path=traversal.root.asRootedPath().asPath();
    FileStatus noFollowStat=path.stat(Symlinks.NOFOLLOW);
    FileStatus followStat=path.statIfFound(Symlinks.FOLLOW);
    FileType type;
    PathFragment unresolvedLinkTarget=null;
    RootedPath realPath=traversal.root.asRootedPath();
    if (followStat == null) {
      type=FileType.DANGLING_SYMLINK;
      if (!noFollowStat.isSymbolicLink()) {
        throw new IOException("String_Node_Str" + path + "String_Node_Str"+ noFollowStat);
      }
      unresolvedLinkTarget=path.readSymbolicLink();
    }
 else     if (noFollowStat.isFile()) {
      type=FileType.FILE;
    }
 else     if (noFollowStat.isDirectory()) {
      type=FileType.DIRECTORY;
    }
 else {
      unresolvedLinkTarget=path.readSymbolicLink();
      realPath=RootedPath.toRootedPath(Root.absoluteRoot(path.getFileSystem()),path.resolveSymbolicLinks());
      type=followStat.isFile() ? FileType.SYMLINK_TO_FILE : FileType.SYMLINK_TO_DIRECTORY;
    }
    return new FileInfo(type,FileStateValue.createWithStatNoFollow(traversal.root.asRootedPath(),new StatWithDigest(noFollowStat,digest),null),realPath,unresolvedLinkTarget);
  }
 else {
    FileValue fileValue=(FileValue)env.getValueOrThrow(FileValue.key(traversal.root.asRootedPath()),IOException.class);
    if (env.valuesMissing()) {
      throw new MissingDepException();
    }
    if (fileValue.exists()) {
      PathFragment unresolvedLinkTarget=null;
      FileType type;
      if (fileValue.isSymlink()) {
        unresolvedLinkTarget=fileValue.getUnresolvedLinkTarget();
        type=fileValue.isDirectory() ? FileType.SYMLINK_TO_DIRECTORY : FileType.SYMLINK_TO_FILE;
      }
 else {
        type=fileValue.isDirectory() ? FileType.DIRECTORY : FileType.FILE;
      }
      return new FileInfo(type,fileValue.realFileStateValue(),fileValue.realRootedPath(),unresolvedLinkTarget);
    }
 else {
      return new FileInfo(fileValue.isSymlink() ? FileType.DANGLING_SYMLINK : FileType.NONEXISTENT,fileValue.realFileStateValue(),null,fileValue.isSymlink() ? fileValue.getUnresolvedLinkTarget() : null);
    }
  }
}