bazel-central-registry icon indicating copy to clipboard operation
bazel-central-registry copied to clipboard

[Bug]: //tools:add_module fails with netrc error

Open pjh opened this issue 10 months ago • 0 comments

What happened?

I'm trying to follow https://github.com/bazelbuild/bazel-central-registry/blob/main/docs/README.md#contribute-a-bazel-module and after responding to the prompts in the interactive tool it failed with a netrc error:

ACTION: Do you want to add a maintainer for this module? (See https://github.com/bazelbuild/bazel-central-registry/
tree/main/docs/bcr-policies.md#become-a-module-maintainer) [y/N]:
Traceback (most recent call last):
  File "/.../.cache/bazel/_bazel_pjh/d91885ff414763d1dae4adcb8b48248b/execroot/_main/bazel-out/k8-fastbuild/bin/tools/add_module.runfiles/_main/tools/add_module.py", line 220, in <module>
    sys.exit(main())
             ^^^^^^
  File "/.../.cache/bazel/_bazel_pjh/d91885ff414763d1dae4adcb8b48248b/execroot/_main/bazel-out/k8-fastbuild/bin/tools/add_module.runfiles/_main/tools/add_module.py", line 209, in main
    client.add(module, override=True)
  File "/.../.cache/bazel/_bazel_pjh/d91885ff414763d1dae4adcb8b48248b/execroot/_main/bazel-out/k8-fastbuild/bin/tools/add_module.runfiles/_main/tools/registry.py", line 353, in add
    "integrity": integrity(download(module.url)),
                           ^^^^^^^^^^^^^^^^^^^^
  File "/.../.cache/bazel/_bazel_pjh/d91885ff414763d1dae4adcb8b48248b/execroot/_main/bazel-out/k8-fastbuild/bin/tools/add_module.runfiles/_main/tools/registry.py", line 47, in download
    authenticators = netrc.netrc().authenticators(parts.netloc)
                     ^^^^^^^^^^^^^
  File "/.../.cache/bazel/_bazel_pjh/d91885ff414763d1dae4adcb8b48248b/external/rules_python~0.27.1~python~python_3_11_x86_64-unknown-linux-gnu/lib/python3.11/netrc.py", line 75, in __init__   
    self._parse(file, fp, default_netrc)
  File "/.../.cache/bazel/_bazel_pjh/d91885ff414763d1dae4adcb8b48248b/external/rules_python~0.27.1~python~python_3_11_x86_64-unknown-linux-gnu/lib/python3.11/netrc.py", line 142, in _parse
    self._security_check(fp, default_netrc, self.hosts[entryname][0])
  File "/.../.cache/bazel/_bazel_pjh/d91885ff414763d1dae4adcb8b48248b/external/rules_python~0.27.1~python~python_3_11_x86_64-unknown-linux-gnu/lib/python3.11/netrc.py", line 161, in _security_check
    raise NetrcParseError(
netrc.NetrcParseError: ~/.netrc access too permissive: access permissions must restrict access to only the owner (None, line None)

git status shows that some changes have been made, but I don't know what was supposed to happen next.

$ git status
On branch pjh/add-nsync
Untracked files:
  (use "git add <file>..." to include in what will be committed)
        modules/nsync/
        nsync.20240422-160114.json

Version

Development (host) and target OS/architectures: Linux Debian 6.6.15-based x86_64 GNU/Linux

Output of bazel --version: bazel 7.0.2

Version of relevant rules from the WORKSPACE or MODULE.bazel file: I cloned this repository from https://github.com/bazelbuild/bazel-central-registry/commit/4f09b049110f840cc46bf3f1ad7fbe5e461b30ef

How to reproduce

$ bazel run //tools:add_module
Starting local Bazel server and connecting to it...
INFO: Analyzed target //tools:add_module (86 packages loaded, 3095 targets configured).
INFO: Found 1 target...
Target //tools:add_module up-to-date:
  bazel-bin/tools/add_module
INFO: Elapsed time: 19.415s, Critical Path: 0.57s
INFO: 5 processes: 5 internal.
INFO: Build completed successfully, 5 total actions
INFO: Running command line: bazel-bin/tools/add_module
INFO: Getting module information from user input...
ACTION: Please enter the module name: nsync
ACTION: Please enter the module version: 1.27.0
ACTION: Please enter the compatibility level [default is 0]:
ACTION: Please enter the URL of the source archive: https://github.com/google/nsync/archive/refs/tags/1.27.0.tar.gz
ACTION: Please enter the strip_prefix value of the archive [default None]: nsync-1.27.0
ACTION: Do you want to add patch files? [y/N]:
ACTION: Do you want to add a BUILD file? [y/N]:
ACTION: Do you want to specify a MODULE.bazel file? [y/N]:
ACTION: Do you want to specify dependencies for this module? [y/N]:
ACTION: Do you want to specify an existing presubmit.yml file? (See https://github.com/bazelbuild/bazel-central-registry/tree/main/docs#presubmit) [y/N]:
ACTION: Please enter a list of build targets you want to expose to downstream users, separated by `,`: //:android_arm,//:android_arm64,//:android_armeabi,//:android_x86_32,//:android_x86_64,//:clang_macos_x86_64,//:counter_cpp_test,//:counter_test,//:cv_cpp_test,//:cv_mu_timeout_stress_cpp_test,//:cv_mu_timeout_stress_test,//:cv_test,//:cv_wait_example_cpp_test,//:cv_wait_example_test,//:dll_cpp_test,//:dll_test,//:freebsd,//:gcc_linux_aarch64,//:gcc_linux_ppc64,//:gcc_linux_s390x,//:gcc_linux_x86_32_1,//:gcc_linux_x86_64_1,//:gcc_linux_x86_64_2,//:ios_x86_64,//:msvc_windows_x86_64,//:mu_cpp_test,//:mu_starvation_cpp_test,//:mu_starvation_test,//:mu_test,//:mu_wait_cpp_test,//:mu_wait_example_cpp_test,//:mu_wait_example_test,//:mu_wait_test,//:note_cpp_test,//:note_test,//:nsync,//:nsync_cpp,//:nsync_headers,//:nsync_test_lib,//:nsync_test_lib_cpp,//:once_cpp_test,//:once_test,//:pingpong_cpp_test,//:pingpong_test,//:wait_cpp_test,//:wait_test
ACTION: Do you have a test module in your source archive? [Y/n]: n
INFO: Saving module information to nsync.20240422-160114.json
INFO: You can use it via --input=nsync.20240422-160114.json
INFO: nsync is a new Bazel module...
ACTION: Please enter the homepage url for this module: https://github.com/google/nsync
ACTION: Do you want to add a maintainer for this module? (See https://github.com/bazelbuild/bazel-central-registry/tree/main/docs/bcr-policies.md#become-a-module-maintainer) [y/N]:
Traceback (most recent call last):
  File "/.../.cache/bazel/_bazel_pjh/d91885ff414763d1dae4adcb8b48248b/execroot/_main/bazel-out/k8-fastbuild/bin/tools/add_module.runfiles/_main/tools/add_module.py", line 220, in <module>
    sys.exit(main())
             ^^^^^^
  File "/.../.cache/bazel/_bazel_pjh/d91885ff414763d1dae4adcb8b48248b/execroot/_main/bazel-out/k8-fastbuild/bin/tools/add_module.runfiles/_main/tools/add_module.py", line 209, in main
    client.add(module, override=True)
  File "/.../.cache/bazel/_bazel_pjh/d91885ff414763d1dae4adcb8b48248b/execroot/_main/bazel-out/k8-fastbuild/bin/tools/add_module.runfiles/_main/tools/registry.py", line 353, in add
    "integrity": integrity(download(module.url)),
                           ^^^^^^^^^^^^^^^^^^^^
  File "/.../.cache/bazel/_bazel_pjh/d91885ff414763d1dae4adcb8b48248b/execroot/_main/bazel-out/k8-fastbuild/bin/tools/add_module.runfiles/_main/tools/registry.py", line 47, in download
    authenticators = netrc.netrc().authenticators(parts.netloc)
                     ^^^^^^^^^^^^^
  File "/.../.cache/bazel/_bazel_pjh/d91885ff414763d1dae4adcb8b48248b/external/rules_python~0.27.1~python~python_3_11_x86_64-unknown-linux-gnu/lib/python3.11/netrc.py", line 75, in __init__
    self._parse(file, fp, default_netrc)
  File "/.../.cache/bazel/_bazel_pjh/d91885ff414763d1dae4adcb8b48248b/external/rules_python~0.27.1~python~python_3_11_x86_64-unknown-linux-gnu/lib/python3.11/netrc.py", line 142, in _parse
    self._security_check(fp, default_netrc, self.hosts[entryname][0])
  File "/.../.cache/bazel/_bazel_pjh/d91885ff414763d1dae4adcb8b48248b/external/rules_python~0.27.1~python~python_3_11_x86_64-unknown-linux-gnu/lib/python3.11/netrc.py", line 161, in _security_check
    raise NetrcParseError(
netrc.NetrcParseError: ~/.netrc access too permissive: access permissions must restrict access to only the owner (None, line None)

Any other information?

No response

pjh avatar Apr 22 '24 23:04 pjh