mirror of
https://github.com/jarun/advcpmv.git
synced 2026-02-01 13:17:41 +01:00
backport changes to 8.32 patch
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
diff -aur coreutils-8.32/src/copy.c coreutils-8.32-patched/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/src/copy.c 2020-01-01 15:13:12.000000000 +0100
|
||||||
+++ coreutils-8.32-patched/src/copy.c 2022-01-04 21:56:14.545035647 +0100
|
+++ coreutils-8.32-patched/src/copy.c 2022-01-12 20:08:19.573923682 +0100
|
||||||
@@ -129,6 +129,119 @@
|
@@ -129,6 +129,121 @@
|
||||||
dev_t dev;
|
dev_t dev;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -39,28 +39,30 @@ diff -aur coreutils-8.32/src/copy.c coreutils-8.32-patched/src/copy.c
|
|||||||
+ return _cEscapedString;
|
+ return _cEscapedString;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+char * format_elapsed_time ( double sec_elapsed )
|
+void format_time ( char * _cDest, double seconds, bool showall )
|
||||||
+{
|
+{
|
||||||
+ // hours
|
+ // hours
|
||||||
+ long hr = ( (int) sec_elapsed / (60 * 60)) % 24;
|
+ int hr = ( (int) seconds / (60 * 60)) % 24;
|
||||||
+ // minutes
|
+ // minutes
|
||||||
+ int min = ( (int) sec_elapsed / 60) % 60;
|
+ int min = ( (int) seconds / 60) % 60;
|
||||||
+ // seconds
|
+ // seconds
|
||||||
+ double sec = sec_elapsed - (hr * (60 * 60)) - (min * 60);
|
+ double sec = seconds - (hr * (60 * 60)) - (min * 60);
|
||||||
+ size_t maxneeded = snprintf(NULL, 0, "%ldh %dm %.1fs", hr, min, sec) + 1;
|
+ if ( showall )
|
||||||
+ char * _cElapsedTimeString;
|
|
||||||
+ _cElapsedTimeString = (char *) calloc( sizeof(char) * maxneeded, sizeof(char) );
|
|
||||||
+ if ( sec_elapsed >= 3600 )
|
|
||||||
+ {
|
+ {
|
||||||
+ sprintf(_cElapsedTimeString, "%ldh %dm %.1fs", hr, min, sec);
|
+ if ( seconds < 0 )
|
||||||
+ } else if ( sec_elapsed >= 60 )
|
+ sprintf(_cDest, "%2ch %2cm %2cs", '0', '0', '?');
|
||||||
|
+ else
|
||||||
|
+ sprintf(_cDest, "%2dh %2dm %2ds", hr, min, (int) sec);
|
||||||
|
+ } else if ( seconds >= 3600 )
|
||||||
+ {
|
+ {
|
||||||
+ sprintf(_cElapsedTimeString, "%dm %.1fs", min, sec);
|
+ sprintf(_cDest, "%2dh %2dm %4.1fs", hr, min, sec);
|
||||||
|
+ } else if ( seconds >= 60 )
|
||||||
|
+ {
|
||||||
|
+ sprintf(_cDest, "%2dm %4.1fs", min, sec);
|
||||||
+ } else
|
+ } else
|
||||||
+ {
|
+ {
|
||||||
+ sprintf(_cElapsedTimeString, "%.1fs", sec);
|
+ sprintf(_cDest, "%4.1fs", sec);
|
||||||
+ }
|
+ }
|
||||||
+ return _cElapsedTimeString;
|
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static void file_progress_bar ( char * _cDest, int _iBarLength, long _lProgress, long _lTotal )
|
+static void file_progress_bar ( char * _cDest, int _iBarLength, long _lProgress, long _lTotal )
|
||||||
@@ -121,7 +123,7 @@ diff -aur coreutils-8.32/src/copy.c coreutils-8.32-patched/src/copy.c
|
|||||||
/* Initial size of the cp.dest_info hash table. */
|
/* Initial size of the cp.dest_info hash table. */
|
||||||
#define DEST_INFO_INITIAL_CAPACITY 61
|
#define DEST_INFO_INITIAL_CAPACITY 61
|
||||||
|
|
||||||
@@ -259,9 +372,16 @@
|
@@ -259,17 +374,129 @@
|
||||||
static bool
|
static bool
|
||||||
sparse_copy (int src_fd, int dest_fd, char *buf, size_t buf_size,
|
sparse_copy (int src_fd, int dest_fd, char *buf, size_t buf_size,
|
||||||
size_t hole_size, bool punch_holes,
|
size_t hole_size, bool punch_holes,
|
||||||
@@ -139,8 +141,17 @@ diff -aur coreutils-8.32/src/copy.c coreutils-8.32-patched/src/copy.c
|
|||||||
{
|
{
|
||||||
*last_write_made_hole = false;
|
*last_write_made_hole = false;
|
||||||
*total_n_read = 0;
|
*total_n_read = 0;
|
||||||
@@ -270,6 +390,85 @@
|
bool make_hole = false;
|
||||||
|
off_t psize = 0;
|
||||||
|
|
||||||
|
+ /* BEGIN progress mod */
|
||||||
|
+ gettimeofday ( & g_oFStartTime, NULL );
|
||||||
|
+ g_iFTotalWritten = 0;
|
||||||
|
+ struct stat st;
|
||||||
|
+ stat(src_name, &st);
|
||||||
|
+ g_iFTotalSize = st.st_size/1024;
|
||||||
|
+ /* END progress mod */
|
||||||
|
+
|
||||||
while (max_n_read)
|
while (max_n_read)
|
||||||
{
|
{
|
||||||
+
|
+
|
||||||
@@ -159,6 +170,7 @@ diff -aur coreutils-8.32/src/copy.c coreutils-8.32-patched/src/copy.c
|
|||||||
+ struct timeval cur_time;
|
+ struct timeval cur_time;
|
||||||
+ gettimeofday ( & cur_time, NULL );
|
+ gettimeofday ( & cur_time, NULL );
|
||||||
+ int cur_size = g_iTotalWritten + *total_n_read / 1024;
|
+ int cur_size = g_iTotalWritten + *total_n_read / 1024;
|
||||||
|
+ int cur_fsize = g_iFTotalWritten + *total_n_read / 1024;
|
||||||
+ int usec_elapsed = cur_time.tv_usec - s_progress->last_time.tv_usec;
|
+ int usec_elapsed = cur_time.tv_usec - s_progress->last_time.tv_usec;
|
||||||
+ double sec_elapsed = ( double ) usec_elapsed / 1000000.f;
|
+ double sec_elapsed = ( double ) usec_elapsed / 1000000.f;
|
||||||
+ sec_elapsed += ( double ) ( cur_time.tv_sec - s_progress->last_time.tv_sec );
|
+ sec_elapsed += ( double ) ( cur_time.tv_sec - s_progress->last_time.tv_sec );
|
||||||
@@ -172,18 +184,35 @@ diff -aur coreutils-8.32/src/copy.c coreutils-8.32-patched/src/copy.c
|
|||||||
+
|
+
|
||||||
+ /* how many time has passed since the start? */
|
+ /* how many time has passed since the start? */
|
||||||
+ int isec_elapsed = cur_time.tv_sec - g_oStartTime.tv_sec;
|
+ int isec_elapsed = cur_time.tv_sec - g_oStartTime.tv_sec;
|
||||||
|
+ int isec_felapsed = cur_time.tv_sec - g_oFStartTime.tv_sec;
|
||||||
+ int sec_remaining = ( int ) ( ( double ) isec_elapsed / cur_size
|
+ int sec_remaining = ( int ) ( ( double ) isec_elapsed / cur_size
|
||||||
+ * g_iTotalSize ) - isec_elapsed;
|
+ * g_iTotalSize ) - isec_elapsed;
|
||||||
+ int min_remaining = sec_remaining / 60;
|
+ int sec_fremaining = ( int ) ( ( double ) isec_felapsed / cur_fsize
|
||||||
+ sec_remaining -= min_remaining * 60;
|
+ * g_iFTotalSize ) - isec_felapsed;
|
||||||
+ int hours_remaining = min_remaining / 60;
|
|
||||||
+ min_remaining -= hours_remaining * 60;
|
|
||||||
+ /* print out */
|
+ /* print out */
|
||||||
|
+
|
||||||
|
+ char f_ttime[20];
|
||||||
|
+ char f_ftime[20];
|
||||||
|
+ format_time(f_ttime, sec_remaining, true);
|
||||||
|
+ format_time(f_ftime, sec_fremaining, true);
|
||||||
|
+
|
||||||
|
+ sprintf ( s_progress->cProgressField[1],
|
||||||
|
+ move_mode
|
||||||
|
+ ? "%d of %d files moved (about %s remaining) "
|
||||||
|
+ : "%d of %d files copied (about %s remaining) ",
|
||||||
|
+ g_iFilesCopied, g_iTotalFiles, f_ttime );
|
||||||
|
+
|
||||||
|
+ char s_ftime[40] = "";
|
||||||
|
+
|
||||||
|
+ if (g_iTotalFiles > 1)
|
||||||
|
+ sprintf ( s_ftime, "(about %s remaining)", f_ftime );
|
||||||
|
+ else
|
||||||
|
+ sprintf ( s_ftime, "(about %s remaining)", f_ttime );
|
||||||
|
+
|
||||||
+ sprintf ( s_progress->cProgressField[3],
|
+ sprintf ( s_progress->cProgressField[3],
|
||||||
+ move_mode
|
+ move_mode
|
||||||
+ ? "moving at %s/s (about %uh %um %us remaining)"
|
+ ? "moving at %s/s %s"
|
||||||
+ : "copying at %s/s (about %uh %um %us remaining)", s_copy_speed,
|
+ : "copying at %s/s %s", s_copy_speed, s_ftime );
|
||||||
+ hours_remaining, min_remaining, sec_remaining );
|
|
||||||
+
|
+
|
||||||
+ int fs_len;
|
+ int fs_len;
|
||||||
+ if ( g_iTotalFiles > 1 )
|
+ if ( g_iTotalFiles > 1 )
|
||||||
@@ -225,7 +254,7 @@ diff -aur coreutils-8.32/src/copy.c coreutils-8.32-patched/src/copy.c
|
|||||||
ssize_t n_read = read (src_fd, buf, MIN (max_n_read, buf_size));
|
ssize_t n_read = read (src_fd, buf, MIN (max_n_read, buf_size));
|
||||||
if (n_read < 0)
|
if (n_read < 0)
|
||||||
{
|
{
|
||||||
@@ -354,6 +553,14 @@
|
@@ -354,6 +581,14 @@
|
||||||
certain files in /proc or /sys with linux kernels. */
|
certain files in /proc or /sys with linux kernels. */
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -240,7 +269,7 @@ diff -aur coreutils-8.32/src/copy.c coreutils-8.32-patched/src/copy.c
|
|||||||
/* Ensure a trailing hole is created, so that subsequent
|
/* Ensure a trailing hole is created, so that subsequent
|
||||||
calls of sparse_copy() start at the correct offset. */
|
calls of sparse_copy() start at the correct offset. */
|
||||||
if (make_hole && ! create_hole (dest_fd, dst_name, punch_holes, psize))
|
if (make_hole && ! create_hole (dest_fd, dst_name, punch_holes, psize))
|
||||||
@@ -421,8 +628,16 @@
|
@@ -421,8 +656,16 @@
|
||||||
extent_copy (int src_fd, int dest_fd, char *buf, size_t buf_size,
|
extent_copy (int src_fd, int dest_fd, char *buf, size_t buf_size,
|
||||||
size_t hole_size, off_t src_total_size,
|
size_t hole_size, off_t src_total_size,
|
||||||
enum Sparse_type sparse_mode,
|
enum Sparse_type sparse_mode,
|
||||||
@@ -258,7 +287,7 @@ diff -aur coreutils-8.32/src/copy.c coreutils-8.32-patched/src/copy.c
|
|||||||
{
|
{
|
||||||
struct extent_scan scan;
|
struct extent_scan scan;
|
||||||
off_t last_ext_start = 0;
|
off_t last_ext_start = 0;
|
||||||
@@ -553,10 +768,26 @@
|
@@ -553,10 +796,26 @@
|
||||||
last_ext_len = ext_len;
|
last_ext_len = ext_len;
|
||||||
bool read_hole;
|
bool read_hole;
|
||||||
|
|
||||||
@@ -287,7 +316,7 @@ diff -aur coreutils-8.32/src/copy.c coreutils-8.32-patched/src/copy.c
|
|||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
dest_pos = ext_start + n_read;
|
dest_pos = ext_start + n_read;
|
||||||
@@ -1305,6 +1536,75 @@
|
@@ -1305,6 +1564,75 @@
|
||||||
buf_alloc = xmalloc (buf_size + buf_alignment);
|
buf_alloc = xmalloc (buf_size + buf_alignment);
|
||||||
buf = ptr_align (buf_alloc, buf_alignment);
|
buf = ptr_align (buf_alloc, buf_alignment);
|
||||||
|
|
||||||
@@ -327,10 +356,10 @@ diff -aur coreutils-8.32/src/copy.c coreutils-8.32-patched/src/copy.c
|
|||||||
+
|
+
|
||||||
+ /* show how many files were written */
|
+ /* show how many files were written */
|
||||||
+ int sum_length = 0;
|
+ int sum_length = 0;
|
||||||
+ if ( x->move_mode )
|
+ sum_length = sprintf ( cProgressField[1],
|
||||||
+ sum_length = sprintf ( cProgressField[1], "%d files moved so far...", g_iFilesCopied );
|
+ x->move_mode
|
||||||
+ else
|
+ ? "%d of %d files moved so far"
|
||||||
+ sum_length = sprintf ( cProgressField[1], "%d files copied so far...", g_iFilesCopied );
|
+ : "%d of %d files copied so far", g_iFilesCopied, g_iTotalFiles );
|
||||||
+ cProgressField[1][sum_length] = ' ';
|
+ cProgressField[1][sum_length] = ' ';
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
@@ -363,7 +392,7 @@ diff -aur coreutils-8.32/src/copy.c coreutils-8.32-patched/src/copy.c
|
|||||||
if (sparse_src)
|
if (sparse_src)
|
||||||
{
|
{
|
||||||
bool normal_copy_required;
|
bool normal_copy_required;
|
||||||
@@ -1316,7 +1616,15 @@
|
@@ -1316,7 +1644,15 @@
|
||||||
if (extent_copy (source_desc, dest_desc, buf, buf_size, hole_size,
|
if (extent_copy (source_desc, dest_desc, buf, buf_size, hole_size,
|
||||||
src_open_sb.st_size,
|
src_open_sb.st_size,
|
||||||
make_holes ? x->sparse_mode : SPARSE_NEVER,
|
make_holes ? x->sparse_mode : SPARSE_NEVER,
|
||||||
@@ -380,7 +409,7 @@ diff -aur coreutils-8.32/src/copy.c coreutils-8.32-patched/src/copy.c
|
|||||||
goto preserve_metadata;
|
goto preserve_metadata;
|
||||||
|
|
||||||
if (! normal_copy_required)
|
if (! normal_copy_required)
|
||||||
@@ -1328,11 +1636,24 @@
|
@@ -1328,11 +1664,24 @@
|
||||||
|
|
||||||
off_t n_read;
|
off_t n_read;
|
||||||
bool wrote_hole_at_eof;
|
bool wrote_hole_at_eof;
|
||||||
@@ -407,7 +436,7 @@ diff -aur coreutils-8.32/src/copy.c coreutils-8.32-patched/src/copy.c
|
|||||||
{
|
{
|
||||||
return_val = false;
|
return_val = false;
|
||||||
goto close_src_and_dst_desc;
|
goto close_src_and_dst_desc;
|
||||||
@@ -1343,6 +1664,14 @@
|
@@ -1343,6 +1692,14 @@
|
||||||
return_val = false;
|
return_val = false;
|
||||||
goto close_src_and_dst_desc;
|
goto close_src_and_dst_desc;
|
||||||
}
|
}
|
||||||
@@ -422,7 +451,7 @@ diff -aur coreutils-8.32/src/copy.c coreutils-8.32-patched/src/copy.c
|
|||||||
}
|
}
|
||||||
|
|
||||||
preserve_metadata:
|
preserve_metadata:
|
||||||
@@ -1716,15 +2045,19 @@
|
@@ -1716,15 +2073,19 @@
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
(x->move_mode || x->unlink_dest_before_opening
|
(x->move_mode || x->unlink_dest_before_opening
|
||||||
|| x->unlink_dest_after_failed_open)
|
|| x->unlink_dest_after_failed_open)
|
||||||
@@ -447,7 +476,7 @@ diff -aur coreutils-8.32/src/copy.c coreutils-8.32-patched/src/copy.c
|
|||||||
|
|
||||||
diff -aur coreutils-8.32/src/copy.h coreutils-8.32-patched/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/src/copy.h 2020-01-01 15:13:12.000000000 +0100
|
||||||
+++ coreutils-8.32-patched/src/copy.h 2022-01-04 21:56:14.545035647 +0100
|
+++ coreutils-8.32-patched/src/copy.h 2022-01-12 20:08:19.577923660 +0100
|
||||||
@@ -234,6 +234,11 @@
|
@@ -234,6 +234,11 @@
|
||||||
Create destination directories as usual. */
|
Create destination directories as usual. */
|
||||||
bool symbolic_link;
|
bool symbolic_link;
|
||||||
@@ -460,21 +489,24 @@ diff -aur coreutils-8.32/src/copy.h coreutils-8.32-patched/src/copy.h
|
|||||||
/* If true, do not copy a nondirectory that has an existing destination
|
/* If true, do not copy a nondirectory that has an existing destination
|
||||||
with the same or newer modification time. */
|
with the same or newer modification time. */
|
||||||
bool update;
|
bool update;
|
||||||
@@ -304,4 +309,19 @@
|
@@ -304,4 +309,22 @@
|
||||||
bool chown_failure_ok (struct cp_options const *) _GL_ATTRIBUTE_PURE;
|
bool chown_failure_ok (struct cp_options const *) _GL_ATTRIBUTE_PURE;
|
||||||
mode_t cached_umask (void);
|
mode_t cached_umask (void);
|
||||||
|
|
||||||
+/* BEGIN progress mod */
|
+/* BEGIN progress mod */
|
||||||
+char * escape_double_quotes ( char * _cUnescapedString );
|
+char * escape_double_quotes ( char * _cUnescapedString );
|
||||||
+char * format_elapsed_time ( double sec_elapsed );
|
+void format_time ( char * _cDst, double seconds, bool showall );
|
||||||
+
|
+
|
||||||
+int file_size_format ( char * _cDst, long _lSize, int _iCounter );
|
+int file_size_format ( char * _cDst, long _lSize, int _iCounter );
|
||||||
+
|
+
|
||||||
+__attribute__((__common__)) long g_iTotalSize;
|
+__attribute__((__common__)) long g_iTotalSize;
|
||||||
|
+__attribute__((__common__)) long g_iFTotalSize;
|
||||||
+__attribute__((__common__)) long g_iTotalWritten;
|
+__attribute__((__common__)) long g_iTotalWritten;
|
||||||
|
+__attribute__((__common__)) long g_iFTotalWritten;
|
||||||
+__attribute__((__common__)) int g_iFilesCopied;
|
+__attribute__((__common__)) int g_iFilesCopied;
|
||||||
+__attribute__((__common__)) int g_iDirectoriesCopied;
|
+__attribute__((__common__)) int g_iDirectoriesCopied;
|
||||||
+__attribute__((__common__)) struct timeval g_oStartTime;
|
+__attribute__((__common__)) struct timeval g_oStartTime;
|
||||||
|
+__attribute__((__common__)) struct timeval g_oFStartTime;
|
||||||
+__attribute__((__common__)) int g_iTotalFiles;
|
+__attribute__((__common__)) int g_iTotalFiles;
|
||||||
+__attribute__((__common__)) bool progress;
|
+__attribute__((__common__)) bool progress;
|
||||||
+/* END progress mod */
|
+/* END progress mod */
|
||||||
@@ -482,7 +514,7 @@ diff -aur coreutils-8.32/src/copy.h coreutils-8.32-patched/src/copy.h
|
|||||||
#endif
|
#endif
|
||||||
diff -aur coreutils-8.32/src/cp.c coreutils-8.32-patched/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/src/cp.c 2020-01-01 15:13:12.000000000 +0100
|
||||||
+++ coreutils-8.32-patched/src/cp.c 2022-01-04 21:56:14.545035647 +0100
|
+++ coreutils-8.32-patched/src/cp.c 2022-01-12 20:08:19.577923660 +0100
|
||||||
@@ -131,6 +131,9 @@
|
@@ -131,6 +131,9 @@
|
||||||
{"symbolic-link", no_argument, NULL, 's'},
|
{"symbolic-link", no_argument, NULL, 's'},
|
||||||
{"target-directory", required_argument, NULL, 't'},
|
{"target-directory", required_argument, NULL, 't'},
|
||||||
@@ -591,7 +623,7 @@ diff -aur coreutils-8.32/src/cp.c coreutils-8.32-patched/src/cp.c
|
|||||||
|
|
||||||
if (target_directory)
|
if (target_directory)
|
||||||
{
|
{
|
||||||
@@ -777,6 +864,53 @@
|
@@ -777,6 +864,56 @@
|
||||||
ok = copy (source, new_dest, 0, x, &unused, NULL);
|
ok = copy (source, new_dest, 0, x, &unused, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -637,25 +669,30 @@ diff -aur coreutils-8.32/src/cp.c coreutils-8.32-patched/src/cp.c
|
|||||||
+ sprintf ( sFType, "%s", "folder(s)/file(s)" );
|
+ sprintf ( sFType, "%s", "folder(s)/file(s)" );
|
||||||
+ else
|
+ else
|
||||||
+ sprintf ( sFType, "%s", "file(s)" );
|
+ sprintf ( sFType, "%s", "file(s)" );
|
||||||
|
+
|
||||||
|
+ char f_time[20];
|
||||||
|
+ format_time(f_time, sec_elapsed, true);
|
||||||
+ printf ( "%d %s (%s) copied in %s (%s/s).\n", g_iFilesCopied, sFType,
|
+ printf ( "%d %s (%s) copied in %s (%s/s).\n", g_iFilesCopied, sFType,
|
||||||
+ sTotalWritten, format_elapsed_time(sec_elapsed), s_copy_speed );
|
+ sTotalWritten, f_time, s_copy_speed );
|
||||||
+ }
|
+ }
|
||||||
+ /* END progress mod */
|
+ /* END progress mod */
|
||||||
+
|
+
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -812,6 +946,9 @@
|
@@ -812,6 +949,11 @@
|
||||||
x->recursive = false;
|
x->recursive = false;
|
||||||
x->sparse_mode = SPARSE_AUTO;
|
x->sparse_mode = SPARSE_AUTO;
|
||||||
x->symbolic_link = false;
|
x->symbolic_link = false;
|
||||||
|
+
|
||||||
+ /* BEGIN progress mod */
|
+ /* BEGIN progress mod */
|
||||||
+ x->progress_bar = false;
|
+ x->progress_bar = false;
|
||||||
+ /* END progress mod */
|
+ /* END progress mod */
|
||||||
|
+
|
||||||
x->set_mode = false;
|
x->set_mode = false;
|
||||||
x->mode = 0;
|
x->mode = 0;
|
||||||
|
|
||||||
@@ -950,7 +1087,8 @@
|
@@ -950,7 +1092,8 @@
|
||||||
selinux_enabled = (0 < is_selinux_enabled ());
|
selinux_enabled = (0 < is_selinux_enabled ());
|
||||||
cp_option_init (&x);
|
cp_option_init (&x);
|
||||||
|
|
||||||
@@ -665,7 +702,7 @@ diff -aur coreutils-8.32/src/cp.c coreutils-8.32-patched/src/cp.c
|
|||||||
long_opts, NULL))
|
long_opts, NULL))
|
||||||
!= -1)
|
!= -1)
|
||||||
{
|
{
|
||||||
@@ -1007,6 +1145,12 @@
|
@@ -1007,6 +1150,12 @@
|
||||||
x.unlink_dest_after_failed_open = true;
|
x.unlink_dest_after_failed_open = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -680,7 +717,7 @@ diff -aur coreutils-8.32/src/cp.c coreutils-8.32-patched/src/cp.c
|
|||||||
break;
|
break;
|
||||||
diff -aur coreutils-8.32/src/mv.c coreutils-8.32-patched/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/src/mv.c 2020-01-01 15:13:12.000000000 +0100
|
||||||
+++ coreutils-8.32-patched/src/mv.c 2022-01-04 21:56:14.549035719 +0100
|
+++ coreutils-8.32-patched/src/mv.c 2022-01-12 20:08:19.577923660 +0100
|
||||||
@@ -66,6 +66,9 @@
|
@@ -66,6 +66,9 @@
|
||||||
{"target-directory", required_argument, NULL, 't'},
|
{"target-directory", required_argument, NULL, 't'},
|
||||||
{"update", no_argument, NULL, 'u'},
|
{"update", no_argument, NULL, 'u'},
|
||||||
@@ -691,7 +728,7 @@ diff -aur coreutils-8.32/src/mv.c coreutils-8.32-patched/src/mv.c
|
|||||||
{GETOPT_HELP_OPTION_DECL},
|
{GETOPT_HELP_OPTION_DECL},
|
||||||
{GETOPT_VERSION_OPTION_DECL},
|
{GETOPT_VERSION_OPTION_DECL},
|
||||||
{NULL, 0, NULL, 0}
|
{NULL, 0, NULL, 0}
|
||||||
@@ -170,8 +173,121 @@
|
@@ -170,8 +173,124 @@
|
||||||
{
|
{
|
||||||
bool copy_into_self;
|
bool copy_into_self;
|
||||||
bool rename_succeeded;
|
bool rename_succeeded;
|
||||||
@@ -804,8 +841,11 @@ diff -aur coreutils-8.32/src/mv.c coreutils-8.32-patched/src/mv.c
|
|||||||
+ sprintf ( sFType, "%s", "folder(s)/file(s)" );
|
+ sprintf ( sFType, "%s", "folder(s)/file(s)" );
|
||||||
+ else
|
+ else
|
||||||
+ sprintf ( sFType, "%s", "file(s)" );
|
+ sprintf ( sFType, "%s", "file(s)" );
|
||||||
|
+
|
||||||
|
+ char f_time[20];
|
||||||
|
+ format_time(f_time, sec_elapsed, true);
|
||||||
+ printf ( "%d %s (%s) moved in %s (%s/s).\n", g_iFilesCopied, sFType,
|
+ printf ( "%d %s (%s) moved in %s (%s/s).\n", g_iFilesCopied, sFType,
|
||||||
+ sTotalWritten, format_elapsed_time(sec_elapsed), s_copy_speed );
|
+ sTotalWritten, f_time, s_copy_speed );
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ /* END progress mod */
|
+ /* END progress mod */
|
||||||
@@ -813,7 +853,7 @@ diff -aur coreutils-8.32/src/mv.c coreutils-8.32-patched/src/mv.c
|
|||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
char const *dir_to_remove;
|
char const *dir_to_remove;
|
||||||
@@ -306,6 +422,11 @@
|
@@ -306,6 +425,11 @@
|
||||||
\n\
|
\n\
|
||||||
-b like --backup but does not accept an argument\n\
|
-b like --backup but does not accept an argument\n\
|
||||||
-f, --force do not prompt before overwriting\n\
|
-f, --force do not prompt before overwriting\n\
|
||||||
@@ -825,7 +865,7 @@ diff -aur coreutils-8.32/src/mv.c coreutils-8.32-patched/src/mv.c
|
|||||||
-i, --interactive prompt before overwrite\n\
|
-i, --interactive prompt before overwrite\n\
|
||||||
-n, --no-clobber do not overwrite an existing file\n\
|
-n, --no-clobber do not overwrite an existing file\n\
|
||||||
If you specify more than one of -i, -f, -n, only the final one takes effect.\n\
|
If you specify more than one of -i, -f, -n, only the final one takes effect.\n\
|
||||||
@@ -361,7 +482,8 @@
|
@@ -361,7 +485,8 @@
|
||||||
/* Try to disable the ability to unlink a directory. */
|
/* Try to disable the ability to unlink a directory. */
|
||||||
priv_set_remove_linkdir ();
|
priv_set_remove_linkdir ();
|
||||||
|
|
||||||
@@ -835,7 +875,7 @@ diff -aur coreutils-8.32/src/mv.c coreutils-8.32-patched/src/mv.c
|
|||||||
!= -1)
|
!= -1)
|
||||||
{
|
{
|
||||||
switch (c)
|
switch (c)
|
||||||
@@ -407,6 +529,11 @@
|
@@ -407,6 +532,11 @@
|
||||||
case 'v':
|
case 'v':
|
||||||
x.verbose = true;
|
x.verbose = true;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user