Skip to content

Commit

Permalink
more debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
sunfishcode committed Jan 24, 2025
1 parent 4e9842c commit 3e1fe87
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 87 deletions.
86 changes: 1 addition & 85 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,38 +126,6 @@ jobs:
- run: cargo check --workspace --release -vv --target=aarch64-apple-ios --features=all-apis --all-targets
- run: cargo check --workspace --release -vv --target=aarch64-linux-android --features=all-apis --all-targets

check_no_default_features:
name: Check --no-default-features
runs-on: ${{ matrix.os }}
strategy:
matrix:
build: [nightly]
include:
- build: nightly
os: ubuntu-latest
rust: nightly

env:
# -D warnings is commented out in our install-rust action; re-add it here.
RUSTFLAGS: -D warnings -D elided-lifetimes-in-paths
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/install-rust
with:
toolchain: ${{ matrix.rust }}
- run: cargo check --workspace --release --no-default-features -vv
- run: cargo check --workspace --release --no-default-features --features use-libc -vv
- run: cargo check --workspace --release --no-default-features --features all-apis -vv
- run: cargo check --workspace --release --no-default-features --features all-apis,use-libc -vv
- run: cargo check --workspace --release --no-default-features --features all-apis,alloc -vv
- run: cargo check --workspace --release --no-default-features --features all-apis,use-libc,alloc -vv
- run: cargo check --workspace --release --no-default-features --features time -vv
- run: cargo check --workspace --release --no-default-features --features time,use-libc -vv
- run: rustup component add rust-src
- run: cargo check --workspace --release --no-default-features --target=i686-unknown-linux-gnu -Zbuild-std -vv

check_nightly:
name: Check nightly-only targets
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -185,52 +153,6 @@ jobs:
- run: cargo check --workspace --release -vv --target=wasm32-wasip1 --features=all-apis
- run: cargo check --workspace --release -vv --target=thumbv7neon-unknown-linux-gnueabihf --features=all-apis

check_tier3:
name: Check selected Tier 3 platforms
runs-on: ${{ matrix.os }}
strategy:
matrix:
build: [nightly]
include:
- build: nightly
os: ubuntu-latest
rust: nightly

steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/install-rust
with:
toolchain: ${{ matrix.rust }}
env:
# See the comments in the libc crate
RUSTFLAGS: -A improper_ctypes_definitions --cfg criterion
- run: rustup component add rust-src
- run: cargo check -Z build-std --target x86_64-unknown-openbsd --all-targets --features=all-apis
- run: cargo check -Z build-std --target mips64-openwrt-linux-musl --all-targets --features=all-apis
- run: cargo check -Z build-std --target x86_64-unknown-dragonfly --all-targets --features=all-apis
- run: cargo check -Z build-std --target sparc-unknown-linux-gnu --all-targets --features=all-apis
- run: cargo check -Z build-std --target armv7-unknown-freebsd --all-targets --features=all-apis
- run: cargo check -Z build-std --target aarch64-unknown-linux-gnu_ilp32 --all-targets --features=all-apis
# Omit --all-targets on haiku because not all the tests build yet.
- run: cargo check -Z build-std --target x86_64-unknown-haiku --features=all-apis
- run: cargo check -Z build-std --target x86_64-uwp-windows-msvc --all-targets --features=all-apis
# Temporarily disable riscv32imc-esp-espidf due to std using SOMAXCONN.
#- run: cargo check -Z build-std --target=riscv32imc-esp-espidf --features=all-apis
- run: cargo check -Z build-std --target=aarch64-unknown-nto-qnx710 --features=all-apis
- run: cargo check -Z build-std --target=x86_64-pc-nto-qnx710 --features=all-apis
# Temporarily disable --features=all-apis, which doesn't build yet.
- run: cargo check -Z build-std --target=armv6k-nintendo-3ds
# Temporarily disable armv7-sony-vita-newlibeabihf due to std using SOMAXCONN.
#- run: cargo check -Z build-std --target=armv7-sony-vita-newlibeabihf --features=all-apis
# `std` doesn't appear to build on AIX yet, so test in `no_std` mode.
- run: cargo check -Zbuild-std=core,alloc --target=powerpc64-ibm-aix --features=all-apis --no-default-features
- run: cargo check -Z build-std --target=mipsel-unknown-linux-gnu --features=all-apis
- run: cargo check -Z build-std --target=mips64el-unknown-linux-gnuabi64 --features=all-apis
- run: cargo check -Z build-std --target=powerpc64le-unknown-linux-musl --features=all-apis


test:
name: Test
runs-on: ${{ matrix.os }}
Expand All @@ -240,7 +162,7 @@ jobs:
RUSTFLAGS: --cfg rustix_use_experimental_features
strategy:
matrix:
build: [ubuntu, ubuntu-20.04, i686-linux, aarch64-linux, powerpc64le-linux, riscv64-linux, s390x-linux, arm-linux, ubuntu-stable, i686-linux-stable, aarch64-linux-stable, riscv64-linux-stable, s390x-linux-stable, powerpc64le-linux-stable, arm-linux-stable, ubuntu-1.63, i686-linux-1.63, aarch64-linux-1.63, riscv64-linux-1.63, s390x-linux-1.63, powerpc64le-linux-1.63, arm-linux-1.63, macos-latest, macos-13, windows, windows-2019, musl]
build: [ubuntu, ubuntu-20.04, i686-linux, aarch64-linux, powerpc64le-linux, riscv64-linux, s390x-linux, arm-linux, ubuntu-stable, i686-linux-stable, aarch64-linux-stable, riscv64-linux-stable, s390x-linux-stable, powerpc64le-linux-stable, arm-linux-stable, ubuntu-1.63, i686-linux-1.63, aarch64-linux-1.63, riscv64-linux-1.63, s390x-linux-1.63, powerpc64le-linux-1.63, arm-linux-1.63, macos-latest, macos-13, musl]
include:
- build: ubuntu
os: ubuntu-latest
Expand Down Expand Up @@ -416,12 +338,6 @@ jobs:
- build: macos-13
os: macos-13
rust: stable
- build: windows
os: windows-latest
rust: nightly
- build: windows-2019
os: windows-2019
rust: nightly
- build: musl
os: ubuntu-latest
rust: stable
Expand Down
5 changes: 5 additions & 0 deletions src/backend/libc/net/read_sockaddr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ pub(crate) unsafe fn maybe_read_sockaddr_os(

assert!(len >= size_of::<c::sa_family_t>());
let family = read_ss_family(storage).into();
dbg!(&family);
if family == c::AF_UNSPEC {
None
} else {
Expand All @@ -250,6 +251,7 @@ pub(crate) unsafe fn read_sockaddr_os(
) -> SocketAddrAny {
assert!(len >= size_of::<c::sa_family_t>());
let family = read_ss_family(storage).into();
dbg!(&family);
inner_read_sockaddr_os(family, storage, len)
}

Expand Down Expand Up @@ -283,6 +285,8 @@ unsafe fn inner_read_sockaddr_os(
}
#[cfg(unix)]
c::AF_UNIX => {
dbg!("line");
dbg!(len, offsetof_sun_path);
assert!(len >= offsetof_sun_path);
if len == offsetof_sun_path {
SocketAddrAny::Unix(SocketAddrUnix::new(&[][..]).unwrap())
Expand All @@ -309,6 +313,7 @@ unsafe fn inner_read_sockaddr_os(
assert_eq!(decode.sun_path[len - 1 - offsetof_sun_path], 0);
let path_bytes = &decode.sun_path[..len - 1 - offsetof_sun_path];

dbg!(&path_bytes);
// FreeBSD and illumos sometimes set the length to longer than
// the length of the NUL-terminated string. Find the NUL and
// truncate the string accordingly.
Expand Down
5 changes: 3 additions & 2 deletions tests/net/recv_trunc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ use std::mem::MaybeUninit;

/// Test `recv_uninit` with the `RecvFlags::Trunc` flag.
#[test]
#[ignore]
fn net_recv_uninit_trunc() {
crate::init();

let tmpdir = tempfile::tempdir().unwrap();
let path = tmpdir.path().join("recv_uninit_trunc");
dbg!(&path);
let name = SocketAddrUnix::new(&path).unwrap();
dbg!(&name);

let receiver = rustix::net::socket(AddressFamily::UNIX, SocketType::DGRAM, None).unwrap();
rustix::net::bind_unix(&receiver, &name).expect("bind");
Expand Down Expand Up @@ -51,7 +50,9 @@ fn net_recvmsg_trunc() {

let tmpdir = tempfile::tempdir().unwrap();
let path = tmpdir.path().join("recvmsg_trunc");
dbg!(&path);
let name = SocketAddrUnix::new(&path).unwrap();
dbg!(&name);

let receiver = rustix::net::socket(AddressFamily::UNIX, SocketType::DGRAM, None).unwrap();
rustix::net::bind_unix(&receiver, &name).expect("bind");
Expand Down

0 comments on commit 3e1fe87

Please sign in to comment.