tar and out of disk space

Kim B. Heino Kim.Heino at bluegiga.com
Thu Dec 21 07:50:58 UTC 2006


Hello,

If I have a big.tar.gz file and not enough disk space to untar it, 
BusyBox's tar still returns error code 0. GNU Tar returns 2.

[root at wrap tmp]$ tar xzvf big.tar.gz
1.smallfile
2.bigfile
tar: Write Error: No space left on device
3.bigfile
tar: Write Error: No space left on device
[root at wrap tmp]$ echo $?
0

By quickly looking at the source this is probably because 
bb_copyfd_size()'s return code is never checked in data_extract_all(). 
How about something like this:

if (bb_copyfd_size(archive_handle->src_fd, dst_fd, file_header->size) != 
file_header->size) {
	bb_error_msg_and_die("can't write to file");
}



More information about the busybox mailing list