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

file() with undef contents makes -e report EBADF #13

Open
FGasper opened this issue May 29, 2019 · 3 comments
Open

file() with undef contents makes -e report EBADF #13

FGasper opened this issue May 29, 2019 · 3 comments

Comments

@FGasper
Copy link
Contributor

FGasper commented May 29, 2019

To correctly mock nonexistence of a file, -e should set $! to ENOENT, not EBADF. Otherwise logic that does due diligence and reports non-ENOENT failures after a -e check will report a failure.

@FGasper
Copy link
Contributor Author

FGasper commented May 29, 2019

> perl -MTest::MockFile -e'my $mf = Test::MockFile->file("/some/path", undef); -e "/some/path"; print "$!"'
Bad file descriptor

@toddr
Copy link
Member

toddr commented May 29, 2019

Hmm.... This might not be a bug in T::MF it might be https://github.com/CpanelInc/Overload-FileCheck/issues but I'll check.

Actually on more reflection, I'm 99% certain it's an Overload issue.

@toddr toddr transferred this issue from cpanel/Test-MockFile Jul 29, 2019
@atoomic
Copy link
Contributor

atoomic commented Jan 10, 2022

with the release of Overload-FileCheck v0.12 and the last version of Test-MockFile (installed from master)

> perl -MTest::MockFile -e'my $mf = Test::MockFile->file("/some/path", undef); -e "/some/path"; print "$!"'
No such file or director

So I think this is fixed need to wait and confirm for the release of both

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

No branches or pull requests

3 participants