bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-tar] tar keeps reporting "file changed as we read it" on random fil


From: Mark O'Keefe
Subject: [Bug-tar] tar keeps reporting "file changed as we read it" on random files
Date: Tue, 01 Dec 2015 11:21:09 +0000 (GMT)

Hi,

I've been getting this error on my cygwin64 installation.  When researching it I found the following bug raised against GlusterFS:  https://bugzilla.redhat.com/show_bug.cgi?id=1058526
It appears to be the same issue.  I looked into the code and came across what I believe to be the issue.  It appears to me that the check for a directory was incorrectly looking at ctime instead of mtime.  Here is the patch I've been using to remove this problem on my system.

My apologies if this is not the correct way to do this, but hoping to find someone to check to see if my logic is correct and advise if this is appropriate to be included in a new version of tar.  Happy and hoping to discuss further.

Cheers,
Mark.

--- origsrc/tar-1.28/src/create.c 2014-03-03 06:07:01.000000000 +1100
+++ src/tar-1.28/src/create.c 2015-07-16 12:04:14.650983300 +1000
@@ -1636,6 +1636,7 @@ dump_file0 (struct tar_stat_info *st, ch
char type;
off_t original_size;
struct timespec original_ctime;
+ struct timespec original_mtime;
off_t block_ordinal = -1;
int fd = 0;
bool is_dir;
@@ -1680,7 +1681,7 @@ dump_file0 (struct tar_stat_info *st, ch

st->archive_file_size = original_size = st->stat.st_size;
st->atime = get_stat_atime (&st->stat);
- st->mtime = get_stat_mtime (&st->stat);
+ st->mtime = original_mtime = get_stat_mtime (&st->stat);
st->ctime = original_ctime = get_stat_ctime (&st->stat);

#ifdef S_ISHIDDEN
@@ -1811,8 +1812,8 @@ dump_file0 (struct tar_stat_info *st, ch

if (ok)
{
- if ((timespec_cmp (get_stat_ctime (&final_stat), original_ctime) != 0
- /* Original ctime will change if the file is a directory and
+ if ((timespec_cmp (get_stat_mtime (&final_stat), original_mtime) != 0
+ /* Original mtime will change if the file is a directory and
--remove-files is given */
&& !(remove_files_option && is_dir))
|| original_size < final_stat.st_size)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]