feedback-to-code/mozzarella huggingface dataset:
Repository: bazelbuild/bazel
Issue: Bazel j2obc WORKSPACE sha is invalid
Labels: type: bug
P2

### Description of the problem / feature request:

Bazels j2obc WORKSPACE file sha is different to the githubs release https://github.com/bazelbuild/bazel/blob/master/WORKSPACE#L39 .

### Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Running `bazel fetch @bazel_j2objc//...` outputs:

```sh
ERROR: Error downloading [https://github.com/google/j2objc/releases/download/2.0.3/j2objc-2.0.3.zip] to /private/var/tmp/_bazel_edwardmcfarlane/337d342990a69aca0642298fdb696d05/external/bazel_j2objc/j2objc-2.0.3.zip: Checksum was a36bac432d0dbd8c98249e484b2b69dd5720afa4abb58711a3c3def1c0bfa21d but wanted 529ee99e6f0e3f88edef61aeae4f13dc6e5eb8183993ced191338422b0e1fbeb
Building: no action
```

### What operating system are you running Bazel on?

Mac, installed via brew.

### What's the output of `bazel info release`?

`release 0.10.0-homebrew`


### What's the output of `git remote get-url origin ; git rev-parse master ; git rev-parse HEAD` ?
```sh
git@github.com:afking/bazel.git
d3e102c9fb62f4416099dc9f097a5f207aa7d442
d3e102c9fb62f4416099dc9f097a5f207aa7d442
```


Issue comments:
Hm, you're right, I just downloaded the zip file and computed sha256 on it, getting `a36bac432d0dbd8c98249e484b2b69dd5720afa4abb58711a3c3def1c0bfa21d`. /cc @kstanger 
Any idea why the hash changed?
They may have force-pushed a new version.
This is what @kstanger wrote to me:

> It's possible that the github zip got updated to fix a bug or something. Feel free to update the checksum.

Pull request review comments:

Patch that resolved the issue:
diff --git a/WORKSPACE b/WORKSPACE
index ccbf0dc027c5f6..3108c989bef30b 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -36,7 +36,8 @@ bind(
 http_archive(
     name = "bazel_j2objc",
     url = "https://github.com/google/j2objc/releases/download/2.0.3/j2objc-2.0.3.zip",
-    sha256 = "529ee99e6f0e3f88edef61aeae4f13dc6e5eb8183993ced191338422b0e1fbeb",
+    # Computed using "shasum -a 256 j2objc-2.0.3.zip"
+    sha256 = "a36bac432d0dbd8c98249e484b2b69dd5720afa4abb58711a3c3def1c0bfa21d",
     strip_prefix = "j2objc-2.0.3",
 )
 


Test patch:
Repository: bazelbuild/bazel
Issue: remote/performance: don't construct a merkle tree for remote caching

Remote caching doesn't benefit from constructing a merkle. Some users reported significant performance overheads from constructing the merkle tree. We might just want to compute the hash of the list of input file hashes instead.

cc: @benjaminp

Issue comments:
building a merkle tree should not be much more expensive than building a list if implemented correctly.
Does this still hold true compared to the comment mentioned here: https://github.com/bazelbuild/bazel/pull/7583#issuecomment-468568192?
I don't know. You'd have to benchmark the current merkle tree implementation against a list based approach I guess. I'd expect the list based approach to still be faster but I am not sure whether it's by a lot.

Pull request review comments:

Patch that resolved the issue:
diff --git a/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnCache.java b/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnCache.java
index 4ef09ad268f260..2da0cc1203d446 100644
--- a/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnCache.java
+++ b/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnCache.java
@@ -90,7 +90,7 @@ final class RemoteSpawnCache implements SpawnCache {
   @Override
   public CacheHandle lookup(Spawn spawn, SpawnExecutionContext context)
       throws InterruptedException, IOException, ExecException {
-    if (!Spawns.mayBeCached(spawn)) {
+    if (!Spawns.mayBeCached(spawn) || !Spawns.mayBeExecutedRemotely(spawn)) {
       return SpawnCache.NO_RESULT_NO_STORE;
     }
     boolean checkCache = options.remoteAcceptCached;


Test patch:
Repository: bazelbuild/bazel
Issue: remote/feature: support AWS S3 as a remote caching backend
Labels: type: feature request
P3

We have heard from many users who want to use AWS S3 as a remote caching backend for Bazel just as they currently do with Google Cloud Storage. This is useful when running inside Travis or CircleCI (https://github.com/notnoopci/bazel-remote-proxy) as these SaaS products already run inside AWS.

From skimming over the AWS S3 API documentation it seems that the APIs are mostly compatible, except for authentication. So implementing this feature will likely just mean to add AWS authentication to Bazel.

cc: @davidstanke @alexeagle

Issue comments:
#4889 is a stab at this
This is a duplicate of #4889 
Hi @buchgr, on this project, is a PR normally considered a duplicate of the feature request which requests it?
@buchgr would you consider reopening this issue?
FYI -- elsewhere (issue #4789) I mentioned that S3's weak consistency model could pose problems depending on how the cache is accessed. This is no longer true as of last December: https://aws.amazon.com/blogs/aws/amazon-s3-update-strong-read-after-write-consistency/

Just wanted to cancel out any FUD I spread 😄 
For anyone wanting this...

I set up a Cloudfront distribution in front of S3, with a Cloudfront Function doing basic auth (example: https://www.joshualyman.com/2022/01/add-http-basic-authentication-to-cloudfront-distributions/).

This provides both authentication and low latency. Pretty much an ideal solution, minus the normal complexity of doing anything in AWS.
@pauldraper How is the S3 bucket populated with cache content?

Pull request review comments:

Patch that resolved the issue:
diff --git a/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnCache.java b/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnCache.java
index 4ef09ad268f260..2da0cc1203d446 100644
--- a/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnCache.java
+++ b/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnCache.java
@@ -90,7 +90,7 @@ final class RemoteSpawnCache implements SpawnCache {
   @Override
   public CacheHandle lookup(Spawn spawn, SpawnExecutionContext context)
       throws InterruptedException, IOException, ExecException {
-    if (!Spawns.mayBeCached(spawn)) {
+    if (!Spawns.mayBeCached(spawn) || !Spawns.mayBeExecutedRemotely(spawn)) {
       return SpawnCache.NO_RESULT_NO_STORE;
     }
     boolean checkCache = options.remoteAcceptCached;


Test patch:
Repository: bazelbuild/bazel
Issue: pkg_tar with extension tgz does not apply gzip compression
Labels: type: bug
P4
team-Bazel

### Description of the problem / feature request:

`pkg_tar` with the extension `tgz` does not gzip the tar file. 

Using the extensions `tar.gz` does gzip the tar

The [documentation here](https://docs.bazel.build/versions/master/be/pkg.html) indicate `tgz` extensions should apply gzip compressed

### Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

```
pkg_tar(
    name = "content",
    srcs = [
        "testdata/bat/bat",
        "testdata/baz",
    ],
)

pkg_tar(
    name = "gzip_content",
    extension = "tgz",
    deps = [
        ":content",
    ],
)
```

```
$ file gzip_content.tgz
gzip_content.tgz: POSIX tar archive (GNU)
```

```
$ file gzip_content.tar.gz
gzip_content.tar.gz: gzip compressed data, was "gzip_content.tar", max compression
```

### What operating system are you running Bazel on?

macOS High Sierra 10.13.4

### What's the output of `bazel info release`?

release 0.12.0-homebrew


Issue comments:

Pull request review comments:
This is right, but it is confusing. because the implementation is a little too clever. It happens to be that all the allowed file types are of the form .tar.XX where XX is a valid compression.
To make this more readable, ee should simply have a map of allowed file extensions to the compression method they belong with. But that is not your fault, so I won't block merge on that.. 

Patch that resolved the issue:
diff --git a/tools/build_defs/pkg/pkg.bzl b/tools/build_defs/pkg/pkg.bzl
index 93ff5daf3e6e38..62cf4d94aee497 100644
--- a/tools/build_defs/pkg/pkg.bzl
+++ b/tools/build_defs/pkg/pkg.bzl
@@ -92,6 +92,8 @@ def _pkg_tar_impl(ctx):
         if dotPos > 0:
             dotPos += 1
             args += ["--compression=%s" % ctx.attr.extension[dotPos:]]
+        elif ctx.attr.extension == "tgz":
+            args += ["--compression=gz"]
     args += ["--tar=" + f.path for f in ctx.files.deps]
     args += [
         "--link=%s:%s" % (_quote(k, protect = ":"), ctx.attr.symlinks[k])


Test patch:
Repository: bazelbuild/bazel
Issue: Broken link to mobile application tutorial in Java build tutorial

### Description of the problem / feature request:

On the page https://docs.bazel.build/versions/master/tutorial/java.html, the link at the bottom of the page titled `mobile application tutorial` points to the URL https://docs.bazel.build/versions/master/tutorial/app.html but this page does not exist, so a 404 is displayed instead.

Issue comments:

Pull request review comments:

Patch that resolved the issue:
diff --git a/site/docs/tutorial/java.md b/site/docs/tutorial/java.md
index 4fbaefdbe7d19e..8352229a6b4adb 100644
--- a/site/docs/tutorial/java.md
+++ b/site/docs/tutorial/java.md
@@ -412,7 +412,8 @@ dependencies.
 *  The [C++ build tutorial](../tutorial/cpp.md) to get started with building
    C++ projects with Bazel.
 
-*  The [mobile application tutorial](../tutorial/app.md) to get started with
+*  The [Android application tutorial](../tutorial/android-app.md) and
+   [iOS application tutorial](../tutorial/ios-app.md) to get started with
    building mobile applications for Android and iOS with Bazel.
 
 Happy building!


Test patch:
Repository: bazelbuild/bazel
Issue: Documentation does not list all attribute types
Labels: type: bug
type: documentation (cleanup)

### Description of the problem / feature request:

https://docs.bazel.build/versions/master/build-ref.html#rules says:

> The full set of types that an attribute can have is: integer, label, list of labels, string, list of strings, output label, list of output labels

But there are quite a few more types that are available: https://docs.bazel.build/versions/master/skylark/lib/attr.html#modules.attr

Issue comments:
Thanks! If you feel like fixing it, here's the source for the doc file: https://github.com/bazelbuild/bazel/blob/master/site/docs/build-ref.html
(Otherwise someone else will fix it later.)

Pull request review comments:

Patch that resolved the issue:
diff --git a/site/docs/build-ref.html b/site/docs/build-ref.html
index 1b4d9ce3aa3562..944a692ff6bf0f 100644
--- a/site/docs/build-ref.html
+++ b/site/docs/build-ref.html
@@ -358,7 +358,7 @@ <h3 id="rules">Rules</h3>
   the <a href='be/overview.html'>Build
   Encyclopedia</a> for the full list of supported rules and their
   corresponding attributes.  Each attribute has a name and a
-  type.  The full set of types that an attribute can have is: integer,
+  type.  Some of the common types an attribute can have are integer,
   label, list of labels, string, list of strings, output label,
   list of output labels.  Not all attributes need to be specified in
   every rule.  Attributes thus form a dictionary from keys (names) to


Test patch:
Repository: bazelbuild/bazel
Issue: Skylint crashes on augmented assignments to IndexExpression.

### Description of the problem / feature request:

> Skylint crashes when invoked on a snippet like:
```
d["foo"] += "bar"
```

### Feature requests: what underlying problem are you trying to solve with this feature?

> Skylint crash

### Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

> Run Skylint on a file with `d["foo"] += "bar"`


Issue comments:

Pull request review comments:

Patch that resolved the issue:
diff --git a/src/tools/skylark/java/com/google/devtools/skylark/skylint/BadOperationChecker.java b/src/tools/skylark/java/com/google/devtools/skylark/skylint/BadOperationChecker.java
index 09df8ff7fe7e0e..cb9460ad010a9b 100644
--- a/src/tools/skylark/java/com/google/devtools/skylark/skylint/BadOperationChecker.java
+++ b/src/tools/skylark/java/com/google/devtools/skylark/skylint/BadOperationChecker.java
@@ -137,7 +137,13 @@ public void visit(BinaryOperatorExpression node) {
   @Override
   public void visit(AugmentedAssignmentStatement node) {
     super.visit(node);
-    Identifier ident = Iterables.getOnlyElement(node.getLValue().boundIdentifiers());
+    ImmutableSet<Identifier> lvalues = node.getLValue().boundIdentifiers();
+    if (lvalues.size() != 1) {
+      // assignment visitor does not track information about assignments to IndexExpressions like
+      // kwargs["name"] += "foo" so nothing to do here until that changes
+      return;
+    }
+    Identifier ident = Iterables.getOnlyElement(lvalues);
     NodeType identType = getInferredTypeOrNull(ident);
     NodeType expressionType = getInferredTypeOrNull(node.getExpression());
     if (identType == NodeType.DICT || expressionType == NodeType.DICT) {
diff --git a/src/tools/skylark/javatests/com/google/devtools/skylark/skylint/BadOperationCheckerTest.java b/src/tools/skylark/javatests/com/google/devtools/skylark/skylint/BadOperationCheckerTest.java
index 27c1063147d9d8..20cd662de72bea 100644
--- a/src/tools/skylark/javatests/com/google/devtools/skylark/skylint/BadOperationCheckerTest.java
+++ b/src/tools/skylark/javatests/com/google/devtools/skylark/skylint/BadOperationCheckerTest.java
@@ -152,4 +152,9 @@ public void divisionOperator() {
         .contains("1:1-1:5: '/' operator is deprecated");
     Truth.assertThat(findIssues("5 // 2")).isEmpty();
   }
+
+  @Test
+  public void augmentedAssignmentOperator() {
+    Truth.assertThat(findIssues("kwargs['name'] += 'foo'")).isEmpty();
+  }
 }


Test patch:
Repository: bazelbuild/bazel
Issue: Docs link to Visual C++ Build Tools 2015 is broken
Labels: type: documentation (cleanup)
platform: windows
bazel.build

### Description of the problem / feature request:

Link to `Visual C++ Build Tools 2015` in https://docs.bazel.build/versions/master/windows.html lead to a 404

### Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Open https://docs.bazel.build/versions/master/windows.html, click on `Visual C++ Build Tools 2015 or later`.

### What operating system are you running Bazel on?

N/A.

### What's the output of `bazel info release`?

N/A.

### If `bazel info release` returns "development version" or "(@non-git)", tell us how you built Bazel.

N/A.

### What's the output of `git remote get-url origin ; git rev-parse master ; git rev-parse HEAD` ?

N/A.

###  Have you found anything relevant by searching the web?

Actually found it super hard to find the mentioned Visual C++ Build Tools 2015 at all. Googling it doesn't seem to give a direct download page.

I found a link that works in [this](https://blogs.msdn.microsoft.com/pythonengineering/2016/04/11/unable-to-find-vcvarsall-bat/) python page: http://go.microsoft.com/fwlink/?LinkId=691126 

### Any other information, logs, or outputs that you want to share?

N/A.


Issue comments:
Thanks for reporting it!

Pull request review comments:
This link downloads a "visualcppbuildtools_full.exe" which seems pretty confusing to say the least. Maybe we should link the page where all the Visual C++ Build Tools are?
I agree. Microsoft is notorious for orphaning download links.
Done.

Patch that resolved the issue:
diff --git a/site/docs/windows.md b/site/docs/windows.md
index 9049fbbdd63cdc..3f454b693c6798 100644
--- a/site/docs/windows.md
+++ b/site/docs/windows.md
@@ -58,7 +58,7 @@ To build C++ targets, you need:
         features are not installed by default.
 
     *   Install the [Visual C++ Build
-        Tools 2015 or later](http://landinghub.visualstudio.com/visual-cpp-build-tools).
+        Tools 2015 or later](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2017).
 
         If [alwayslink](be/c-cpp.html#cc_library.alwayslink) doesn't work with
         VS 2017, that is due to a


Test patch:
Repository: bazelbuild/bazel
Issue: Toolchain tutorial contradicts ToolchainInfo reference documentation
Labels: type: documentation (cleanup)
P2
team-Configurability

### Description of the problem / feature request:

Reference documentation:
https://docs.bazel.build/versions/master/skylark/lib/platform_common.html#ToolchainInfo
> The provider constructor for ToolchainInfo. The constructor takes the type of the toolchain, and a map of the toolchain's data.

Tutorial:
https://docs.bazel.build/versions/master/toolchains.html#creating-a-toolchain-rule
```
def _my_toolchain_impl(ctx):
  toolchain = platform_common.ToolchainInfo(
    compiler = ctx.attr.compiler,
    system_lib = ctx.attr.system_lib,
    arch_flags = ctx.attr.arch_flags,
  )
  return [toolchain]
```

The tutorial doesn't call `ToolchainInfo` with the type of the toolchain at all, and doesn't pass in a map, just keyword arguments. I think the tutorial documents the correct usage.


Issue comments:
Thanks for bringing this to my attention. We're actually in the middle of a documentation audit this week, and this is exactly the type of issue we want to flag.

Pull request review comments:

Patch that resolved the issue:
diff --git a/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/platform/ToolchainInfoApi.java b/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/platform/ToolchainInfoApi.java
index ab37760d34563f..868c2801950cfa 100644
--- a/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/platform/ToolchainInfoApi.java
+++ b/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/platform/ToolchainInfoApi.java
@@ -18,13 +18,12 @@
 import com.google.devtools.build.lib.skylarkinterface.SkylarkModule;
 import com.google.devtools.build.lib.skylarkinterface.SkylarkModuleCategory;
 
-/**
- * Info object representing data about a specific toolchain.
- */
+/** Info object representing data about a specific toolchain. */
 @SkylarkModule(
     name = "ToolchainInfo",
-    doc = "Provides access to data about a specific toolchain.",
-    category = SkylarkModuleCategory.PROVIDER
-)
-public interface ToolchainInfoApi extends StructApi {
-}
+    doc =
+        "Provider which allows rule-specific toolchains to communicate data back to the actual"
+            + " rule implementation. Read more about <a"
+            + " href='../../toolchains.$DOC_EXT'>toolchains</a> for more information.",
+    category = SkylarkModuleCategory.PROVIDER)
+public interface ToolchainInfoApi extends StructApi {}


Test patch:
Repository: bazelbuild/bazel
Issue: Toolchain tutorial contradicts ToolchainInfo reference documentation
Labels: type: documentation (cleanup)
P2
team-Configurability

### Description of the problem / feature request:

Reference documentation:
https://docs.bazel.build/versions/master/skylark/lib/platform_common.html#ToolchainInfo
> The provider constructor for ToolchainInfo. The constructor takes the type of the toolchain, and a map of the toolchain's data.

Tutorial:
https://docs.bazel.build/versions/master/toolchains.html#creating-a-toolchain-rule
```
def _my_toolchain_impl(ctx):
  toolchain = platform_common.ToolchainInfo(
    compiler = ctx.attr.compiler,
    system_lib = ctx.attr.system_lib,
    arch_flags = ctx.attr.arch_flags,
  )
  return [toolchain]
```

The tutorial doesn't call `ToolchainInfo` with the type of the toolchain at all, and doesn't pass in a map, just keyword arguments. I think the tutorial documents the correct usage.


Issue comments:
Thanks for bringing this to my attention. We're actually in the middle of a documentation audit this week, and this is exactly the type of issue we want to flag.

Pull request review comments:

Patch that resolved the issue:
diff --git a/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/platform/PlatformCommonApi.java b/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/platform/PlatformCommonApi.java
index 5db6e4652af868..e07a30b3d20c7f 100644
--- a/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/platform/PlatformCommonApi.java
+++ b/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/platform/PlatformCommonApi.java
@@ -27,8 +27,8 @@ public interface PlatformCommonApi {
   @SkylarkCallable(
       name = "TemplateVariableInfo",
       doc =
-          "The provider used to retrieve the provider that contains the template variables "
-              + "defined by a particular toolchain, for example by calling "
+          "The provider used to retrieve the provider that contains the template variables defined"
+              + " by a particular toolchain, for example by calling "
               + "ctx.attr._cc_toolchain[platform_common.TemplateVariableInfo].make_variables[<name>]",
       structField = true)
   ProviderApi getMakeVariableProvider();
@@ -36,8 +36,8 @@ public interface PlatformCommonApi {
   @SkylarkCallable(
       name = "ToolchainInfo",
       doc =
-          "The provider constructor for ToolchainInfo. The constructor takes the type of the "
-              + "toolchain, and a map of the toolchain's data.",
+          "The provider constructor for ToolchainInfo. The constructor takes a map of the "
+              + "toolchain's data.",
       structField = true)
   ProviderApi getToolchainInfoConstructor();
 


Test patch: