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
closing STDIN causes warning when opening unrelated file #12757
Comments
From @jimavThis is a bug report for perl from james_avera@yahoo.com, Not saying this is a bug, but it seems wrong to not permit perl -we 'close STDIN; open my $fh,">/dev/null";' It sounds like Perl implicitly re-opens STDIN when fd 0 gets Flags: Site configuration information for perl 5.14.2: Configured by Debian Project at Tue Nov 27 00:34:23 UTC 2012. Summary of my perl5 (revision 5 version 14 subversion 2) configuration: Locally applied patches: @INC for perl 5.14.2: Environment for perl 5.14.2: |
From @LeontOn Wed, Feb 6, 2013 at 2:33 AM, Jim Avera <perlbug-followup@perl.org> wrote:
You just closed STDIN(fd=0) Why would you want to do this in the first place? Leon |
The RT System itself - Status changed from 'new' to 'open' |
From @xdgOn Tue, Feb 5, 2013 at 9:07 PM, Leon Timmermans <fawaka@gmail.com> wrote:
It's slightly worse than that. If you close STDIN and then your Capture::Tiny goes through some hoops to avoid that, but it would be David -- |
From @arcDavid Golden <xdg@xdg.me> wrote:
For Unixish systems, I think the approach would be to look at the fd I don't know what hoops Capture::Tiny jumps through in this case, but I'm afraid I have no idea what that would do on Win32 or VMS, or if -- |
From @LeontOn Wed, Feb 6, 2013 at 6:58 PM, David Golden <xdg@xdg.me> wrote:
Judging from googleing around dup/dup2 is portable among Unix, Windows Leon |
From @iabynOn Tue, Feb 05, 2013 at 05:33:02PM -0800, Jim Avera wrote:
Note that the warning is a bit misleading. It's really trying to say that -- |
From @xdgOn Wed, Feb 6, 2013 at 2:08 PM, Aaron Crane <arc@cpan.org> wrote:
If I recall, if it sees STDIN closed, it opens it to -- |
From Eirik-Berg.Hanssen@allverden.noOn Thu, Feb 7, 2013 at 2:56 PM, David Golden <xdg@xdg.me> wrote:
I'd rather perl did not jump through that particular hoop without being Beyond performance and wasted file handles, I'd say something about not But why is there even a warning here? I read perldiag, but found no (What might break? Do some system prevent output on file handle 0? If there really is a reason, it'd be nice if perldiag gave it. :) Eirik |
From @xdgOn Thu, Feb 7, 2013 at 9:47 AM, Eirik Berg Hanssen
* You close STDIN (for whatever reason) Example: # Foo.pm ########### # run.pl close STDIN; ########### $ perl run.pl -- |
From Eirik-Berg.Hanssen@allverden.noOn Thu, Feb 7, 2013 at 8:54 PM, David Golden <xdg@xdg.me> wrote:
That seems like a perfectly good answer – to a different question. ;-) Thanks, but you're not reopening fd0 for writing, and so don't even get What you have done (by way of require) is open fd0 for reading. Valid If anything, this would suggest a warning when reopening fd0 for On my current system, I don't get a warning when I'm reopening fd0 for (And vice-versa for fd1 and fd2, of course.) Eirik |
From @xdgOn Thu, Feb 7, 2013 at 3:32 PM, Eirik Berg Hanssen
It was the answer to why we should stay of fd 0 and avoid the problem. In answer to your question, probably because having a write-only # run2.pl close STDIN; ### $ perl run2.pl -- |
From Eirik-Berg.Hanssen@allverden.noOn Thu, Feb 7, 2013 at 9:54 PM, David Golden <xdg@xdg.me> wrote:
Mhm. To bad it's not easily controllable. In answer to your question, probably because having a write-only
But that's not related to the reopening. A closed STDIN will also have eirik@bluebird[22:08:26] Okay, those are slightly different chrashes (for cat; I've tried a few (Perhaps there are other instances where this difference makes a If both should warn, the trigger should be executing a process with no But currently, only one of them warns ... and I still cannot say I see a Eirik |
From @xdgOn Thu, Feb 7, 2013 at 4:22 PM, Eirik Berg Hanssen
So you're volunteering to write a patch? -- |
From Eirik-Berg.Hanssen@allverden.noOn Thu, Feb 7, 2013 at 10:36 PM, David Golden <xdg@xdg.me> wrote:
Contingent on my eventually seeing a reason for this warning, I might If on the other hand you want both to warn, that's too deep into C for me Eirik |
Migrated from rt.perl.org#116659 (status was 'open')
Searchable as RT116659$
The text was updated successfully, but these errors were encountered: