Overview
| Artifact ID: | 7f79b84ec591afb413f53be2848a31660994f10d |
|---|---|
| Ticket: | 2888099fffffffffffffffffffffffffffffffff
[close] discards buffered data when no space left on device |
| User & Date: | flatworm on 2009-10-28 17:06:40 |
Changes
- assignee changed to: "andreas_kupries"
- cmimetype changed to: "text/plain"
- comment changed to:
[close] performed on an opened file silently discards any buffered data written into it when there's no space left on the underlying device. [flush] works in this case, but the documentation explicitly states that "all buffered output is flushed to the channel's output device, any buffered input is discarded". Reproducible on Linux (Debian Lenny running 2.6.26 kernel) both with the current CVS HEAD and 8.5.3. Below are the steps to reproduce the error on Linux and the printouts of sample Tcl sessions: 1. Create a file "/var/tmp/blockdev" 1 megabyte in size: $ dd if=/dev/zero of=/var/tmp/blockdev bs=1024 count=1024 1024+0 records in 1024+0 records out 1048576 bytes (1.0 MB) copied, 0.00824364 s, 127 MB/s 2. Create ext3 filesystem on it: $ /sbin/mkfs.ext3 /var/tmp/blockdev mke2fs 1.41.3 (12-Oct-2008) /var/tmp/blockdev is not a block special device. Proceed anyway? (y,n) y Filesystem label= OS type: Linux Block size=1024 (log=0) Fragment size=1024 (log=0) 128 inodes, 1024 blocks 51 blocks (4.98%) reserved for the super user First data block=1 Maximum filesystem blocks=1048576 1 block group 8192 blocks per group, 8192 fragments per group 128 inodes per group [...] 3. Set "reserved blocks count" to 0 on the filesystem: $ /sbin/tune2fs -r 0 /var/tmp/blockdev tune2fs 1.41.3 (12-Oct-2008) Setting reserved blocks count to 0 4. Learn the block size and the amount of free blocks on the resulting FS: $ /sbin/dumpe2fs -h /var/tmp/blockdev |egrep -i 'free blocks|block size' dumpe2fs 1.41.3 (12-Oct-2008) Free blocks: 986 Block size: 1024 5. Go root, create a mount point "/tmp/blockdev" and mount our file onto it: $ su # mkdir /tmp/blockdev # mount -o loop /var/tmp/blockdev /tmp/blockdev 6. Create a file which will occupy all the available space on the FS: # dd if=/dev/zero of=/tmp/blockdev/blob bs=1024 count=986 dd: writing `/tmp/blockdev/blob': No space left on device 982+0 records in 981+0 records out 1004544 bytes (1.0 MB) copied, 0.0069901 s, 144 MB/s 7. Verify no free space is really left: # /sbin/dumpe2fs -h /var/tmp/blockdev | grep -i 'free blocks' dumpe2fs 1.41.3 (12-Oct-2008) Free blocks: 0 8. Run Tcl, attempt to write 5 bytes to a fully buffered file channel, close the stream, see the data discarded: # ~kostix/tcl86/bin/tclsh8.6 % set fd [open /tmp/blockdev/foo w] file5 % chan config $fd -buffering full % puts $fd data % unset -nocomplain errorCode errorInfo % close $fd % set errorCode can't read "errorCode": no such variable % set errorInfo can't read "errorCode": no such variable while executing "set errorCode" 9. Same as before, but do [flush] and see it complain as expected: # ~kostix/tcl86/bin/tclsh8.6 % set fd [open /tmp/blockdev/foo w] file5 % chan config $fd -buffering full % puts $fd data % unset -nocomplain errorCode errorInfo % flush $fd error flushing "file5": no space left on device % set errorInfo error flushing "file5": no space left on device while executing "flush $fd" % set errorCode POSIX ENOSPC {no space left on device} % - foundin changed to: "obsolete: 8.6b1.1"
- is_private changed to: "0"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "flatworm"
- subsystem changed to: "25. Channel System"
- title changed to:
[close] discards buffered data when no space left on device
- type changed to: "Bug"