libc backend: `fs`: `FsWord` does not match `StatFs::f_type` on s390x-musl
Maintainer thường phản hồi trong vòng 4 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 66/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- docker, linux, rust
- Lĩnh vực
- operating-systems
Hướng nghiên cứu
Start with src/backend/libc/fs/types.rs and src/fs/fd.rs, comparing the referenced libc and linux_raw definitions for FsWord, StatFs::f_type, and filesystem constants. Run the provided Docker reproducer with the s390x-alpine-linux-musl target first. Done means the s390x-musl cargo check and the shown type comparison compile successfully without breaking the other backends.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
rustix::fs::FsWord in the libc backend mode does not match rustix::fs::StatFs::f_type on s390x-musl, while it matches on other toolchains such as s390x-gnu.
error[E0308]: mismatched types
--> src/main.rs:3:27
|
| assert_eq!(st.f_type, rustix::fs::PROC_SUPER_MAGIC);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `u64`
Affects:
Relevant code
libc backend
https://github.com/bytecodealliance/rustix/blob/287214b889865d8e1406a0ee71cc409b6f6191c8/src/backend/libc/fs/types.rs#L1138-L1170
https://github.com/bytecodealliance/rustix/blob/287214b889865d8e1406a0ee71cc409b6f6191c8/src/backend/libc/fs/types.rs#L1081-L1086
linux_raw backend
https://github.com/bytecodealliance/rustix/blob/287214b889865d8e1406a0ee71cc409b6f6191c8/src/backend/linux_raw/fs/types.rs#L837-L851
https://github.com/bytecodealliance/rustix/blob/287214b889865d8e1406a0ee71cc409b6f6191c8/src/backend/linux_raw/fs/types.rs#L763-L801
Reproducer
Dockerfile
# Usage: docker build --platform amd64,arm64,ppc64le,s390x,riscv64,linux/arm/v6,linux/arm/v7 .
#
# On s390x, rustix uses the libc backend by default, which fails to compile.
# Forcing the linux_raw backend compiles fine:
# docker build --platform s390x \
# --build-arg RUSTFLAGS="--cfg rustix_use_experimental_asm" \
# --build-arg RUSTC_BOOTSTRAP=1 .
ARG ALPINE_VERSION=3.24.2
ARG RUSTIX_VERSION=1.1.5
FROM --platform=$BUILDPLATFORM alpine:${ALPINE_VERSION}
RUN apk add --no-cache cargo rust
WORKDIR /repro
ARG RUSTIX_VERSION
RUN cargo init -q --name repro && cargo add -q rustix@=${RUSTIX_VERSION} --features fs
COPY <<RS src/main.rs
fn main() {
let st = rustix::fs::statfs("/proc").unwrap();
assert_eq!(st.f_type, rustix::fs::PROC_SUPER_MAGIC);
}
RS
ARG TARGETARCH
ARG TARGETVARIANT
ARG RUSTFLAGS=
ARG RUSTC_BOOTSTRAP=
RUN set -ex; \
case "$TARGETARCH/$TARGETVARIANT" in \
amd64/*) apk_arch=x86_64; triple=x86_64-alpine-linux-musl ;; \
arm64/*) apk_arch=aarch64; triple=aarch64-alpine-linux-musl ;; \
arm/v6) apk_arch=armhf; triple=armv6-alpine-linux-musleabihf ;; \
arm/v7|arm/) apk_arch=armv7; triple=armv7-alpine-linux-musleabihf ;; \
ppc64le/*) apk_arch=ppc64le; triple=powerpc64le-alpine-linux-musl ;; \
s390x/*) apk_arch=s390x; triple=s390x-alpine-linux-musl ;; \
riscv64/*) apk_arch=riscv64; triple=riscv64-alpine-linux-musl ;; \
*) echo "unsupported platform $TARGETARCH/$TARGETVARIANT" >&2; exit 1 ;; \
esac; \
rustc --print target-list | grep -qx "$triple" \
|| { echo "rustc has no target spec for $triple" >&2; exit 1; }; \
mkdir -p /sysroot/etc/apk/keys; \
cp /etc/apk/repositories /sysroot/etc/apk/; \
echo "$apk_arch" >/sysroot/etc/apk/arch; \
apk add --no-cache --initdb --root /sysroot --allow-untrusted alpine-keys; \
apk add --no-cache --root /sysroot rust; \
ln -s "/sysroot/usr/lib/rustlib/$triple" \
"$(rustc --print sysroot)/lib/rustlib/$triple"; \
rc=0; cargo check --target "$triple" || rc=$?; \
grep -h 'rustc-cfg=\(libc\|linux_raw\)$' target/$triple/debug/build/rustix-*/output; \
exit $rc
$ docker build --platform s390x .
[...]
8.770 Downloading crates ...
8.846 Downloaded errno v0.3.14
8.858 Downloaded bitflags v2.13.2
8.919 Downloaded rustix v1.1.5
8.943 Downloaded libc v0.2.190
8.988 Downloaded linux-raw-sys v0.12.1
9.030 Compiling libc v0.2.190
9.030 Compiling rustix v1.1.5
9.030 Checking bitflags v2.13.2
9.030 Checking linux-raw-sys v0.12.1
9.583 Checking errno v0.3.14
10.19 Checking repro v0.1.0 (/repro)
10.21 error[E0308]: mismatched types
10.21 --> src/main.rs:3:27
10.21 |
10.21 3 | assert_eq!(st.f_type, rustix::fs::PROC_SUPER_MAGIC);
10.21 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `u64`
10.21 |
10.21 help: you can convert `st.f_type` from `u32` to `u64`, matching the type of `rustix::fs::PROC_SUPER_MAGIC`
10.21 |
10.21 3 | assert_eq!(u64::from(st.f_type), rustix::fs::PROC_SUPER_MAGIC);
10.21 | ++++++++++ +
10.21
10.21 For more information about this error, try `rustc --explain E0308`.
10.21 error: could not compile `repro` (bin "repro") due to 1 previous error
[...]
- Ngôn ngữ chính
- Rust
- Star
- 2.1k
- Fork
- 301
- Merge trung bình
- 10 ngày 1 giờ
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của bytecodealliance/rustix
-
net feature alone fails to compile in 1.1.5: sockopt uses crate::timespec, which net does not gate inCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
bytecodealliance/rustix#1689 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Wrong flag used for (set_)ipv6_multicast_hopsCó thể đã có người làm @RajaBabu15 đã nhận 53 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
bytecodealliance/rustix#1660 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Add sched_getscheduler wrapperĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
bytecodealliance/rustix#1635 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
bytecodealliance/rustix#1068 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
bytecodealliance/rustix#1696 ·
Maintainer thường phản hồi trong vòng 4 ngày
Tất cả issue của bytecodealliance/rustix
Issue tương tự
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
zcashlabs/thus-spoke-zakura#153 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
app bug windows-os
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Improve sublime text syntaxĐang mởeditor good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
funnyboy-roks/inq#54 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
pnpm/pnpm#16635 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: Bedrock request metadata forwarding does not work for /embeddingsCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởbug llm translation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày