Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace escape_locations with escape_locations_and_make_variables everywhere #861

Merged

Conversation

fmeum
Copy link
Contributor

@fmeum fmeum commented Jan 20, 2022

This fixes #857 fundamentally by adressing the root cause - expand_locations can't be applied to a shell command fragment by itself as it doesn't unescape $$.

I divided this PR into individual commits with more detailed commit messages to make the review easier, but feel free to squash them in the end if that's your preferred workflow.

@fmeum fmeum force-pushed the 857-fix-escape-locations-use branch from df43ab5 to 6a51c43 Compare January 20, 2022 14:35
@fmeum
Copy link
Contributor Author

fmeum commented Jan 20, 2022

The RBE job fails with

Output type mismatch
--
  | java.io.IOException: io.grpc.StatusRuntimeException: FAILED_PRECONDITION: Output type mismatch
  | at com.google.devtools.build.lib.remote.GrpcRemoteExecutor.executeRemotely(GrpcRemoteExecutor.java:235)
  | at com.google.devtools.build.lib.remote.RemoteExecutionService.executeRemotely(RemoteExecutionService.java:1243)
  | at com.google.devtools.build.lib.remote.RemoteSpawnRunner.lambda$exec$2(RemoteSpawnRunner.java:264)
  | at com.google.devtools.build.lib.remote.Retrier.execute(Retrier.java:244)
  | at com.google.devtools.build.lib.remote.RemoteRetrier.execute(RemoteRetrier.java:125)
  | at com.google.devtools.build.lib.remote.RemoteRetrier.execute(RemoteRetrier.java:114)
  | at com.google.devtools.build.lib.remote.RemoteSpawnRunner.exec(RemoteSpawnRunner.java:239)
  | at com.google.devtools.build.lib.exec.SpawnRunner.execAsync(SpawnRunner.java:245)
  | at com.google.devtools.build.lib.exec.AbstractSpawnStrategy.exec(AbstractSpawnStrategy.java:146)
  | at com.google.devtools.build.lib.exec.AbstractSpawnStrategy.exec(AbstractSpawnStrategy.java:108)
  | at com.google.devtools.build.lib.actions.SpawnStrategy.beginExecution(SpawnStrategy.java:47)
  | at com.google.devtools.build.lib.exec.SpawnStrategyResolver.beginExecution(SpawnStrategyResolver.java:68)
  | at com.google.devtools.build.lib.analysis.actions.SpawnAction.beginExecution(SpawnAction.java:328)
  | at com.google.devtools.build.lib.actions.Action.execute(Action.java:133)
  | at com.google.devtools.build.lib.skyframe.SkyframeActionExecutor$5.execute(SkyframeActionExecutor.java:907)
  | at com.google.devtools.build.lib.skyframe.SkyframeActionExecutor$ActionRunner.continueAction(SkyframeActionExecutor.java:1076)
  | at com.google.devtools.build.lib.skyframe.SkyframeActionExecutor$ActionRunner.run(SkyframeActionExecutor.java:1031)
  | at com.google.devtools.build.lib.skyframe.ActionExecutionState.runStateMachine(ActionExecutionState.java:152)
  | at com.google.devtools.build.lib.skyframe.ActionExecutionState.getResultOrDependOnFuture(ActionExecutionState.java:91)
  | at com.google.devtools.build.lib.skyframe.SkyframeActionExecutor.executeAction(SkyframeActionExecutor.java:492)
  | at com.google.devtools.build.lib.skyframe.ActionExecutionFunction.checkCacheAndExecuteIfNeeded(ActionExecutionFunction.java:856)
  | at com.google.devtools.build.lib.skyframe.ActionExecutionFunction.computeInternal(ActionExecutionFunction.java:349)
  | at com.google.devtools.build.lib.skyframe.ActionExecutionFunction.compute(ActionExecutionFunction.java:169)
  | at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:590)
  | at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:382)
  | at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
  | at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
  | at java.base/java.lang.Thread.run(Unknown Source)
  | Caused by: io.grpc.StatusRuntimeException: FAILED_PRECONDITION: Output type mismatch
  | at io.grpc.Status.asRuntimeException(Status.java:535)
  | at io.grpc.stub.ClientCalls$BlockingResponseStream.hasNext(ClientCalls.java:648)
  | at com.google.devtools.build.lib.remote.GrpcRemoteExecutor.lambda$executeRemotely$2(GrpcRemoteExecutor.java:169)
  | at com.google.devtools.build.lib.remote.Retrier.execute(Retrier.java:244)
  | at com.google.devtools.build.lib.remote.RemoteRetrier.execute(RemoteRetrier.java:125)
  | at com.google.devtools.build.lib.remote.RemoteRetrier.execute(RemoteRetrier.java:114)
  | at com.google.devtools.build.lib.remote.GrpcRemoteExecutor.lambda$executeRemotely$3(GrpcRemoteExecutor.java:140)
  | at com.google.devtools.build.lib.remote.util.Utils.refreshIfUnauthenticated(Utils.java:525)
  | at com.google.devtools.build.lib.remote.GrpcRemoteExecutor.executeRemotely(GrpcRemoteExecutor.java:138)
  | ... 27 more

That does look too generic to be caused by this PR, but I'm not sure. @UebelAndre Have you seen this before?

@garrettkajmowicz-sophos

I tested this locally and it seems to address the issue as well.

@fmeum fmeum force-pushed the 857-fix-escape-locations-use branch from 19f593b to 9468131 Compare February 9, 2022 21:05
@jsharpe jsharpe enabled auto-merge (squash) February 9, 2022 21:53
@jsharpe
Copy link
Collaborator

jsharpe commented Feb 9, 2022

@fmeum I've just merged a PR to pin buildifier to the previous version which should resolve the build failures here on a rebase

fmeum and others added 5 commits February 9, 2022 23:32
Adds support for types other than dict and non-attr values in the same
way as expand_locations.
expand_locations leads to broken commandlines if used by itself since it
expects dollar signs to be escaped, but does not unescape them.

This is a mildly breaking change as previously accepted uses of $ now
have to be replaced by $$. As a benefit, this escaping scheme is now
consistent across all attributes as well as with Bazel native rules.
Co-authored-by: James Sharpe <james.sharpe@zenotech.com>
@fmeum fmeum force-pushed the 857-fix-escape-locations-use branch from 9468131 to db51890 Compare February 9, 2022 22:32
@jsharpe jsharpe merged commit 26eadbc into bazelbuild:main Feb 9, 2022
@fmeum fmeum deleted the 857-fix-escape-locations-use branch February 9, 2022 22:34
@attilaolah
Copy link
Contributor

It would be great if you we could push a new release including this PR, as I have some failing builds (that were passing in an ancient version using some other workarounds), and resolving those failures requires this change to be merged.

:shipit:

attilaolah pushed a commit to attilaolah/wasm that referenced this pull request Mar 29, 2022
Pin to the current main branch while we get a release that includes
bazelbuild/rules_foreign_cc#861.
@UebelAndre
Copy link
Collaborator

It would be great if you we could push a new release including this PR, as I have some failing builds (that were passing in an ancient version using some other workarounds), and resolving those failures requires this change to be merged.

:shipit:

Can you create a new issue requesting the release so we can track it better?

@attilaolah attilaolah mentioned this pull request Mar 29, 2022
attilaolah pushed a commit to attilaolah/wasm that referenced this pull request Mar 29, 2022
* Fix some Emscripten builds.

* Move mirror URLs to the bottom to avoid 404 warnings.

Plus, on GitHub CI I suspect GitHub URLs should be faster anyway.

* Fix remaining Emscripten builds.

This requires some new changes from rules_foreign_cc to support Make
variable substitution in several other places.

* Update rules_foreign_cc.

Pin to the current main branch while we get a release that includes
bazelbuild/rules_foreign_cc#861.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Recent commit breaks existing mechanism for extracting source directory.
5 participants