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

Add Libc.mkfifo #34587

Merged
merged 19 commits into from
Oct 1, 2023
Merged

Add Libc.mkfifo #34587

merged 19 commits into from
Oct 1, 2023

Conversation

tkf
Copy link
Member

@tkf tkf commented Jan 30, 2020

This PR adds a mkfifo wrapper Libc.mkfifo for Unix platforms.

Python has it in os stdlib and it's useful sometimes. I think it'd be nice if Julia has it in Base/stdlib too.

base/libc.jl Outdated Show resolved Hide resolved
@fredrikekre fredrikekre added this to the 1.5 milestone Apr 30, 2020
@StefanKarpinski
Copy link
Sponsor Member

StefanKarpinski commented Apr 30, 2020

Not sure why this is a release blocker? By all means, if the comments are addressed and this gets merged before May 4th, then it will be included.

base/libc.jl Outdated Show resolved Hide resolved
@tkf
Copy link
Member Author

tkf commented Apr 30, 2020

@vtjnash @JeffBezanson Thanks for the review. I incorporated your comments.

@fredrikekre fredrikekre removed this from the 1.5 milestone Apr 30, 2020
@StefanKarpinski
Copy link
Sponsor Member

Looking good... All that green! @JeffBezanson want to merge if you're happy here?

base/libc.jl Show resolved Hide resolved
@StefanKarpinski StefanKarpinski added the status:triage This should be discussed on a triage call label Dec 14, 2020
@musm
Copy link
Contributor

musm commented Feb 11, 2021

Just needs a rebase and to change the error message to ENOT_SUP: kernel does not support fifo

@musm musm removed the status:triage This should be discussed on a triage call label Feb 11, 2021
base/libc.jl Outdated Show resolved Hide resolved
@vtjnash vtjnash added the status:merge me PR is reviewed. Merge when all tests are passing label Nov 13, 2021
base/libc.jl Outdated
systemerror("mkfifo", ret == -1)
return path
else
systemerror("mkfifo", ENOTSUP)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, I noticed that ENOTSUP doesn't exist in my local build. I guess it's OK as long as this is defined in Windows, though.

Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like Linux defines EOPNOTSUP instead, and our regex isn't smart enough to pick up the value for ENOTSUP from that. But CI seems to be okay with this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems Windows prints ENOTSUP as "Unknown error":

Error in testset file:
Test Failed at C:\buildbot\worker-tabularasa\tester_win64\build\share\julia\test\file.jl:1635
  Expression: Libc.mkfifo(joinpath(pwd(), "dummy_path"))
    Expected: "mkfifo: Operation not supported"
     Message: "SystemError: mkfifo: Unknown error"

--- https://build.julialang.org/#/builders/65/builds/5360

So, I suggest simply doing:

julia/base/libc.jl

Lines 426 to 428 in 02961cc

# Using normal `error` because `systemerror("mkfifo", ENOTSUP)` does not
# seem to work on Windows.
error("mkfifo: Operation not supported")

Is it OK?

It seems Windows prints it as "Unknown error":

    Error in testset file:
    Test Failed at C:\buildbot\worker-tabularasa\tester_win64\build\share\julia\test\file.jl:1635
      Expression: Libc.mkfifo(joinpath(pwd(), "dummy_path"))
        Expected: "mkfifo: Operation not supported"
         Message: "SystemError: mkfifo: Unknown error"

https://build.julialang.org/#/builders/65/builds/5360

This reverts commit 1ff5cd7.
@tkf tkf removed the status:merge me PR is reviewed. Merge when all tests are passing label Nov 14, 2021
@MagicMuscleMan
Copy link

As I just needed this functionality, I was going to reinvent the wheel when I stumbled across this PR.

I do not understand why it hasn't been merged. Is there a blocker in general? Otherwise, if we prepared that for 1.10 or 1.11, would it be mergeable?

@vtjnash vtjnash added the status:merge me PR is reviewed. Merge when all tests are passing label Sep 27, 2023
@vtjnash
Copy link
Sponsor Member

vtjnash commented Sep 27, 2023

I just got lost because the merge me tag was removed. Putting that back now.

@IanButterworth IanButterworth merged commit 64fc7db into JuliaLang:master Oct 1, 2023
6 checks passed
@IanButterworth IanButterworth removed the status:merge me PR is reviewed. Merge when all tests are passing label Oct 1, 2023

`mkfifo` is supported only in Unix platforms.

!!! compat "Julia 1.8"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has this been corrected? Obviously this merge was a bit late for 1.8.

Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Please PR to fix

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 this pull request may close these issues.

None yet

10 participants