New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
--resume-extract #327
--resume-extract #327
Conversation
Example, with a weird example of an archive containing two copies of the same file:
|
Do we want to support And if we're not supporting it as a configuration file option, we don't need |
I wondered about that, but then I asked myself the flipped version: if I think it's a risky thing to have as a "set and forget" option, then clearly I don't have confidence in it doing the right thing. I'm happy to have it as command-line-only if you prefer that, though. |
While I agree that So for the sake of minimizing user error I think let's keep it as command-line-only... at least until someone steps forward and says "I really wish I could put this into my configuration file because ". |
17f1dd6
to
c22b387
Compare
Ok, removed |
tar/bsdtar.c
Outdated
@@ -1779,6 +1782,11 @@ dooption(struct bsdtar *bsdtar, const char * conf_opt, | |||
|
|||
bsdtar->option_quiet = 1; | |||
bsdtar->option_quiet_set = 1; | |||
} else if (strcmp(conf_opt, "resume-extract") == 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code here is for processing configuration file options. Why do we need it?
tar/tarsnap.1-man.in
Outdated
@@ -624,6 +624,11 @@ Ignore any | |||
\fBquiet\fP | |||
option specified in a configuration file. | |||
.TP | |||
\fB\--no-resume-extract\fP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed any more?
tar/tarsnap.1-mdoc.in
Outdated
@@ -561,6 +561,10 @@ option specified in a configuration file. | |||
Ignore any | |||
.Cm quiet | |||
option specified in a configuration file. | |||
.It Fl -no-resume-extract |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed any more?
Looks like there's still some |
c22b387
to
13f7e7a
Compare
Sorry, was distracted by a viola gig.
|
tar/read.c
Outdated
/* Don't extract if the file already matches it. */ | ||
if (bsdtar->option_resume_extract) { | ||
if ((r = check_skip_file( | ||
archive_entry_pathname(entry), st)) == -1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How carefully did you check that archive_entry_pathname(entry)
is the correct path to the file we would create? I think this is correct but with options like -C
and -s
and the handling of absolute paths and paths containing ..
I want to be sure that we have this right and aren't accidentally comparing metadata against the wrong place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
woah, -s
looks wacky! Didn't occur to me to check that one, I'll do it soon.
13f7e7a
to
926d63c
Compare
I think this is working. I made sure that Basic usage:
-C out/
-s
-C out/ -s
absolute paths combined with -C
relative dirs
|
(x mode only) | ||
Don't extract files whose filesize and mtime matches existing files on the | ||
disk. Primarily used to resume an archive extraction which was interrupted. | ||
.TP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably worth adding something along the lines of "This differs from -k in that --resume-extract will overwrite a file if the size or modification time do not match, as can happen if tarsnap is killed partway through extracting a file."
@@ -7,6 +7,8 @@ | |||
non-blank lines read from config files. | |||
- tarsnap now gives an error if there are unused command-line arguments. | |||
(i.e. "tarsnap -d -f a1 a2", where "a2" is unused.) | |||
- tarsnap now accepts a --resume-extract option to skip extracting files whose |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to have a merge conflict fixed.
tar/read.c
Outdated
goto err0; | ||
} | ||
|
||
/* Compare file size and mtime. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment here should point out that we're comparing the seconds of the mtime, not the complete timespec; some filesystems don't have sub-second timestamp precision, so comparing timespecs would produce a lot of false negatives.
Ok, looks good. I've confirmed by inspection of the libarchive source code that archive_entry_pathname is definitely the path to where we're going to write on disk. |
926d63c
to
1251971
Compare
Rebased to fix merge conflicts, but I left the two recent fixes to your comments are separate commits for easy examination. Fun fact: I misread the POSIX and linux man-pages about |
Updated to current master. I checked that all the tests in #327 (comment) work. |
No description provided.