Skip to content

File.OpenFlags is missing a no_follow field #18327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
squeek502 opened this issue Dec 20, 2023 · 1 comment
Closed

File.OpenFlags is missing a no_follow field #18327

squeek502 opened this issue Dec 20, 2023 · 1 comment
Labels
contributor friendly This issue is limited in scope and/or knowledge of Zig internals. enhancement Solving this issue will likely involve adding new logic or components to the codebase. standard library This issue involves writing Zig code for the standard library.

Comments

@squeek502
Copy link
Collaborator

squeek502 commented Dec 20, 2023

Dir.OpenDirOptions has a no_follow field:

zig/lib/std/fs/Dir.zig

Lines 1336 to 1337 in f36ac22

/// `true` means it won't dereference the symlinks.
no_follow: bool = false,

The same field should be present in File.OpenFlags

Depends on #16606 being resolved to allow implementing no_follow for Dir.access on Linux. #16738 is also potentially relevant.


EDIT: It may actually be impossible to implement this for all supported platforms, MacOS/Darwin doesn't seem to support getting a file descriptor of a symlink itself (no O_PATH flag for the open syscall).

@squeek502 squeek502 added enhancement Solving this issue will likely involve adding new logic or components to the codebase. contributor friendly This issue is limited in scope and/or knowledge of Zig internals. standard library This issue involves writing Zig code for the standard library. labels Dec 20, 2023
@Vexu Vexu added this to the 0.13.0 milestone Dec 20, 2023
@squeek502
Copy link
Collaborator Author

squeek502 commented Dec 21, 2023

Closing this for now until #18335 is figured out. Might re-open in the future.

@squeek502 squeek502 closed this as not planned Won't fix, can't repro, duplicate, stale Dec 21, 2023
@Vexu Vexu removed this from the 0.13.0 milestone Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor friendly This issue is limited in scope and/or knowledge of Zig internals. enhancement Solving this issue will likely involve adding new logic or components to the codebase. standard library This issue involves writing Zig code for the standard library.
Projects
None yet
Development

No branches or pull requests

2 participants