std: don't reference libc::O_NOFOLLOW on VxWorks in set_perm_nofollow - #162065
std: don't reference libc::O_NOFOLLOW on VxWorks in set_perm_nofollow#162065physwkim wants to merge 1 commit into
libc::O_NOFOLLOW on VxWorks in set_perm_nofollow#162065Conversation
|
r? @ChrisDenton rustbot has assigned @ChrisDenton. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
4e8c17a to
74a9f8c
Compare
There was a problem hiding this comment.
I can't verify on-target that VxWorks honors AT_SYMLINK_NOFOLLOW, so this only restores the build with conservative semantics.
It would be nice to verify this one way or another, even if we don't implement it just yet. cc @biabbas @hax0kartik
|
Tested on VxWorks 7 under QEMU: |
…low` VxWorks' libc defines no `O_NOFOLLOW`, so building std for x86_64-wrs-vxworks stopped compiling once `set_perm_nofollow` was consolidated into `sys/fs/unix.rs` without a vxworks guard. VxWorks also has no way to express a no-follow permission change: its `fchmodat` rejects `AT_SYMLINK_NOFOLLOW` with `ENOTSUP`. Return `Unsupported`, matching the existing Android stub.
|
Good to know, thanks! Could you squish your commits into one please. |
fdc5faa to
cb5e3df
Compare
|
@bors r+ rollup |
set_permissions_nofollowwas consolidated intosys/fs/unix.rs::set_perm_nofollowby #160170, which dropped thenot(target_os = "vxworks")guard the previoussys/fs/mod.rsimplementation carried. VxWorks' libc defines noO_NOFOLLOW(the platform's<sys/fcntlcom.h>stops atO_CLOEXEC, andrust-lang/libccorrectly does not bind it forvxworks), so buildingstdforx86_64-wrs-vxworksnow fails:x86_64-wrs-vxworksis tier 3 and isn't built in CI, so this wasn't caught.set_perm_nofollowis the onlyO_NOFOLLOWreference compiled for VxWorks — theremove_dir_all"modern" path already listsvxworksin its fallback set, and the remaining occurrences are a doc example and comments.Unlike ESP-IDF and Horizon (which skip
O_NOFOLLOWbecause their filesystems have no symbolic links), VxWorks does have symlinks, so it can't just dropO_NOFOLLOWand follow the link silently. This returnsErrorKind::Unsupported, matching the existing Android stub.Unsupportedis the platform-correct resultVerified on-target against the shipped VxWorks 7 SDK (
wrsdk-vxworks7-qemu-1.17.0, the QEMU BSP). VxWorks has no way to express a no-follow permission change:O_NOFOLLOW. The only related flag isO_NOLINK("open the symlink itself"), which is different semantics and not what theopen+fchmodpath wants.fchmodatis provided — by the UTILS_UNIX component inlibunix, not corelibc— andAT_SYMLINK_NOFOLLOWis defined as0x100. But the shippedlibunix.sorejects the flag withENOTSUP:So
fchmodat(.., AT_SYMLINK_NOFOLLOW)returns-1/ENOTSUP, andflag == 0degrades tochmod, which follows symlinks. Afchmodat-based implementation is not viable on this release — the platform's ownfchmodatreportsENOTSUPfor exactly this request, which is whyUnsupportedis correct rather than merely conservative. cc @biabbas @hax0kartikBuild verification
On
1.100.0-nightly (908501772 2026-08-30)+rust-src(stocklibc0.2.189):cargo +nightly build -Zbuild-std=std,panic_abort --target x86_64-wrs-vxworksfails with the E0425 above (1 error).