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

Delete buggy stat(::Integer) method #54855

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Conversation

LilithHafner
Copy link
Member

@LilithHafner LilithHafner commented Jun 20, 2024

"Where did someone get a RawFD as an integer anyway?" -@StefanKarpinski

See also #51711

Fixes #51710

@LilithHafner LilithHafner added minor change Marginal behavior change acceptable for a minor release needs pkgeval Tests for all registered packages should be run with this change labels Jun 20, 2024
@jakobnissen
Copy link
Contributor

This is specifically tested for, hence the tests fail. What did triage agree to yesterday? I can modify #51711 accordingly.
Would a deprecation for a (couple of) releases make sense?

@LilithHafner
Copy link
Member Author

I opened this PR while screen sharing during triage, but it wasn't explicitly a triage decision. I just want to see what nanosoldier has to say about this.

@nanosoldier runtests()

I think the problem with ispath(6) is that stat(6) works, not that ispath is duck-typed.

@nanosoldier
Copy link
Collaborator

The package evaluation job you requested has completed - possible new issues were detected.
The full report is available.

@LilithHafner
Copy link
Member Author

Where did someone get a RawFD as an integer anyway?

julia> fd(open("tmp", "w"))
23

@LilithHafner LilithHafner added this to the Potential 2.0 milestone Jun 21, 2024
@LilithHafner LilithHafner added breaking This change will break code and removed minor change Marginal behavior change acceptable for a minor release needs pkgeval Tests for all registered packages should be run with this change labels Jul 3, 2024
@LilithHafner
Copy link
Member Author

The docs don't indicate that stat should accept an integer:

  stat(file)

Return a structure whose fields contain information about the file. The fields of the structure are:

...

@LilithHafner
Copy link
Member Author

Of the 19 packages that failed nano-soldier only on this version, 14 were false positives, 3 were due to stat(::IOStream) failing (fixed in 6b29410) and only 2 require trivial downstream fixes (halleysfifthinc/C3D.jl#19, emmt/InterProcessCommunication.jl#10).

There is perhaps still hope for this in 1.x

@halleysfifthinc
Copy link
Contributor

The docs don't indicate that stat should accept an integer:

Actually, the docs don't indicate at all what stat accepts. I'm happy to accept @LilithHafner 's PR, but that doesn't feel like the complete solution IMO.

  • Could we update the fd function to return a RawFD? IIRC, changing return types isn't considered a breaking change. Has that been considered and/or is there a reason not to?
  • The stat docstring should be updated (as part of this PR imo), because the lack of clarity around the proper/desired arguments for stat might be why code like mine (i.e. stat(fd(io))) exists. A docstring should be clear enough that users don't need to call methods to understand what argument types it accepts.
    • A quick methods(stat) and blame shows that a stat(::IOStream) = stat(fd(io)) method has existed for much longer than my code, which makes me suspect that the lack of clarity in the stat docstring lead me to the unnecessary indirection through fd instead of a direct stat(io) call.
    • Additional explanation for the fd function and RawFD type docstrings would also be helpful. As it stands currently, they appear to be completely redundant, and its not clear why and when you should use one or the other.

@IanButterworth
Copy link
Member

Just came across this.

julia> isdir(false)
false

julia> isfile(false)
false

@LilithHafner
Copy link
Member Author

What did you expect? false is neither a file nor a directory. 😄

@vtjnash
Copy link
Member

vtjnash commented Jul 23, 2024

False is a file for me lol

$ echo "isfile(false)" > isfilefalse.jl
$ <isfilefalse.jl ./julia
true

Copy link
Contributor

@fingolfin fingolfin left a comment

Choose a reason for hiding this comment

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

Looks good to me esp. once #55080 is merged?

base/iostream.jl Outdated Show resolved Hide resolved
LilithHafner added a commit that referenced this pull request Jul 25, 2024
@LilithHafner
Copy link
Member Author

@nanosoldier runtests()

@mbauman
Copy link
Member

mbauman commented Jul 25, 2024

Why not a deprecation?

@LilithHafner
Copy link
Member Author

A deprecation would not fix #51710 and I'm optimistic that, with #55080, this is practically non-breaking which makes it plausible to remove outright.

@mbauman
Copy link
Member

mbauman commented Jul 25, 2024

I suppose I'm just more conservative here — to me this isn't worth an immediate minor change when the deprecation is so straightforward. It's great that you even already tackled the PkgEval failures, but I see that as rescuing two canaries from a particularly deep and obscure branch of our coal mine. I don't know who else is down there, and we might as well sound the alarm for anyone that's listening.

@LilithHafner
Copy link
Member Author

Two of the original PkgEval failures are fixed by #55080. But you are right that there was one that needed to be fixed downstream. We can deprecate.

giordano pushed a commit that referenced this pull request Jul 26, 2024
@LilithHafner LilithHafner modified the milestones: Potential 2.0, 1.14 Jul 26, 2024
@LilithHafner
Copy link
Member Author

This is still worth removing eventually because of #51710. I tagged 1.14 to be conservative, but would be open to landing it in 1.13, too.

@nanosoldier
Copy link
Collaborator

The package evaluation job you requested has completed - possible new issues were detected.
The full report is available.

@giordano
Copy link
Contributor

Failure in InterProcessCommunication looks real (CC: @emmt), others look noise at a quick glance.

@LilithHafner
Copy link
Member Author

I agree on both counts. That failure is fixed in emmt/InterProcessCommunication.jl#10.

@LilithHafner
Copy link
Member Author

From triage: Keno and Oscar and Lilith are fine with removing this in 1.12 (and postponing the removal if anyone notices)

@LilithHafner LilithHafner removed this from the 1.14 milestone Aug 15, 2024
lazarusA pushed a commit to lazarusA/julia that referenced this pull request Aug 17, 2024
lazarusA pushed a commit to lazarusA/julia that referenced this pull request Aug 17, 2024
@LilithHafner
Copy link
Member Author

@nanosoldier runtests()

@LilithHafner LilithHafner added needs pkgeval Tests for all registered packages should be run with this change merge me PR is reviewed. Merge when all tests are passing and removed merge me PR is reviewed. Merge when all tests are passing labels Aug 29, 2024
@nanosoldier
Copy link
Collaborator

The package evaluation job you requested has completed - possible new issues were detected.
The full report is available.

@LilithHafner LilithHafner removed the needs pkgeval Tests for all registered packages should be run with this change label Aug 31, 2024
@LilithHafner LilithHafner added triage This should be discussed on a triage call and removed triage This should be discussed on a triage call labels Oct 10, 2024
@LilithHafner LilithHafner added this to the 1.13 milestone Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking This change will break code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ispath returning false positive result for the given argument
9 participants