pm_strcpy(jcr->last_fname, attr->ofname);
jcr->last_type = attr->type;
jcr->unlock();
- Dmsg4(130, "Outfile=%s create_file stat=%d type=%ld rdev=%d\n", attr->ofname, stat, attr->type, attr->statp.st_rdev);
+ Dmsg4(100, "Outfile=%s create_file stat=%d type=%ld rdev=%d\n", attr->ofname, stat, attr->type, attr->statp.st_rdev);
switch (stat) {
case CF_ERROR:
case CF_SKIP:
rctx.flags |= FO_OFFSETS;
}
+ if (rctx.full_stream & STREAM_BIT_DELTA) {
+ rctx.flags |= FO_DELTA;
+ }
+
if (rctx.stream == STREAM_GZIP_DATA
|| rctx.stream == STREAM_SPARSE_GZIP_DATA
|| rctx.stream == STREAM_WIN32_GZIP_DATA
if (is_win32_stream(rctx.stream) &&
(win32decomp || !have_win32_api())) {
set_portable_backup(&rctx.bfd);
- rctx.flags |= FO_WIN32DECOMP; /* "decompose" BackupWrite data */
+ // Specific fix for VSS plugin, it is marked as Win32, but
+ // it's not a win32 data stream when Delta and Offset are on
+ if ((rctx.flags & FO_OFFSETS) && rctx.attr->delta_seq > 0) {
+ // noop
+ } else {
+ rctx.flags |= FO_WIN32DECOMP; /* "decompose" BackupWrite data */
+ }
}
if (extract_data(rctx, bmsg->rbuf, bmsg->rbuflen) < 0) {
unser_uint64(faddr);
if (*addr != faddr) {
*addr = faddr;
+ Dmsg1(100, "Need to seek at %lld\n", faddr);
if (blseek(bfd, (boffset_t)*addr, SEEK_SET) < 0) {
berrno be;
Jmsg3(jcr, M_ERROR, 0, _("Seek to %s error on %s: ERR=%s\n"),
Dmsg2(400, "Replace=%c %d\n", (char)replace, replace);
if (lstat(attr->ofname, &mstatp) == 0) {
exists = true;
+ }
+
+ /* The file already exists and we are not updating it, we need
+ * to choose if we skip the file or not based on the replace flag
+ */
+ if (exists && attr->delta_seq == 0) {
switch (replace) {
case REPLACE_IFNEWER:
/* Set attributes if we created this directory */
break;
}
}
+
+ if (!exists && attr->delta_seq > 0) {
+ Qmsg(jcr, M_SKIPPED, 0, _("File skipped. File must exists to apply a patch: %s\n"), attr->ofname);
+ return CF_SKIP;
+ }
+
switch (attr->type) {
case FT_RAW: /* raw device to be written */
case FT_FIFO: /* FIFO to be written to */
* restore data, or we may blow away a partition definition.
*/
if (exists && attr->type != FT_RAW && attr->type != FT_FIFO
- && attr->stream != STREAM_UNIX_ATTRIBUTE_UPDATE) {
+ && attr->stream != STREAM_UNIX_ATTRIBUTE_UPDATE
+ && attr->delta_seq == 0)
+ {
/* Get rid of old copy */
- Dmsg1(400, "unlink %s\n", attr->ofname);
+ Dmsg1(50, "unlink %s\n", attr->ofname);
if (unlink(attr->ofname) == -1) {
berrno be;
Qmsg(jcr, M_ERROR, 0, _("File %s already exists and could not be replaced. ERR=%s.\n"),
switch(attr->type) {
case FT_REGE:
case FT_REG:
- Dmsg1(100, "Create=%s\n", attr->ofname);
flags = O_WRONLY | O_CREAT | O_BINARY | O_EXCL;
+ /* Remove the O_EXCL flag if we will update an existing file */
+ if (attr->delta_seq > 0) {
+ flags &= ~O_EXCL;
+ }
+
if (IS_CTG(attr->statp.st_mode)) {
flags |= O_CTG; /* set contiguous bit if needed */
}
+ Dmsg3(50, "Create=%s flags=%lld delta=%d\n", attr->ofname, (uint64_t)flags, (int)attr->delta_seq);
+
if (is_bopen(bfd)) {
Qmsg1(jcr, M_ERROR, 0, _("bpkt already open fid=%d\n"), bfd->fid);
bclose(bfd);