Skip to content

Conversation

@LilithHafner
Copy link
Contributor

This accommodates an upstream change to Julia (JuliaLang/julia#54855) which will, if merged, reduce confusion about stat and related methods. Specifically, by deprecating and/or removing the stat(::Int) method, in favor of stat(::RawFD), we avoid issues like ispath(4) returning true (JuliaLang/julia#51710).

The current implementation of stat is, according to @less stat(4), stat(fd::Integer) = stat(RawFD(fd)). So this PR should not change the functionality of this package.

https://github.com/JuliaLang/julia/blob/c3883824b00f378b7e2609c5e20f4a110e5e56e6/base/stat.jl#L192

@emmt
Copy link
Owner

emmt commented Jul 16, 2024

Thank you very much for the fix!

@LilithHafner LilithHafner deleted the lh/RawFD branch July 27, 2024 13:09
@oscardssmith
Copy link

oscardssmith commented Jul 27, 2024

I think this might be a slightly suboptimal fix. Shouldn't the better fix be for FileDescriptor.fd to be a RawFD rather than an Int?

@emmt
Copy link
Owner

emmt commented Aug 26, 2024

A RawFD instance cannot be used for elementary operations such as comparisons (e.g. to check whether it is nonnegative which means it is valid) so having FileDescriptor.fd a RawFD value has some limitations. I have however extended RawFD constructor and Base.convert to convert a FileDescriptor to a RawFD (see d9ff17b).

@oscardssmith
Copy link

This could be achieved by adding additional functions like isvalid(::RawFD) that deal with the numeric internals, but I do understand that Ints are easy.

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.

3 participants