Re: [chromium-dev] Re: Error when "autoninja -C out\a chrome"

5 views
Skip to first unread message

Dirk Pranke

unread,
Feb 24, 2023, 4:26:53 PM2/24/23
to bruce...@google.com, Chromium-dev, 이성권, python

On Thu, Feb 23, 2023 at 6:32 PM 'Bruce Dawson' via Chromium-dev <chromi...@chromium.org> wrote:
I decided that patching every potentially broken open() call in Chromium was going to scale badly so I found a potentially better solution that will change the defaults. See crbug.com/1418846 for details. Testing with my fix CL would still be appreciated.

I'm reluctant to change the default behavior for Python, particularly since most of us are not going to be affected by the change and so we wouldn't see any problems others might get hit by.

But, I'd be interested in hearing thoughts from anyone out there who would be affected. If there was a general consensus that it would help, then I would be okay with the change.


On Thu, Feb 23, 2023 at 3:41 PM Bruce Dawson <bruce...@google.com> wrote:
It looks like you've found a bug in the read_idl_files_list_from_file() function in third_party/blink/renderer/bindings/scripts/utilities.py. This function calls open without specifying an encoding and apparently this causes errors when cp949 (Unified Hangul Code) is selected.

This is why Chromium's Python coding style guide was changed to recommend opening text files in these ways:

That is, use these forms when opening text files in Python:
    • reading: with open(filename, ‘r’, encoding=‘utf-8’) as f:
    • writing: with open(filename, ‘w’, encoding=‘utf-8’, newline='') as f:
The fix should be to change line 305 from this:
-    with open(filename) as input_file:
to this:
+    with open(filename, encoding='utf-8') as input_file:

I found three other places in that file where we open a text file without specifying an encoding. I created crrev.com/c/4289829 to fix them all.

It would be helpful if you could patch in this change (git cl patch -b encoding_test 4289829) and retry the build to see if this helps.

On Thursday, February 23, 2023 at 9:00:11 AM UTC-10 이성권 wrote:
I installed and implemented it according to the official guidelines. 

However, all Windows 10 and 11 environments received the following error:


-----------------------------------

C:\src\chromium\src>autoninja -C out\a chrome
"C:\src\depot_tools\bootstrap-2@3_8_10_chromium_26_bin\python3\bin\python3.exe" C:\src\depot_tools\ninja.py -C out\a chrome -j 26
ninja: Entering directory `out\a'
[0/1] Regenerating ninja files
[1392/64330] ACTION //third_party/blink/renderer/bindings:web_idl_in_core(//build/toolchain/win:win_clang_x86)
FAILED: gen/third_party/blink/renderer/bindings/web_idl_in_core.pickle
C:/src/depot_tools/bootstrap-2@3_8_10_chromium_26_bin/python3/bin/python3.exe ../../third_party/blink/renderer/bindings/scripts/collect_idl_files.py --idl_list_file __third_party_blink_renderer_bindings_web_idl_in_core___build_toolchain_win_win_clang_x86__rule.rsp --component core --output gen/third_party/blink/renderer/bindings/web_idl_in_core.pickle
../../third_party/blink/renderer/core/frame/screen.idl(10) : Internal parsing error
        'cp949' codec can't decode byte 0xe2 in position 2379: illegal multibyte sequence.
Traceback (most recent call last):
  File "../../third_party/blink/renderer/bindings/scripts/collect_idl_files.py", line 68, in <module>
    main()
  File "../../third_party/blink/renderer/bindings/scripts/collect_idl_files.py", line 63, in main
    ast_group.add_ast_node(idl_parser.ParseFile(parser, filepath))
  File "C:\src\chromium\src\third_party\blink\renderer\bindings\scripts\web_idl\ast_group.py", line 32, in add_ast_node
    assert node.GetClass() == 'File', (
AttributeError: 'NoneType' object has no attribute 'GetClass'
[1417/64330] ACTION //components/resources:about_credits(//build/toolchain/win:win_clang_x86)
ninja: build stopped: subcommand failed.


-----------------------------------



(I used vs2022 and sdk10.0.22621.755)
I would appreciate it if someone could tell me the solution.


--
Bruce Dawson, he/him

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/CAE5mQiOQ2cWv_AbKdTfo-4CX%2BQdxGMmZMbn9mxpQOOE405VDUQ%40mail.gmail.com.

Bruce Dawson

unread,
Feb 24, 2023, 4:48:51 PM2/24/23
to Dirk Pranke, Chromium-dev, 이성권, python
I already started a discussion thread about this on the Python group. You can find it here:

https://groups.google.com/a/chromium.org/g/python/c/HUV_X6AaNfk

The TL;DR is that changing the defaults is probably a bad idea.

--
Bruce Dawson, he/him

Reply all
Reply to author
Forward
0 new messages