-
Notifications
You must be signed in to change notification settings - Fork 567
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
chmod() doesn't populate a local()ed $! #14073
Comments
From @FGasperCreated by @FGasperperl -MFile::Temp -e'my ($fh, $path) = File::Temp::tempfile(); close The above breaks on every Perl version that I've tried: 5.14.4/Linux, 5.18.2/Mac, and 5.20.0/Mac. If you take out the "local ( Perl Info
|
From @FGasperchown() appears to have a similar problem. perl -MFile::Temp -e'my ($fh, $path) = File::Temp::tempfile(); close On 9/4/14 12:50 PM, perlbug-followup@perl.org wrote:
|
From @LeontOn Thu, Sep 4, 2014 at 7:50 PM, felipe@felipegasper.com <
The presence of «local $!» will prevent the previous value (from Leon |
The RT System itself - Status changed from 'new' to 'open' |
From @FGasperOn 9/4/14 3:18 PM, Leon Timmermans via RT wrote:
Compare this to how print behaves: perl -MFile::Temp -e'my ($fh, $path) = File::Temp::tempfile(); close ok? [] err? [Bad file descriptor/Bad file descriptor]The documented behavior is that chown() and chmod() populate $! whenever -FG |
From @csjewellHe's trying to GENERATE an error in order to show that the local($!) So yes, it is a bug. On Thu, Sep 4, 2014, at 14:17, Leon Timmermans wrote:
|
From @LeontOn Thu, Sep 4, 2014 at 10:50 PM, Felipe Gasper <felipe@felipegasper.com>
Notice hor $ perl -MFile::Temp -e'my ($fh, $path) = File::Temp::tempfile(); close $fh; gives exactly the same result. The only conclusion that can be made here is Yes, it does not set $! if $fh is a closed filehandle (because it doesn't Leon |
From @Leont0001-Set-when-chmod-ing-a-closed-filehandle.patchFrom db6a4e3750b3eb75b40b7856183e5dedaa89d409 Mon Sep 17 00:00:00 2001
From: Leon Timmermans <fawaka@gmail.com>
Date: Thu, 4 Sep 2014 23:00:05 +0200
Subject: [PATCH] Set $! when chmod()ing a closed filehandle
---
doio.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/doio.c b/doio.c
index a631eeb..3e013d0 100644
--- a/doio.c
+++ b/doio.c
@@ -1759,6 +1759,7 @@ Perl_apply(pTHX_ I32 type, SV **mark, SV **sp)
#endif
}
else {
+ SETERRNO(EBADF,RMS_IFI);
tot--;
}
}
@@ -1799,6 +1800,7 @@ Perl_apply(pTHX_ I32 type, SV **mark, SV **sp)
#endif
}
else {
+ SETERRNO(EBADF,RMS_IFI);
tot--;
}
}
--
2.1.0-222-g4315447
|
From @AbigailOn Thu, Sep 04, 2014 at 10:50:10AM -0700, felipe@felipegasper.com wrote:
It sets $! to "Inappropriate ioctl for device" on my box, which In fact, that's what $! contains after File::Temp::tempfile: #!/usr/bin/perl use 5.010; say "[$!]"; __END__ Which further indicates what Leon was saying, the issue here is that Abigail |
From @tonycozOn Thu Sep 04 14:14:31 2014, LeonT wrote:
I've applied essentially this patch, but with some tests as 8334cae. I didn't notice yours until after I'd written mine. Tony |
@tonycoz - Status changed from 'open' to 'resolved' |
From @FGasperThank you! :) On 22 Oct 2014 12:39 AM, Tony Cook via RT wrote:
|
Migrated from rt.perl.org#122703 (status was 'resolved')
Searchable as RT122703$
The text was updated successfully, but these errors were encountered: