The Samba-Bugzilla – Attachment 11733 Details for
Bug 11642
tarmode verbose is ignored in libarchive version of smbclient
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
reenable tarmode verbose, and skip inaccessible files
clitar.diff (text/plain), 4.50 KB, created by
Alan Bowler
on 2015-12-18 19:06:11 UTC
(
hide
)
Description:
reenable tarmode verbose, and skip inaccessible files
Filename:
MIME Type:
Creator:
Alan Bowler
Created:
2015-12-18 19:06:11 UTC
Size:
4.50 KB
patch
obsolete
>*** samba-4.3.1/source3/client/clitar.c 2015-10-20 06:40:54.000000000 -0400 >--- work-samba/source3/client/clitar.c 2015-12-17 16:25:55.058144232 -0500 >*************** >*** 169,175 **** > .mode.reset = false, > .mode.dry = false, > .mode.regex = false, >! .mode.verbose = false, > }; > > /* tar, local function */ >--- 169,175 ---- > .mode.reset = false, > .mode.dry = false, > .mode.regex = false, >! .mode.verbose = true, /* as documented */ > }; > > /* tar, local function */ >*************** >*** 213,218 **** >--- 213,222 ---- > bool *_subpath_match); > > /** >+ * counters >+ */ >+ static int tar_numdir, tar_numfile; >+ /** > * tar_get_ctx - retrieve global tar context handle > */ > struct tar *tar_get_ctx() >*************** >*** 364,369 **** >--- 368,374 ---- > err = 1; > goto out; > } >+ tar_numdir = tar_numfile = 0; > > rc = tar_process(&tar_ctx); > if (rc != 0) { >*************** >*** 708,715 **** > } > } > > out_close: >- DBG(0, ("Total bytes received: %" PRIu64 "\n", t->total_size)); > > if (!t->mode.dry) { > r = archive_write_close(t->archive); >--- 713,722 ---- > } > } > >+ DEBUG(0, ("tar: dumped %d files and %d directories\n", >+ tar_numfile , tar_numdir)); >+ DEBUG(0, ("Total bytes written: %" PRIu64 "\n", t->total_size)); > out_close: > > if (!t->mode.dry) { > r = archive_write_close(t->archive); >*************** >*** 859,864 **** >--- 866,872 ---- > client_set_cur_dir(new_dir); > do_list(mask, TAR_DO_LIST_ATTR, get_file_callback, false, true); > client_set_cur_dir(old_dir); >+ ++tar_numdir; > } else { > rc = tar_get_file(&tar_ctx, remote_name, finfo); > if (rc != 0) { >*************** >*** 889,897 **** > size_t len; > uint64_t off = 0; > uint16_t remote_fd = (uint16_t)-1; >! int err = 0, r; > const bool isdir = finfo->mode & FILE_ATTRIBUTE_DIRECTORY; > TALLOC_CTX *ctx = talloc_new(NULL); > if (ctx == NULL) { > return 1; > } >--- 897,907 ---- > size_t len; > uint64_t off = 0; > uint16_t remote_fd = (uint16_t)-1; >! int err = 0, r, this_time; > const bool isdir = finfo->mode & FILE_ATTRIBUTE_DIRECTORY; > TALLOC_CTX *ctx = talloc_new(NULL); >+ struct timespec tp_start, tp_end; >+ > if (ctx == NULL) { > return 1; > } >*************** >*** 939,963 **** > > archive_entry_set_size(entry, (int64_t)finfo->size); > >- r = archive_write_header(t->archive, entry); >- if (r != ARCHIVE_OK) { >- DBG(0, ("Fatal: %s\n", archive_error_string(t->archive))); >- err = 1; >- goto out_entry; >- } >- > if (isdir) { > DBG(5, ("get_file skip dir %s\n", full_dos_path)); > goto out_entry; > } > > status = cli_open(cli, full_dos_path, O_RDONLY, DENY_NONE, &remote_fd); > if (!NT_STATUS_IS_OK(status)) { >! DBG(0,("%s opening remote file %s\n", > nt_errstr(status), full_dos_path)); > goto out_entry; > } > > do { > status = cli_read(cli, remote_fd, buf, off, sizeof(buf), &len); > if (!NT_STATUS_IS_OK(status)) { >--- 949,985 ---- > > archive_entry_set_size(entry, (int64_t)finfo->size); > > if (isdir) { >+ /* It's a directory just write a header */ >+ r = archive_write_header(t->archive, entry); >+ if (ARCHIVE_OK != r) { >+ DBG(0, ("Fatal: %s\n", archive_error_string(t->archive))); >+ err = 1; >+ } >+ if (t->mode.verbose) { >+ DEBUG(0,(" directory %s\n", full_dos_path)); >+ } > DBG(5, ("get_file skip dir %s\n", full_dos_path)); > goto out_entry; > } > > status = cli_open(cli, full_dos_path, O_RDONLY, DENY_NONE, &remote_fd); > if (!NT_STATUS_IS_OK(status)) { >! DEBUG(0,("%s opening remote file %s\n", > nt_errstr(status), full_dos_path)); > goto out_entry; > } > >+ /* don't make tar file entry until after the file is open */ >+ r = archive_write_header(t->archive, entry); >+ if (r != ARCHIVE_OK) { >+ DBG(0, ("Fatal: %s\n", archive_error_string(t->archive))); >+ err = 1; >+ goto out_entry; >+ } >+ >+ clock_gettime_mono(&tp_start); /* start timing transfer */ >+ > do { > status = cli_read(cli, remote_fd, buf, off, sizeof(buf), &len); > if (!NT_STATUS_IS_OK(status)) { >*************** >*** 977,982 **** >--- 999,1014 ---- > } > > } while (off < finfo->size); >+ ++tar_numfile; >+ clock_gettime_mono(&tp_end); >+ if (t->mode.verbose) { >+ this_time = (tp_end.tv_sec - tp_start.tv_sec) * 1000 >+ + (tp_end.tv_nsec - tp_start.tv_nsec) / 1000000; >+ DEBUG(0, ("%12.0f (%7.1f kb/s) %s\n", >+ (double)finfo->size, >+ finfo->size / MAX(0.001, (1.024*this_time)), >+ full_dos_path)); >+ } > > out_close: > cli_close(cli, remote_fd);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 11642
: 11733 |
11734
|
12263