mirror of
https://github.com/jarun/advcpmv.git
synced 2026-02-01 13:17:41 +01:00
fix progressbars not showing when moving files and global progress
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
diff -aur coreutils-8.32/src/copy.c coreutils-8.32-patched-nc/src/copy.c
|
||||
diff -aur coreutils-8.32/src/copy.c coreutils-8.32-patched/src/copy.c
|
||||
--- coreutils-8.32/src/copy.c 2020-01-01 15:13:12.000000000 +0100
|
||||
+++ coreutils-8.32-patched-nc/src/copy.c 2022-02-14 21:14:14.171156659 +0100
|
||||
+++ coreutils-8.32-patched/src/copy.c 2022-04-03 21:03:04.869415222 +0200
|
||||
@@ -129,6 +129,133 @@
|
||||
dev_t dev;
|
||||
};
|
||||
@@ -135,7 +135,7 @@ diff -aur coreutils-8.32/src/copy.c coreutils-8.32-patched-nc/src/copy.c
|
||||
/* Initial size of the cp.dest_info hash table. */
|
||||
#define DEST_INFO_INITIAL_CAPACITY 61
|
||||
|
||||
@@ -258,18 +385,124 @@
|
||||
@@ -258,18 +385,125 @@
|
||||
bytes read. */
|
||||
static bool
|
||||
sparse_copy (int src_fd, int dest_fd, char *buf, size_t buf_size,
|
||||
@@ -204,11 +204,13 @@ diff -aur coreutils-8.32/src/copy.c coreutils-8.32-patched-nc/src/copy.c
|
||||
+ format_time(f_ttime, sec_remaining, true);
|
||||
+ format_time(f_ftime, sec_fremaining, true);
|
||||
+
|
||||
+ sprintf ( s_progress->cProgressField[1],
|
||||
+ int fs_len;
|
||||
+ fs_len = sprintf ( s_progress->cProgressField[1],
|
||||
+ move_mode
|
||||
+ ? "%d of %d files moved (about %s remaining) "
|
||||
+ : "%d of %d files copied (about %s remaining) ",
|
||||
+ ? "%d of %d files moved (about %s remaining)"
|
||||
+ : "%d of %d files copied (about %s remaining)",
|
||||
+ g_iFilesCopied, g_iTotalFiles, f_ttime );
|
||||
+ s_progress->cProgressField[1][fs_len] = ' ';
|
||||
+
|
||||
+ char s_ftime[40] = "";
|
||||
+
|
||||
@@ -222,7 +224,6 @@ diff -aur coreutils-8.32/src/copy.c coreutils-8.32-patched-nc/src/copy.c
|
||||
+ ? "moving at %s/s %s"
|
||||
+ : "copying at %s/s %s", s_copy_speed, s_ftime );
|
||||
+
|
||||
+ int fs_len;
|
||||
+ if ( g_iTotalFiles > 1 )
|
||||
+ {
|
||||
+ /* global progress bar */
|
||||
@@ -262,7 +263,7 @@ diff -aur coreutils-8.32/src/copy.c coreutils-8.32-patched-nc/src/copy.c
|
||||
ssize_t n_read = read (src_fd, buf, MIN (max_n_read, buf_size));
|
||||
if (n_read < 0)
|
||||
{
|
||||
@@ -354,6 +587,14 @@
|
||||
@@ -354,6 +588,14 @@
|
||||
certain files in /proc or /sys with linux kernels. */
|
||||
}
|
||||
|
||||
@@ -277,7 +278,7 @@ diff -aur coreutils-8.32/src/copy.c coreutils-8.32-patched-nc/src/copy.c
|
||||
/* Ensure a trailing hole is created, so that subsequent
|
||||
calls of sparse_copy() start at the correct offset. */
|
||||
if (make_hole && ! create_hole (dest_fd, dst_name, punch_holes, psize))
|
||||
@@ -420,9 +661,11 @@
|
||||
@@ -420,9 +662,11 @@
|
||||
static bool
|
||||
extent_copy (int src_fd, int dest_fd, char *buf, size_t buf_size,
|
||||
size_t hole_size, off_t src_total_size,
|
||||
@@ -291,7 +292,7 @@ diff -aur coreutils-8.32/src/copy.c coreutils-8.32-patched-nc/src/copy.c
|
||||
{
|
||||
struct extent_scan scan;
|
||||
off_t last_ext_start = 0;
|
||||
@@ -553,10 +796,16 @@
|
||||
@@ -553,10 +797,16 @@
|
||||
last_ext_len = ext_len;
|
||||
bool read_hole;
|
||||
|
||||
@@ -310,7 +311,7 @@ diff -aur coreutils-8.32/src/copy.c coreutils-8.32-patched-nc/src/copy.c
|
||||
goto fail;
|
||||
|
||||
dest_pos = ext_start + n_read;
|
||||
@@ -1305,6 +1554,75 @@
|
||||
@@ -1305,6 +1555,75 @@
|
||||
buf_alloc = xmalloc (buf_size + buf_alignment);
|
||||
buf = ptr_align (buf_alloc, buf_alignment);
|
||||
|
||||
@@ -386,7 +387,7 @@ diff -aur coreutils-8.32/src/copy.c coreutils-8.32-patched-nc/src/copy.c
|
||||
if (sparse_src)
|
||||
{
|
||||
bool normal_copy_required;
|
||||
@@ -1316,7 +1634,9 @@
|
||||
@@ -1316,7 +1635,9 @@
|
||||
if (extent_copy (source_desc, dest_desc, buf, buf_size, hole_size,
|
||||
src_open_sb.st_size,
|
||||
make_holes ? x->sparse_mode : SPARSE_NEVER,
|
||||
@@ -397,7 +398,7 @@ diff -aur coreutils-8.32/src/copy.c coreutils-8.32-patched-nc/src/copy.c
|
||||
goto preserve_metadata;
|
||||
|
||||
if (! normal_copy_required)
|
||||
@@ -1328,11 +1648,14 @@
|
||||
@@ -1328,11 +1649,14 @@
|
||||
|
||||
off_t n_read;
|
||||
bool wrote_hole_at_eof;
|
||||
@@ -415,7 +416,7 @@ diff -aur coreutils-8.32/src/copy.c coreutils-8.32-patched-nc/src/copy.c
|
||||
{
|
||||
return_val = false;
|
||||
goto close_src_and_dst_desc;
|
||||
@@ -1343,6 +1666,12 @@
|
||||
@@ -1343,6 +1667,12 @@
|
||||
return_val = false;
|
||||
goto close_src_and_dst_desc;
|
||||
}
|
||||
@@ -428,7 +429,7 @@ diff -aur coreutils-8.32/src/copy.c coreutils-8.32-patched-nc/src/copy.c
|
||||
}
|
||||
|
||||
preserve_metadata:
|
||||
@@ -1716,15 +2045,15 @@
|
||||
@@ -1716,15 +2046,15 @@
|
||||
fprintf (stderr,
|
||||
(x->move_mode || x->unlink_dest_before_opening
|
||||
|| x->unlink_dest_after_failed_open)
|
||||
@@ -447,9 +448,9 @@ diff -aur coreutils-8.32/src/copy.c coreutils-8.32-patched-nc/src/copy.c
|
||||
program_name, quoteaf (dst_name));
|
||||
}
|
||||
|
||||
diff -aur coreutils-8.32/src/copy.h coreutils-8.32-patched-nc/src/copy.h
|
||||
diff -aur coreutils-8.32/src/copy.h coreutils-8.32-patched/src/copy.h
|
||||
--- coreutils-8.32/src/copy.h 2020-01-01 15:13:12.000000000 +0100
|
||||
+++ coreutils-8.32-patched-nc/src/copy.h 2022-02-14 21:14:14.175156795 +0100
|
||||
+++ coreutils-8.32-patched/src/copy.h 2022-04-03 21:03:04.873415280 +0200
|
||||
@@ -234,6 +234,9 @@
|
||||
Create destination directories as usual. */
|
||||
bool symbolic_link;
|
||||
@@ -483,9 +484,9 @@ diff -aur coreutils-8.32/src/copy.h coreutils-8.32-patched-nc/src/copy.h
|
||||
+/* END progress mod */
|
||||
+
|
||||
#endif
|
||||
diff -aur coreutils-8.32/src/cp.c coreutils-8.32-patched-nc/src/cp.c
|
||||
diff -aur coreutils-8.32/src/cp.c coreutils-8.32-patched/src/cp.c
|
||||
--- coreutils-8.32/src/cp.c 2020-01-01 15:13:12.000000000 +0100
|
||||
+++ coreutils-8.32-patched-nc/src/cp.c 2022-02-14 21:14:14.175156795 +0100
|
||||
+++ coreutils-8.32-patched/src/cp.c 2022-04-03 21:03:04.873415280 +0200
|
||||
@@ -131,6 +131,7 @@
|
||||
{"symbolic-link", no_argument, NULL, 's'},
|
||||
{"target-directory", required_argument, NULL, 't'},
|
||||
@@ -674,9 +675,9 @@ diff -aur coreutils-8.32/src/cp.c coreutils-8.32-patched-nc/src/cp.c
|
||||
case 'H':
|
||||
x.dereference = DEREF_COMMAND_LINE_ARGUMENTS;
|
||||
break;
|
||||
diff -aur coreutils-8.32/src/mv.c coreutils-8.32-patched-nc/src/mv.c
|
||||
diff -aur coreutils-8.32/src/mv.c coreutils-8.32-patched/src/mv.c
|
||||
--- coreutils-8.32/src/mv.c 2020-01-01 15:13:12.000000000 +0100
|
||||
+++ coreutils-8.32-patched-nc/src/mv.c 2022-02-14 21:14:14.175156795 +0100
|
||||
+++ coreutils-8.32-patched/src/mv.c 2022-04-03 21:03:04.873415280 +0200
|
||||
@@ -66,6 +66,7 @@
|
||||
{"target-directory", required_argument, NULL, 't'},
|
||||
{"update", no_argument, NULL, 'u'},
|
||||
|
||||
Reference in New Issue
Block a user