-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Convert proto output from internal string encoding to Unicode #24935
Conversation
@bazel-io fork 8.1.0 |
Fabian: Can you help me understand the subtle change of this PR. It looks to me like:
So essentially equivalent to "copy the bytes without interpreting them", which is what Bazel does elsewhere like in ctx.actions.write() If that's what you intend, then LGTM. |
That's exactly correct! The |
@@ -347,7 +348,7 @@ private AttributeBuilderAdapter( | |||
|
|||
@Override | |||
public void addStringListValue(String s) { | |||
attributeBuilder.addStringListValue(s); | |||
attributeBuilder.addStringListValue(internalToUnicode(s)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this conversion is incorrect, since all callsites already perform the conversion to Unicode (also for the other three below)?
If you agree, I will remove it, and also add some integration tests in bazel_query_test.sh when I import.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you are right, but I would personally drop the internalToUnicode
calls from the callsites rather than this function as addStringListValue
etc. are the actual sinks for valid Unicode. I don't have a strong opinion though, feel free to do what you think is easier to understand
Thanks for taking care of the tests!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I generally agree with the principle of putting the conversion as close to the sink as possible, in this case it would cause writeAttributeValueToBuilder
to end up with mixed application/non-application of internalToUnicode
, as not every proto field is set through the AttributeValueBuilderAdapter
interface. That seems less readable to me, because it's harder to convince oneself that all fields have been covered. (It might be possible to do better with additional indirection, but I'd rather not do that now.)
bazelbuild/bazel#24935 changes the observable behavior of starlark_doc_extract, and consumers need to adapt. Work towards bazelbuild/bazel#374 Work towards phst/rules_elisp#818
Work towards bazelbuild#374 Closes bazelbuild#24935. PiperOrigin-RevId: 718549143 Change-Id: Ibe6c685a2f8dd75430cae7f770d392de35bdeb68
bazelbuild/bazel#24935 changes the observable behavior of starlark_doc_extract, and consumers need to adapt. Work towards bazelbuild/bazel#374 Work towards phst/rules_elisp#818
bazelbuild/bazel#24935 changes the observable behavior of starlark_doc_extract, and consumers need to adapt. Work towards bazelbuild/bazel#374 Work towards phst/rules_elisp#818
Work towards bazelbuild#374 Closes bazelbuild#24935. PiperOrigin-RevId: 718549143 Change-Id: Ibe6c685a2f8dd75430cae7f770d392de35bdeb68
Work towards #374