[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: Busybox "tar -c" aborts on failed reads? (GNU tar doesn't)
From: Joshua Judson Rosen <jrosen () harvestai ! com>
Date: 2013-08-15 17:31:19
Message-ID: 520D1067.8090901 () harvestai ! com
[Download RAW message or body]
I noticed that writeFileToTarball() _aborts_ if it fails to read a file that
it's supposed to put into the archive (including if the file changed size);
the code in question being:
/* If it was a regular file, write out the body */
if (inputFileFd >= 0) {
size_t readSize;
/* Write the file to the archive. */
/* We record size into header first, */
/* and then write out file. If file shrinks in between, */
/* tar will be corrupted. So we don't allow for that. */
/* NB: GNU tar 1.16 warns and pads with zeroes */
/* or even seeks back and updates header */
bb_copyfd_exact_size(inputFileFd, tbInfo->tarFd, statbuf->st_size);
////off_t readSize;
////readSize = bb_copyfd_size(inputFileFd, tbInfo->tarFd,
statbuf->st_size);
////if (readSize != statbuf->st_size && readSize >= 0) {
//// bb_error_msg_and_die("short read from %s, aborting", fileName);
////}
I'm running into this problem when trying to tar up files from a failing UBIFS,
so there are occasional read-errors for some files, but I was surprised to find
that an error reading a file early in the fileset will both discard all of the
later files _and_ result in a corrupt tar-stream (when tar just aborts, the
output prematurely truncated).
GNU tar indeed handles this much more gracefully; and it seems like it should be
easy enough for me to fix this issue in busybox, but I wonder if there's any
particular reason that it's handled the way it is rather than like GNU tar does.
Should I fix it and send a patch up, or should I just find a work-around?
--
"'tis an ill wind that blows no minds."
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic