std: don't reference libc::O_NOFOLLOW on VxWorks in set_perm_nofollow - #162065
Open
physwkim wants to merge 2 commits into
Open
std: don't reference libc::O_NOFOLLOW on VxWorks in set_perm_nofollow#162065physwkim wants to merge 2 commits into
libc::O_NOFOLLOW on VxWorks in set_perm_nofollow#162065physwkim wants to merge 2 commits into
Conversation
Collaborator
|
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.
…low` VxWorks' libc defines no `O_NOFOLLOW` (the platform's <sys/fcntlcom.h> stops at `O_CLOEXEC`), but the `set_permissions_nofollow` refactor that consolidated the implementation into `sys/fs/unix.rs` dropped the `not(target_os = "vxworks")` guard the old `sys/fs/mod.rs` implementation carried, so `-Zbuild-std` for `x86_64-wrs-vxworks` fails with E0425 at the `custom_flags(libc::O_NOFOLLOW)` call. The target is tier 3 and not built in CI, so this went unnoticed. VxWorks has symbolic links (`O_NOLINK`), unlike ESP-IDF/Horizon, so it cannot skip `O_NOFOLLOW` and follow silently; return `Unsupported` instead, matching the Android stub and the previous behavior.
physwkim
force-pushed
the
vxworks-set-perm-nofollow
branch
from
August 31, 2026 13:23
4e8c17a to
74a9f8c
Compare
ChrisDenton
reviewed
Aug 31, 2026
Member
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
Co-authored-by: Chris Denton <chris@chrisdenton.dev>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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).