Skip to content
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

Missing O_NOFOLLOW #57

Closed
hasufell opened this issue May 1, 2016 · 6 comments
Closed

Missing O_NOFOLLOW #57

hasufell opened this issue May 1, 2016 · 6 comments

Comments

@hasufell
Copy link
Member

hasufell commented May 1, 2016

This is really annoying. I don't even understand why this library attempts to pre-select which flags I can pass in or not. That's not how a low-level library should be designed.

Since this library is about POSIX stuff, you should simply allow all POSIX flags, see http://www.unix.com/man-page/posix/3p/open/

O_NOFOLLOW If path names a symbolic link, fail and set errno to [ELOOP].

hasufell added a commit to hasufell/unix that referenced this issue May 1, 2016
hasufell added a commit to hasufell/unix that referenced this issue May 1, 2016
hasufell added a commit to hasufell/unix that referenced this issue May 1, 2016
hvr pushed a commit that referenced this issue Feb 23, 2018
* Add support for `O_NOFOLLOW`, `O_CLOEXEC`, `O_DIRECTORY` and `O_SYNC`
   (#6, #57)

* Refactor API of `openFd` removing `Maybe FileMode` argument,
   which now must be passed as part of `OpenFileFlags`
   (e.g. `defaultFileFlags { creat = Just mode }`)  (#58)

Closes #59
@joeyh
Copy link

joeyh commented Jun 24, 2019

This bug appears to have been fixed, and ought to be closed.

@RyanGlScott
Copy link
Member

Indeed, this was resolved in c7d88b3.

@joeyh
Copy link

joeyh commented Jun 24, 2019 via email

@RyanGlScott
Copy link
Member

Perhaps I misunderstood the scope of this ticket. The issue (as far as I understood it) was the inability specify the O_NOFOLLOW flag via the API, and that commit does add a nofollow field to OpenFileFlags. Is there a remaining issue that should warrant re-opening this ticket?

@hasufell
Copy link
Member Author

hasufell commented Jun 24, 2019

Sorry if I'm being dense, but how does that let a directory stream be opened with O_NOFOLLOW? openDirStream still takes only a FilePath ..

openDirStream uses opendir, which is not a syscall, but a C library function. It doesn't allow to set flags.

Instead you would use open to get a file descriptor, followed by fdopendir to get the DIR stream. I don't know if we have a function for fdopendir, you might have to write it yourself.

@joeyh
Copy link

joeyh commented Jun 24, 2019

Apologies for the noise, I confused this with my other issue for openDirStream O_NOFOLLOW support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants