Skip to content

Commit 4eebf13

Browse files
committed
Make size-output fixed length in pg_basebackup verbose mode
This way the line doesn't shift right as the amount of data processed increases.
1 parent d7e9ca7 commit 4eebf13

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/bin/pg_basebackup/pg_basebackup.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -432,9 +432,10 @@ progress_report(int tablespacenum, const char *filename)
432432
* call)
433433
*/
434434
fprintf(stderr,
435-
ngettext("%s/%s kB (100%%), %d/%d tablespace %*s",
436-
"%s/%s kB (100%%), %d/%d tablespaces %*s",
435+
ngettext("%*s/%s kB (100%%), %d/%d tablespace %*s",
436+
"%*s/%s kB (100%%), %d/%d tablespaces %*s",
437437
tablespacecount),
438+
strlen(totalsize_str),
438439
totaldone_str, totalsize_str,
439440
tablespacenum, tablespacecount,
440441
VERBOSE_FILENAME_LENGTH + 5, "");
@@ -443,9 +444,10 @@ progress_report(int tablespacenum, const char *filename)
443444
bool truncate = (strlen(filename) > VERBOSE_FILENAME_LENGTH);
444445

445446
fprintf(stderr,
446-
ngettext("%s/%s kB (%d%%), %d/%d tablespace (%s%-*.*s)",
447-
"%s/%s kB (%d%%), %d/%d tablespaces (%s%-*.*s)",
447+
ngettext("%*s/%s kB (%d%%), %d/%d tablespace (%s%-*.*s)",
448+
"%*s/%s kB (%d%%), %d/%d tablespaces (%s%-*.*s)",
448449
tablespacecount),
450+
strlen(totalsize_str),
449451
totaldone_str, totalsize_str, percent,
450452
tablespacenum, tablespacecount,
451453
/* Prefix with "..." if we do leading truncation */
@@ -458,9 +460,10 @@ progress_report(int tablespacenum, const char *filename)
458460
}
459461
else
460462
fprintf(stderr,
461-
ngettext("%s/%s kB (%d%%), %d/%d tablespace",
462-
"%s/%s kB (%d%%), %d/%d tablespaces",
463+
ngettext("%*s/%s kB (%d%%), %d/%d tablespace",
464+
"%*s/%s kB (%d%%), %d/%d tablespaces",
463465
tablespacecount),
466+
strlen(totalsize_str),
464467
totaldone_str, totalsize_str, percent,
465468
tablespacenum, tablespacecount);
466469

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy