.
D 2009-10-28T17:06:40
J assignee andreas_kupries
J cmimetype text/plain
J comment [close]\sperformed\son\san\sopened\sfile\ssilently\sdiscards\sany\sbuffered\sdata\swritten\sinto\sit\swhen\sthere's\sno\sspace\sleft\son\sthe\sunderlying\sdevice.\n[flush]\sworks\sin\sthis\scase,\sbut\sthe\sdocumentation\sexplicitly\sstates\sthat\s"all\sbuffered\soutput\sis\sflushed\sto\sthe\schannel's\soutput\sdevice,\sany\sbuffered\sinput\sis\sdiscarded".\n\nReproducible\son\sLinux\s(Debian\sLenny\srunning\s2.6.26\skernel)\sboth\swith\sthe\scurrent\sCVS\sHEAD\sand\s8.5.3.\n\nBelow\sare\sthe\ssteps\sto\sreproduce\sthe\serror\son\sLinux\sand\sthe\sprintouts\sof\ssample\sTcl\ssessions:\n\n1.\sCreate\sa\sfile\s"/var/tmp/blockdev"\s1\smegabyte\sin\ssize:\n\n$\sdd\sif=/dev/zero\sof=/var/tmp/blockdev\sbs=1024\scount=1024\n1024+0\srecords\sin\n1024+0\srecords\sout\n1048576\sbytes\s(1.0\sMB)\scopied,\s0.00824364\ss,\s127\sMB/s\n\n2.\sCreate\sext3\sfilesystem\son\sit:\n\n$\s/sbin/mkfs.ext3\s/var/tmp/blockdev\nmke2fs\s1.41.3\s(12-Oct-2008)\n/var/tmp/blockdev\sis\snot\sa\sblock\sspecial\sdevice.\nProceed\sanyway?\s(y,n)\sy\nFilesystem\slabel=\nOS\stype:\sLinux\nBlock\ssize=1024\s(log=0)\nFragment\ssize=1024\s(log=0)\n128\sinodes,\s1024\sblocks\n51\sblocks\s(4.98%)\sreserved\sfor\sthe\ssuper\suser\nFirst\sdata\sblock=1\nMaximum\sfilesystem\sblocks=1048576\n1\sblock\sgroup\n8192\sblocks\sper\sgroup,\s8192\sfragments\sper\sgroup\n128\sinodes\sper\sgroup\n[...]\n\n3.\sSet\s"reserved\sblocks\scount"\sto\s0\son\sthe\sfilesystem:\n\n$\s/sbin/tune2fs\s-r\s0\s/var/tmp/blockdev\ntune2fs\s1.41.3\s(12-Oct-2008)\nSetting\sreserved\sblocks\scount\sto\s0\n\n4.\sLearn\sthe\sblock\ssize\sand\sthe\samount\sof\sfree\sblocks\son\sthe\sresulting\sFS:\n\n$\s/sbin/dumpe2fs\s-h\s/var/tmp/blockdev\s|egrep\s-i\s'free\sblocks|block\ssize'\ndumpe2fs\s1.41.3\s(12-Oct-2008)\nFree\sblocks:\s\s\s\s\s\s\s\s\s\s\s\s\s\s986\nBlock\ssize:\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s1024\n\n5.\sGo\sroot,\screate\sa\smount\spoint\s"/tmp/blockdev"\sand\smount\sour\sfile\sonto\sit:\n\n$\ssu\n#\smkdir\s/tmp/blockdev\n#\smount\s-o\sloop\s/var/tmp/blockdev\s/tmp/blockdev\n\n6.\sCreate\sa\sfile\swhich\swill\soccupy\sall\sthe\savailable\sspace\son\sthe\sFS:\n\n#\sdd\sif=/dev/zero\sof=/tmp/blockdev/blob\sbs=1024\scount=986\ndd:\swriting\s`/tmp/blockdev/blob':\sNo\sspace\sleft\son\sdevice\n982+0\srecords\sin\n981+0\srecords\sout\n1004544\sbytes\s(1.0\sMB)\scopied,\s0.0069901\ss,\s144\sMB/s\n\n7.\sVerify\sno\sfree\sspace\sis\sreally\sleft:\n\n#\s/sbin/dumpe2fs\s-h\s/var/tmp/blockdev\s|\sgrep\s-i\s'free\sblocks'\ndumpe2fs\s1.41.3\s(12-Oct-2008)\nFree\sblocks:\s\s\s\s\s\s\s\s\s\s\s\s\s\s0\n\n8.\sRun\sTcl,\sattempt\sto\swrite\s5\sbytes\sto\sa\sfully\sbuffered\sfile\schannel,\sclose\sthe\sstream,\ssee\sthe\sdata\sdiscarded:\n\n#\s~kostix/tcl86/bin/tclsh8.6\n%\sset\sfd\s[open\s/tmp/blockdev/foo\sw]\nfile5\n%\schan\sconfig\s$fd\s-buffering\sfull\n%\sputs\s$fd\sdata\n%\sunset\s-nocomplain\serrorCode\serrorInfo\n%\sclose\s$fd\n%\sset\serrorCode\ncan't\sread\s"errorCode":\sno\ssuch\svariable\n%\sset\serrorInfo\ncan't\sread\s"errorCode":\sno\ssuch\svariable\n\s\s\s\swhile\sexecuting\n"set\serrorCode"\n\n9.\sSame\sas\sbefore,\sbut\sdo\s[flush]\sand\ssee\sit\scomplain\sas\sexpected:\n\n#\s~kostix/tcl86/bin/tclsh8.6\n%\sset\sfd\s[open\s/tmp/blockdev/foo\sw]\nfile5\n%\schan\sconfig\s$fd\s-buffering\sfull\n%\sputs\s$fd\sdata\n%\sunset\s-nocomplain\serrorCode\serrorInfo\n%\sflush\s$fd\nerror\sflushing\s"file5":\sno\sspace\sleft\son\sdevice\n%\sset\serrorInfo\nerror\sflushing\s"file5":\sno\sspace\sleft\son\sdevice\n\s\s\s\swhile\sexecuting\n"flush\s$fd"\n%\sset\serrorCode\nPOSIX\sENOSPC\s{no\sspace\sleft\son\sdevice}\n%\n
J foundin obsolete:\s8.6b1.1
J is_private 0
J priority 5\sMedium
J resolution None
J status Open
J submitter flatworm
J subsystem 25.\sChannel\sSystem
J title [close]\sdiscards\sbuffered\sdata\swhen\sno\sspace\sleft\son\sdevice
J type Bug
K 2888099fffffffffffffffffffffffffffffffff
U flatworm
Z 9abf8d00885028f29080c8b55a9b328c