[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug in --newer option handling in tarsnap
Hi Richard,
Sorry about the delay, I've been very sick the past week and I'm now catching
up on a backlog of emails.
On 04/19/12 16:14, Richard Todd wrote:
> The --newer option to make backups of all files newer (with a later ctime) than
> a given date doesn't seem to work properly on tarsnap.
> [...]
>
> The culprit seems to be in the write_hierarchy() routine in the following
> bit of code:
>
> /*
> * In -u mode, check that the file is newer than what's
> * already in the archive; in all modes, obey --newerXXX flags.
> */
> if (!new_enough(bsdtar, name, st))
> continue;
>
> Note that if this code sees that, e.g., /mntbak/ts/bootsy has ctime older
> than the --newer time, it will skip processing of that tree entry altogether
> even if that tree entry is a directory and thus should be checked to see if
> it or any subdirectories have files which *do* meet the "new enough" criterion.
Good catch!
> Note that the analogous code in the FreeBSD 'tar' utility's
> /usr/src/contrib/libarchive/tar/write.c has an extra bit of code just to
> force descent into a new directory in that case:
>
> /*
> * In -u mode, check that the file is newer than what's
> * already in the archive; in all modes, obey --newerXXX flags.
> */
> if (!new_enough(bsdtar, name, st)) {
> if (!descend)
> continue;
> if (bsdtar->option_interactive &&
> !yes("add '%s'", name))
> continue;
> tree_descend(tree);
> continue;
> }
>
> It looks like some variation on that code should be added to the tarsnap
> write_hierarchy() function.
I think I must have either missed a commit or not merged properly from the
upstream libarchive code. I'll definitely make sure this gets fixed in the next
version of the tarsnap client, and you'll be getting a bug bounty for this.
Thanks,
--
Colin Percival
Security Officer, FreeBSD | freebsd.org | The power to serve
Founder / author, Tarsnap | tarsnap.com | Online backups for the truly paranoid