Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^4: write to /dev/full does not fail

by Discipulus (Canon)
on May 23, 2014 at 07:57 UTC ( [id://1087175]=note: print w/replies, xml ) Need Help??


in reply to Re^3: write to /dev/full does not fail
in thread write to /dev/full does not fail

no, it seems to me it always, only dies on close:
#this not dies perl -e 'open FH, ">", "/dev/full" or die $!; for (1..100) {print FH " +line\n" or die $!;} ' #this too not dies perl -e '$|++;open FH, ">", "/dev/full" or die $!; for (1..100) {prin +t FH "line\n" or die $!;} ' #only this dies, on close perl -e 'open FH, ">", "/dev/full" or die $!; for (1..100) {print FH +"line\n" or die $!;}; close FH or die $!' No space left on device at -e line 1.
UPDATE: as suggested by choroba 100 are few (magic number seems to be 820):
# this still does not die perl -e '$|++;open FH, ">", "/dev/full" or die $!; for (1..819) {print + FH "line\n" or die $!;} ' #but this dies! perl -e '$|++;open FH, ">", "/dev/full" or die $!; for (1..1000) {pri +nt FH "line\n" or die $!;} ' No space left on device at -e line 1.
820 is to much? Perl becomes bored after 820 errors (not spotted)? is very patient: i'm hurted by second error.. ;=)
# perl -e 'print "$_\n" for 1..10000' | perl -ne '$num = <STDIN>;print + "$num:";open FH, ">", "/dev/full" or die $!; for (1..$num) {print FH + "line\n" or die $!;};close FH;' .. :816 :818 :820 No space left on device at -e line 1, <STDIN> line 410.
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Replies are listed 'Best First'.
Re^5: write to /dev/full does not fail
by kschwab (Vicar) on May 23, 2014 at 16:34 UTC

    "line\n" is 5 bytes.

    820 * 5 = 4100.

    Buffer size for linux is 4096, so the write hits the actual device on your 820th iteration.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1087175]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (3)
As of 2024-04-24 13:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found