rust icon indicating copy to clipboard operation
rust copied to clipboard

std::rand: fix dragonflybsd after #121942.

Open devnexen opened this issue 5 months ago • 4 comments

devnexen avatar Mar 12 '24 00:03 devnexen

r? @jhpratt

rustbot has assigned @jhpratt. They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

rustbot avatar Mar 12 '24 00:03 rustbot

The job mingw-check-tidy failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
Getting action download info
Download action repository 'msys2/[email protected]' (SHA:cc11e9188b693c2b100158c3322424c4cc1dadea)
Download action repository 'actions/checkout@v4' (SHA:b4ffde65f46336ab88eb53be808477a3936bae11)
Download action repository 'actions/upload-artifact@v3' (SHA:a8a3f3ad30e3422c9c7b888a15615d19a852ae32)
Complete job name: PR - mingw-check-tidy
git config --global core.autocrlf false
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
---
GITHUB_ACTION=__run_7
GITHUB_ACTIONS=true
GITHUB_ACTION_REF=
GITHUB_ACTION_REPOSITORY=
GITHUB_ACTOR=devnexen
GITHUB_API_URL=https://api.github.com
GITHUB_BASE_REF=master
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_d45d982d-2b43-4294-a57a-904ff1697076
GITHUB_EVENT_NAME=pull_request
GITHUB_EVENT_NAME=pull_request
GITHUB_EVENT_PATH=/home/runner/work/_temp/_github_workflow/event.json
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
GITHUB_HEAD_REF=dfbsd_build_fix
GITHUB_JOB=pr
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_d45d982d-2b43-4294-a57a-904ff1697076
GITHUB_REF=refs/pull/122356/merge
GITHUB_REF_NAME=122356/merge
GITHUB_REF_PROTECTED=false
---
GITHUB_SERVER_URL=https://github.com
GITHUB_SHA=e78efb8f52f086592f2d170338b8313271bb5949
GITHUB_STATE=/home/runner/work/_temp/_runner_file_commands/save_state_d45d982d-2b43-4294-a57a-904ff1697076
GITHUB_STEP_SUMMARY=/home/runner/work/_temp/_runner_file_commands/step_summary_d45d982d-2b43-4294-a57a-904ff1697076
GITHUB_TRIGGERING_ACTOR=devnexen
GITHUB_WORKFLOW_REF=rust-lang/rust/.github/workflows/ci.yml@refs/pull/122356/merge
GITHUB_WORKFLOW_SHA=e78efb8f52f086592f2d170338b8313271bb5949
GITHUB_WORKSPACE=/home/runner/work/rust/rust
GOROOT_1_20_X64=/opt/hostedtoolcache/go/1.20.14/x64
---
COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh

COPY host-x86_64/mingw-check/reuse-requirements.txt /tmp/
RUN pip3 install --no-deps --no-cache-dir --require-hashes -r /tmp/reuse-requirements.txt \
    && pip3 install virtualenv
COPY host-x86_64/mingw-check/validate-toolstate.sh /scripts/
COPY host-x86_64/mingw-check/validate-error-codes.sh /scripts/

# NOTE: intentionally uses python2 for x.py so we can test it still works.
# NOTE: intentionally uses python2 for x.py so we can test it still works.
# validate-toolstate only runs in our CI, so it's ok for it to only support python3.
ENV SCRIPT TIDY_PRINT_DIFF=1 python2.7 ../x.py test \
           --stage 0 src/tools/tidy tidyselftest --extra-checks=py:lint
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
#    pip-compile --allow-unsafe --generate-hashes reuse-requirements.in
---

#10 [5/8] COPY host-x86_64/mingw-check/reuse-requirements.txt /tmp/
#10 DONE 0.0s

#11 [6/8] RUN pip3 install --no-deps --no-cache-dir --require-hashes -r /tmp/reuse-requirements.txt     && pip3 install virtualenv
#11 0.593   Downloading binaryornot-0.4.4-py2.py3-none-any.whl (9.0 kB)
#11 0.612 Collecting boolean-py==4.0
#11 0.664   Downloading boolean.py-4.0-py3-none-any.whl (25 kB)
#11 0.684 Collecting chardet==5.1.0
---
#11 3.887 Building wheels for collected packages: reuse
#11 3.888   Building wheel for reuse (pyproject.toml): started
#11 4.216   Building wheel for reuse (pyproject.toml): finished with status 'done'
#11 4.217   Created wheel for reuse: filename=reuse-1.1.0-cp310-cp310-manylinux_2_35_x86_64.whl size=181117 sha256=f5f58750481f69515c2c0d1d503daf565e2565c370d07fc6aeb95fe3498b4269
#11 4.217   Stored in directory: /tmp/pip-ephem-wheel-cache-ub4gabw9/wheels/c2/3c/b9/1120c2ab4bd82694f7e6f0537dc5b9a085c13e2c69a8d0c76d
#11 4.220 Installing collected packages: boolean-py, binaryornot, setuptools, reuse, python-debian, markupsafe, license-expression, jinja2, chardet
#11 4.241   Attempting uninstall: setuptools
#11 4.241     Found existing installation: setuptools 59.6.0
#11 4.242     Not uninstalling setuptools at /usr/lib/python3/dist-packages, outside environment /usr
---
#11 5.504   Downloading virtualenv-20.25.1-py3-none-any.whl (3.8 MB)
#11 5.738      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.8/3.8 MB 16.3 MB/s eta 0:00:00
#11 5.794 Collecting filelock<4,>=3.12.2
#11 5.804   Downloading filelock-3.13.1-py3-none-any.whl (11 kB)
#11 5.837 Collecting platformdirs<5,>=3.9.1
#11 5.847   Downloading platformdirs-4.2.0-py3-none-any.whl (17 kB)
#11 5.870 Collecting distlib<1,>=0.3.7
#11 5.880   Downloading distlib-0.3.8-py2.py3-none-any.whl (468 kB)
#11 5.896      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 468.9/468.9 KB 33.7 MB/s eta 0:00:00
#11 5.980 Installing collected packages: distlib, platformdirs, filelock, virtualenv
#11 6.141 Successfully installed distlib-0.3.8 filelock-3.13.1 platformdirs-4.2.0 virtualenv-20.25.1
#11 DONE 6.2s

#12 [7/8] COPY host-x86_64/mingw-check/validate-toolstate.sh /scripts/
#12 DONE 0.0s
---
DirectMap4k:      180160 kB
DirectMap2M:     8208384 kB
DirectMap1G:    10485760 kB
##[endgroup]
Executing TIDY_PRINT_DIFF=1 python2.7 ../x.py test            --stage 0 src/tools/tidy tidyselftest --extra-checks=py:lint
+ TIDY_PRINT_DIFF=1 python2.7 ../x.py test --stage 0 src/tools/tidy tidyselftest --extra-checks=py:lint
    Finished dev [unoptimized] target(s) in 0.03s
##[endgroup]
downloading https://ci-artifacts.rust-lang.org/rustc-builds-alt/4a0cc881dcc4d800f10672747f61a94377ff6662/rust-dev-nightly-x86_64-unknown-linux-gnu.tar.xz
extracting /checkout/obj/build/cache/llvm-4a0cc881dcc4d800f10672747f61a94377ff6662-true/rust-dev-nightly-x86_64-unknown-linux-gnu.tar.xz to /checkout/obj/build/x86_64-unknown-linux-gnu/ci-llvm
---
   Compiling tidy v0.1.0 (/checkout/src/tools/tidy)
    Finished release [optimized] target(s) in 27.14s
##[endgroup]
fmt check
##[error]Diff in /checkout/library/std/src/sys/pal/unix/rand.rs at line 62:
         unsafe { getrandom(buf.as_mut_ptr().cast(), buf.len(), libc::GRND_NONBLOCK) }
 
-    #[cfg(any(
-        target_os = "espidf",
-        target_os = "horizon",
-        target_os = "horizon",
-        target_os = "freebsd",
-        netbsd10
-    ))]
+    #[cfg(any(target_os = "espidf", target_os = "horizon", target_os = "freebsd", netbsd10))]
     fn getrandom(buf: &mut [u8]) -> libc::ssize_t {
         unsafe { libc::getrandom(buf.as_mut_ptr().cast(), buf.len(), 0) }
     }
Running `"/checkout/obj/build/x86_64-unknown-linux-gnu/rustfmt/bin/rustfmt" "--config-path" "/checkout" "--edition" "2021" "--unstable-features" "--skip-children" "--check" "/checkout/library/std/src/sys/pal/unix/thread_local_key.rs" "/checkout/library/std/src/sys/pal/unix/kernel_copy.rs" "/checkout/library/std/src/sys/pal/unix/stack_overflow.rs" "/checkout/library/std/src/sys/pal/unix/os.rs" "/checkout/library/std/src/sys/pal/unix/rand.rs" "/checkout/library/std/src/sys/pal/unix/weak.rs" "/checkout/library/std/src/sys/pal/unix/net.rs" "/checkout/library/std/src/sys/pal/unix/pipe.rs" "/checkout/library/std/src/sys/pal/unix/io.rs" "/checkout/compiler/rustc_target/src/spec/targets/aarch64_unknown_openbsd.rs" "/checkout/compiler/rustc_target/src/spec/targets/x86_64h_apple_darwin.rs" "/checkout/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs" "/checkout/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu.rs" "/checkout/compiler/rustc_target/src/spec/targets/x86_64_unknown_dragonfly.rs" "/checkout/compiler/rustc_target/src/spec/targets/i686_unknown_uefi.rs" "/checkout/compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks_spe.rs" "/checkout/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_gnuspe.rs" "/checkout/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs" "/checkout/compiler/rustc_target/src/spec/targets/armv7s_apple_ios.rs" "/checkout/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_netbsd.rs" "/checkout/compiler/rustc_target/src/spec/targets/i686_pc_windows_gnu.rs" "/checkout/compiler/rustc_target/src/spec/targets/x86_64_apple_watchos_sim.rs" "/checkout/compiler/rustc_target/src/spec/targets/x86_64_unknown_fuchsia.rs" "/checkout/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_gnuabi64.rs" "/checkout/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs" "/checkout/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabihf.rs" "/checkout/compiler/rustc_target/src/spec/targets/m68k_unknown_linux_gnu.rs" "/checkout/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_uclibc.rs" "/checkout/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_freebsd.rs" "/checkout/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs" "/checkout/compiler/rustc_target/src/spec/targets/i686_pc_windows_gnullvm.rs" "/checkout/compiler/rustc_target/src/spec/targets/riscv32im_risc0_zkvm_elf.rs" "/checkout/compiler/rustc_target/src/spec/targets/hexagon_unknown_linux_musl.rs" "/checkout/compiler/rustc_target/src/spec/targets/x86_64_unknown_illumos.rs" "/checkout/compiler/rustc_target/src/spec/targets/arm64e_apple_darwin.rs" "/checkout/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs" "/checkout/compiler/rustc_target/src/spec/targets/i686_apple_darwin.rs" "/checkout/compiler/rustc_target/src/spec/targets/mips64_openwrt_linux_musl.rs" "/checkout/compiler/rustc_target/src/spec/targets/aarch64_wrs_vxworks.rs" "/checkout/compiler/rustc_target/src/spec/targets/wasm32_unknown_emscripten.rs" "/checkout/compiler/rustc_target/src/spec/targets/armv7_unknown_netbsd_eabihf.rs" "/checkout/compiler/rustc_target/src/spec/targets/sparc64_unknown_linux_gnu.rs" "/checkout/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_freebsd.rs" "/checkout/compiler/rustc_target/src/spec/targets/thumbv8m_main_none_eabi.rs" "/checkout/compiler/rustc_target/src/spec/targets/sparc64_unknown_openbsd.rs" "/checkout/compiler/rustc_target/src/spec/targets/thumbv7a_pc_windows_msvc.rs" "/checkout/compiler/rustc_target/src/spec/targets/nvptx64_nvidia_cuda.rs" "/checkout/compiler/rustc_target/src/spec/targets/avr_unknown_gnu_atmega328.rs" "/checkout/compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabi.rs" "/checkout/compiler/rustc_target/src/spec/targets/sparc_unknown_linux_gnu.rs" "/checkout/compiler/rustc_target/src/spec/targets/riscv32imac_esp_espidf.rs" "/checkout/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabi.rs" "/checkout/compiler/rustc_target/src/spec/targets/x86_64_unknown_openbsd.rs" "/checkout/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_gnu.rs" "/checkout/compiler/rustc_target/src/spec/targets/i686_win7_windows_msvc.rs" "/checkout/compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabi.rs" "/checkout/compiler/rustc_target/src/spec/targets/mipsisa64r6el_unknown_linux_gnuabi64.rs" "/checkout/compiler/rustc_target/src/spec/targets/riscv32imafc_esp_espidf.rs" "/checkout/compiler/rustc_target/src/spec/targets/riscv32imac_unknown_none_elf.rs" "/checkout/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs" "/checkout/compiler/rustc_target/src/spec/targets/x86_64_pc_windows_msvc.rs" "/checkout/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos_sim.rs" "/checkout/compiler/rustc_target/src/spec/targets/i586_unknown_linux_gnu.rs" "/checkout/library/std/src/sys/pal/unix/os/tests.rs"` failed.
If you're running `tidy`, try again with `--bless`. Or, if you just want to format code, run `./x.py fmt` instead.
  local time: Tue Mar 12 00:39:13 UTC 2024
  network time: Tue, 12 Mar 2024 00:39:13 GMT
##[error]Process completed with exit code 1.
Post job cleanup.

rust-log-analyzer avatar Mar 12 '24 00:03 rust-log-analyzer

I think the correct approach here would be to add a binding to the libc crate, and use the binding from there.

josephlr avatar Mar 12 '24 00:03 josephlr

I think the correct approach here would be to add a binding to the libc crate, and use the binding from there.

It can take a little while before a new libc release is out then to update here.

devnexen avatar Mar 12 '24 00:03 devnexen

~~PR to add bindings to libc: https://github.com/rust-lang/libc/pull/3619~~

EDIT: Looks like @devnexen already handled this with https://github.com/rust-lang/libc/pull/3618

josephlr avatar Mar 12 '24 01:03 josephlr

I'm going to hold off on approving this pending an outcome of https://github.com/rust-lang/libc/pull/3618. It seems like that is the better approach and wouldn't necessitate any changes in the standard library.

jhpratt avatar Mar 12 '24 02:03 jhpratt

I'm going to hold off on approving this pending an outcome of rust-lang/libc#3618. It seems like that is the better approach and wouldn't necessitate any changes in the standard library.

If that's the case, we should revert #121942, as the dragonflyBSD target currently does not build. Unless (because it's Tier 3), it's fine to have some temporary breakage.

josephlr avatar Mar 12 '24 03:03 josephlr

It's okay to have breakage, but we'd of course rather have working targets. I think it's fine to wait a bit until the libc change is merged unless it's particularly urgent to have it working again.

Noratrieb avatar Mar 12 '24 13:03 Noratrieb

@jhpratt
The libc PR does not show any signs of activity for several weeks. So unless you know that it could be merged in the near future, I think it's worth to merge this PR and revert it only after the libc changes will land.

newpavlov avatar Apr 03 '24 15:04 newpavlov

Agreed. I had assumed that the libc change would land relatively quickly, but that isn't the case for whatever reason. If/when the libc PR lands, whoever makes a PR to revert this should feel free to explicitly request me as reviewer (using r? @jhpratt).

@bors r+ rollup

jhpratt avatar Apr 04 '24 00:04 jhpratt

:pushpin: Commit 6a16638de6449fd30b804e55f3cc2c142e32f55e has been approved by jhpratt

It is now in the queue for this repository.

bors avatar Apr 04 '24 00:04 bors

For some reason, bors still has this in the queue even though it's been merged.

@bors r-

jhpratt avatar Apr 04 '24 04:04 jhpratt