Skip to content

Commit 9effb63

Browse files
committed
Message wording and pluralization improvements
1 parent 6b30d13 commit 9effb63

File tree

10 files changed

+39
-23
lines changed

10 files changed

+39
-23
lines changed

src/backend/access/transam/xlog.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4652,8 +4652,10 @@ ReadControlFile(void)
46524652

46534653
if (!IsValidWalSegSize(wal_segment_size))
46544654
ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
4655-
errmsg("WAL segment size must be a power of two between 1MB and 1GB, but the control file specifies %d bytes",
4656-
wal_segment_size)));
4655+
errmsg_plural("WAL segment size must be a power of two between 1 MB and 1 GB, but the control file specifies %d byte",
4656+
"WAL segment size must be a power of two between 1 MB and 1 GB, but the control file specifies %d bytes",
4657+
wal_segment_size,
4658+
wal_segment_size)));
46574659

46584660
snprintf(wal_segsz_str, sizeof(wal_segsz_str), "%d", wal_segment_size);
46594661
SetConfigOption("wal_segment_size", wal_segsz_str, PGC_INTERNAL,

src/backend/bootstrap/bootstrap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ AuxiliaryProcessMain(int argc, char *argv[])
265265
if (!IsValidWalSegSize(WalSegSz))
266266
ereport(ERROR,
267267
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
268-
errmsg("-X requires a power of 2 value between 1MB and 1GB")));
268+
errmsg("-X requires a power of two value between 1 MB and 1 GB")));
269269
SetConfigOption("wal_segment_size", optarg, PGC_INTERNAL,
270270
PGC_S_OVERRIDE);
271271
}

src/bin/pg_basebackup/pg_basebackup.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2418,8 +2418,8 @@ main(int argc, char **argv)
24182418
if (!replication_slot)
24192419
{
24202420
fprintf(stderr,
2421-
_("%s: --create-slot needs a slot to be specified using --slot\n"),
2422-
progname);
2421+
_("%s: %s needs a slot to be specified using --slot\n"),
2422+
progname, "--create-slot");
24232423
fprintf(stderr, _("Try \"%s --help\" for more information.\n"),
24242424
progname);
24252425
exit(1);

src/bin/pg_basebackup/pg_receivewal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ stop_streaming(XLogRecPtr xlogpos, uint32 timeline, bool segment_finished)
120120
if (!XLogRecPtrIsInvalid(endpos) && endpos < xlogpos)
121121
{
122122
if (verbose)
123-
fprintf(stderr, _("%s: stopped streaming at %X/%X (timeline %u)\n"),
123+
fprintf(stderr, _("%s: stopped log streaming at %X/%X (timeline %u)\n"),
124124
progname, (uint32) (xlogpos >> 32), (uint32) xlogpos,
125125
timeline);
126126
time_to_stop = true;

src/bin/pg_basebackup/streamutil.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,9 @@ RetrieveWalSegSize(PGconn *conn)
336336
if (!IsValidWalSegSize(WalSegSz))
337337
{
338338
fprintf(stderr,
339-
_("%s: WAL segment size must be a power of two between 1MB and 1GB, but the remote server reported a value of %d bytes\n"),
339+
ngettext("%s: WAL segment size must be a power of two between 1 MB and 1 GB, but the remote server reported a value of %d byte\n",
340+
"%s: WAL segment size must be a power of two between 1 MB and 1 GB, but the remote server reported a value of %d bytes\n",
341+
WalSegSz),
340342
progname, WalSegSz);
341343
return false;
342344
}

src/bin/pg_controldata/pg_controldata.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ usage(const char *progname)
3535
printf(_("Usage:\n"));
3636
printf(_(" %s [OPTION] [DATADIR]\n"), progname);
3737
printf(_("\nOptions:\n"));
38-
printf(_(" [-D,--pgdata=]DATADIR data directory\n"));
39-
printf(_(" -V, --version output version information, then exit\n"));
40-
printf(_(" -?, --help show this help, then exit\n"));
38+
printf(_(" [-D, --pgdata=]DATADIR data directory\n"));
39+
printf(_(" -V, --version output version information, then exit\n"));
40+
printf(_(" -?, --help show this help, then exit\n"));
4141
printf(_("\nIf no data directory (DATADIR) is specified, "
4242
"the environment variable PGDATA\nis used.\n\n"));
4343
printf(_("Report bugs to <pgsql-bugs@postgresql.org>.\n"));
@@ -174,11 +174,17 @@ main(int argc, char *argv[])
174174
WalSegSz = ControlFile->xlog_seg_size;
175175

176176
if (!IsValidWalSegSize(WalSegSz))
177-
printf(_("WARNING: invalid WAL segment size\n"
178-
"The WAL segment size stored in the file, %d bytes, is not a power of two\n"
179-
"between 1 MB and 1 GB. The file is corrupt and the results below are\n"
180-
"untrustworthy.\n\n"),
177+
{
178+
printf(_("WARNING: invalid WAL segment size\n"));
179+
printf(ngettext("The WAL segment size stored in the file, %d byte, is not a power of two\n"
180+
"between 1 MB and 1 GB. The file is corrupt and the results below are\n"
181+
"untrustworthy.\n\n",
182+
"The WAL segment size stored in the file, %d bytes, is not a power of two\n"
183+
"between 1 MB and 1 GB. The file is corrupt and the results below are\n"
184+
"untrustworthy.\n\n",
185+
WalSegSz),
181186
WalSegSz);
187+
}
182188

183189
/*
184190
* This slightly-chintzy coding will work as long as the control file

src/bin/pg_resetwal/pg_resetwal.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,8 @@ main(int argc, char *argv[])
366366
/* Set mask based on PGDATA permissions */
367367
if (!GetDataDirectoryCreatePerm(DataDir))
368368
{
369-
fprintf(stderr, _("%s: unable to read permissions from \"%s\"\n"),
370-
progname, DataDir);
369+
fprintf(stderr, _("%s: could not read permissions of directory \"%s\": %s\n"),
370+
progname, DataDir, strerror(errno));
371371
exit(1);
372372
}
373373

@@ -655,7 +655,9 @@ ReadControlFile(void)
655655
if (!IsValidWalSegSize(ControlFile.xlog_seg_size))
656656
{
657657
fprintf(stderr,
658-
_("%s: pg_control specifies invalid WAL segment size (%d bytes); proceed with caution \n"),
658+
ngettext("%s: pg_control specifies invalid WAL segment size (%d byte); proceed with caution\n",
659+
"%s: pg_control specifies invalid WAL segment size (%d bytes); proceed with caution\n",
660+
ControlFile.xlog_seg_size),
659661
progname, ControlFile.xlog_seg_size);
660662
return false;
661663
}

src/bin/pg_rewind/pg_rewind.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ main(int argc, char **argv)
189189
/* Set mask based on PGDATA permissions */
190190
if (!GetDataDirectoryCreatePerm(datadir_target))
191191
{
192-
fprintf(stderr, _("%s: unable to read permissions from \"%s\"\n"),
193-
progname, datadir_target);
192+
fprintf(stderr, _("%s: could not read permissions of directory \"%s\": %s\n"),
193+
progname, datadir_target, strerror(errno));
194194
exit(1);
195195
}
196196

@@ -648,7 +648,9 @@ digestControlFile(ControlFileData *ControlFile, char *src, size_t size)
648648
WalSegSz = ControlFile->xlog_seg_size;
649649

650650
if (!IsValidWalSegSize(WalSegSz))
651-
pg_fatal("WAL segment size must be a power of two between 1MB and 1GB, but the control file specifies %d bytes\n",
651+
pg_fatal(ngettext("WAL segment size must be a power of two between 1 MB and 1 GB, but the control file specifies %d byte\n",
652+
"WAL segment size must be a power of two between 1 MB and 1 GB, but the control file specifies %d bytes\n",
653+
WalSegSz),
652654
WalSegSz);
653655

654656
/* Additional checks on control file */

src/bin/pg_upgrade/pg_upgrade.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ main(int argc, char **argv)
103103
/* Set mask based on PGDATA permissions */
104104
if (!GetDataDirectoryCreatePerm(new_cluster.pgdata))
105105
{
106-
pg_log(PG_FATAL, "unable to read permissions from \"%s\"\n",
107-
new_cluster.pgdata);
106+
pg_log(PG_FATAL, "could not read permissions of directory \"%s\": %s\n",
107+
new_cluster.pgdata, strerror(errno));
108108
exit(1);
109109
}
110110

src/bin/pg_waldump/pg_waldump.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,9 @@ search_directory(const char *directory, const char *fname)
218218
WalSegSz = longhdr->xlp_seg_size;
219219

220220
if (!IsValidWalSegSize(WalSegSz))
221-
fatal_error("WAL segment size must be a power of two between 1MB and 1GB, but the WAL file \"%s\" header specifies %d bytes",
221+
fatal_error(ngettext("WAL segment size must be a power of two between 1 MB and 1 GB, but the WAL file \"%s\" header specifies %d byte",
222+
"WAL segment size must be a power of two between 1 MB and 1 GB, but the WAL file \"%s\" header specifies %d bytes",
223+
WalSegSz),
222224
fname, WalSegSz);
223225
}
224226
else

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